From 63acb55b18f024db74fd9a7eedbf3137922630c4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 11 Aug 2013 17:32:29 +0000 Subject: Remove Windows CE support. What support exists is for obsolete devices I no longer possess; I've never been contacted about the port and it's been several years since I even bothered to build a new version. All the extra overrides are clutter that can just be removed. Subversion-branch: /branches/v2-branch Subversion-revision: 2615 --- Makefile.am | 2 +- configure.in | 15 -- opl/opl.c | 4 - pcsound/pcsound.c | 4 - pkg/Makefile.am | 10 +- pkg/wince/.gitignore | 3 - pkg/wince/GNUmakefile | 35 --- pkg/wince/common.py | 9 - pkg/wince/doom-cab.cfg | 27 -- pkg/wince/heretic-cab.cfg | 27 -- pkg/wince/hexen-cab.cfg | 27 -- pkg/wince/wince-cabgen | 668 ---------------------------------------------- src/Makefile.am | 5 +- src/d_iwad.c | 9 +- src/doomtype.h | 7 - src/i_main.c | 9 - src/i_system.c | 47 ---- src/i_video.c | 13 - src/m_controls.c | 68 +---- src/setup/display.c | 4 - src/setup/execute.c | 4 - src/setup/mainmenu.c | 4 - textscreen/txt_sdl.c | 4 - wince/.gitignore | 5 - wince/Makefile.am | 17 -- wince/README | 8 - wince/dummy.c | 8 - wince/env.c | 92 ------- wince/env.h | 24 -- wince/errno.c | 20 -- wince/errno.h | 17 -- wince/fileops.c | 49 ---- wince/fileops.h | 14 - wince/libc_wince.h | 4 - 34 files changed, 5 insertions(+), 1258 deletions(-) delete mode 100644 pkg/wince/.gitignore delete mode 100644 pkg/wince/GNUmakefile delete mode 100644 pkg/wince/common.py delete mode 100644 pkg/wince/doom-cab.cfg delete mode 100644 pkg/wince/heretic-cab.cfg delete mode 100644 pkg/wince/hexen-cab.cfg delete mode 100755 pkg/wince/wince-cabgen delete mode 100644 wince/.gitignore delete mode 100644 wince/Makefile.am delete mode 100644 wince/README delete mode 100644 wince/dummy.c delete mode 100644 wince/env.c delete mode 100644 wince/env.h delete mode 100644 wince/errno.c delete mode 100644 wince/errno.h delete mode 100644 wince/fileops.c delete mode 100644 wince/fileops.h delete mode 100644 wince/libc_wince.h diff --git a/Makefile.am b/Makefile.am index a853c76c..477f4207 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,7 @@ doc_DATA=$(DOC_FILES) MAINTAINERCLEANFILES = $(AUX_DIST_GEN) -SUBDIRS=wince textscreen opl pcsound data src man +SUBDIRS=textscreen opl pcsound data src man DIST_SUBDIRS=pkg $(SUBDIRS) diff --git a/configure.in b/configure.in index 77a7e6e9..556cefea 100644 --- a/configure.in +++ b/configure.in @@ -90,20 +90,6 @@ AC_SDL_MAIN_WORKAROUND([ AC_CHECK_TOOL(WINDRES, windres, ) AC_CHECK_TOOL(STRIP, strip, ) -# Windows CE build? - -WINDOWS_CE=false - -case "$host" in - *mingw32ce*|*cegcc*|*wince*) - CFLAGS="-I\$(top_builddir)/wince $CFLAGS" - WINDOWS_CE=true - ;; - *) - ;; -esac - -AM_CONDITIONAL(WINDOWS_CE, $WINDOWS_CE) AM_CONDITIONAL(HAVE_WINDRES, test "$WINDRES" != "") AM_CONDITIONAL(HAVE_PYTHON, $HAVE_PYTHON) @@ -170,6 +156,5 @@ src/setup/setup-manifest.xml src/strife/Makefile textscreen/Makefile textscreen/examples/Makefile -wince/Makefile ]) diff --git a/opl/opl.c b/opl/opl.c index 6d0e16db..4f88c53b 100644 --- a/opl/opl.c +++ b/opl/opl.c @@ -28,10 +28,6 @@ #include #include -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - #include "SDL.h" #include "opl.h" diff --git a/pcsound/pcsound.c b/pcsound/pcsound.c index 529349ef..e7b50f0c 100644 --- a/pcsound/pcsound.c +++ b/pcsound/pcsound.c @@ -27,10 +27,6 @@ #include #include -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - #include "config.h" #include "pcsound.h" #include "pcsound_internal.h" diff --git a/pkg/Makefile.am b/pkg/Makefile.am index 538b9e1e..873b5bdf 100644 --- a/pkg/Makefile.am +++ b/pkg/Makefile.am @@ -21,17 +21,9 @@ osx/IWADController.m osx/IWADController.h \ osx/IWADLocation.m osx/IWADLocation.h \ osx/LauncherManager.m osx/LauncherManager.h -WINCE_FILES= \ -wince/GNUmakefile \ -wince/common.py \ -wince/doom-cab.cfg \ -wince/heretic-cab.cfg \ -wince/hexen-cab.cfg \ -wince/wince-cabgen - WIN32_FILES= \ win32/GNUmakefile \ win32/README -EXTRA_DIST=$(OSX_FILES) $(WINCE_FILES) $(WIN32_FILES) +EXTRA_DIST=$(OSX_FILES) $(WIN32_FILES) diff --git a/pkg/wince/.gitignore b/pkg/wince/.gitignore deleted file mode 100644 index 285c4716..00000000 --- a/pkg/wince/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -*.cab diff --git a/pkg/wince/GNUmakefile b/pkg/wince/GNUmakefile deleted file mode 100644 index 3b8171aa..00000000 --- a/pkg/wince/GNUmakefile +++ /dev/null @@ -1,35 +0,0 @@ - -include ../config.make - -# Doom: - -DOOM_CAB=$(PROGRAM_PREFIX)doom-$(PACKAGE_VERSION).cab -DOOM_CFG=doom-cab.cfg -DOOM_DEPS=$(shell ./wince-cabgen -d $(DOOM_CFG)) - -# Heretic: - -HERETIC_CAB=$(PROGRAM_PREFIX)heretic-$(PACKAGE_VERSION).cab -HERETIC_CFG=heretic-cab.cfg -HERETIC_DEPS=$(shell ./wince-cabgen -d $(HERETIC_CFG)) - -# Hexen: - -HEXEN_CAB=$(PROGRAM_PREFIX)hexen-$(PACKAGE_VERSION).cab -HEXEN_CFG=hexen-cab.cfg -HEXEN_DEPS=$(shell ./wince-cabgen -d $(HEXEN_CFG)) - -all: $(DOOM_CAB) $(HERETIC_CAB) $(HEXEN_CAB) - -$(DOOM_CAB) : $(DOOM_CFG) $(DOOM_DEPS) - ./wince-cabgen $< $@ - -$(HERETIC_CAB) : $(HERETIC_CFG) $(HERETIC_DEPS) - ./wince-cabgen $< $@ - -$(HEXEN_CAB) : $(HEXEN_CFG) $(HEXEN_DEPS) - ./wince-cabgen $< $@ - -clean: - rm -f $(DOOM_CAB) $(HERETIC_CAB) $(HEXEN_CAB) - diff --git a/pkg/wince/common.py b/pkg/wince/common.py deleted file mode 100644 index e142c2b7..00000000 --- a/pkg/wince/common.py +++ /dev/null @@ -1,9 +0,0 @@ - -# SDL library files that need to be installed: - -LIBRARIES = [ "SDL.dll", "SDL_mixer.dll", "libSDL_net-1-2-0.dll" ] - -def add_libraries(dir, files): - for lib in LIBRARIES: - files[dir + lib] = lib - diff --git a/pkg/wince/doom-cab.cfg b/pkg/wince/doom-cab.cfg deleted file mode 100644 index 2ffba5a3..00000000 --- a/pkg/wince/doom-cab.cfg +++ /dev/null @@ -1,27 +0,0 @@ - -from common import * - -app_name = "Chocolate Doom" -provider = "Simon Howard" -arch = "strongarm" - -# Install files: - -d = "$(PROGRAMS_GAMES)/Chocolate Doom/" -s = "$(START_GAMES)/" -src = "../../src/" - -files = { - d+"chocolate-doom.exe": src+"chocolate-doom.exe", - d+"chocolate-doom-setup.exe": src+"chocolate-setup.exe", -} - -add_libraries(d, files) - -# Start menu links: - -links = { - s+"Chocolate Doom.lnk": d+"chocolate-doom.exe", - s+"Chocolate Doom Setup.lnk": d+"chocolate-doom-setup.exe" -} - diff --git a/pkg/wince/heretic-cab.cfg b/pkg/wince/heretic-cab.cfg deleted file mode 100644 index ead2081f..00000000 --- a/pkg/wince/heretic-cab.cfg +++ /dev/null @@ -1,27 +0,0 @@ - -from common import * - -app_name = "Chocolate Heretic" -provider = "Simon Howard" -arch = "strongarm" - -# Install files: - -d = "$(PROGRAMS_GAMES)/Chocolate Heretic/" -s = "$(START_GAMES)/" -src = "../../src/" - -files = { - d+"chocolate-heretic.exe": src+"chocolate-heretic.exe", - d+"chocolate-heretic-setup.exe": src+"chocolate-setup.exe", -} - -add_libraries(d, files) - -# Start menu links: - -links = { - s+"Chocolate Heretic.lnk": d+"chocolate-heretic.exe", - s+"Chocolate Heretic Setup.lnk": d+"chocolate-heretic-setup.exe" -} - diff --git a/pkg/wince/hexen-cab.cfg b/pkg/wince/hexen-cab.cfg deleted file mode 100644 index 9d88f01d..00000000 --- a/pkg/wince/hexen-cab.cfg +++ /dev/null @@ -1,27 +0,0 @@ - -from common import * - -app_name = "Chocolate Hexen" -provider = "Simon Howard" -arch = "strongarm" - -# Install files: - -d = "$(PROGRAMS_GAMES)/Chocolate Hexen/" -s = "$(START_GAMES)/" -src = "../../src/" - -files = { - d+"chocolate-hexen.exe": src+"chocolate-hexen.exe", - d+"chocolate-hexen-setup.exe": src+"chocolate-setup.exe", -} - -add_libraries(d, files) - -# Start menu links: - -links = { - s+"Chocolate Hexen.lnk": d+"chocolate-hexen.exe", - s+"Chocolate Hexen Setup.lnk": d+"chocolate-hexen-setup.exe" -} - diff --git a/pkg/wince/wince-cabgen b/pkg/wince/wince-cabgen deleted file mode 100755 index 76845cf9..00000000 --- a/pkg/wince/wince-cabgen +++ /dev/null @@ -1,668 +0,0 @@ -#!/usr/bin/env python - -import os -import re -import shutil -import struct -import sys -import tempfile - -CAB_HEADER = "MSCE".encode("ascii") - -ARCHITECTURES = { - "shx-sh3": 103, - "shx-sh4": 104, - "i386": 386, - "i486": 486, - "i586": 586, - "powerpc-601": 601, - "powerpc-603": 603, - "powerpc-604": 604, - "powerpc-620": 620, - "powerpc-mpc821": 821, - "arm720": 1824, - "arm820": 2080, - "arm920": 2336, - "strongarm": 2577, - "mips-r4000": 4000, - "sh3": 10003, - "sh3e": 10004, - "sh4": 10005, - "alpha-21064": 21064, - "arm7tdmi": 70001, -} - -DIR_VARIABLES = { - "PROGRAMS": "%CE1%", # \Program Files - "WINDOWS": "%CE2%", # \Windows - "DESKTOP": "%CE3%", # \Windows\Desktop - "STARTUP": "%CE4%", # \Windows\StartUp - "DOCUMENTS": "%CE5%", # \My Documents - "PROGRAMS_ACCESSORIES": "%CE6%", # \Program Files\Accessories - "PROGRAMS_COMMUNICATIONS": "%CE7%", # \Program Files\Communications - "PROGRAMS_GAMES": "%CE8%", # \Program Files\Games - "PROGRAMS_OUTLOOK": "%CE9%", # \Program Files\Pocket Outlook - "PROGRAMS_OFFICE": "%CE10%", # \Program Files\Office - "WINDOWS_PROGRAMS": "%CE11%", # \Windows\Programs - "WINDOWS_ACCESSORIES": "%CE12%", # \Windows\Programs\Accessories - "WINDOWS_COMMUNICATIONS": "%CE13%", # \Windows\Programs\Communications - "WINDOWS_GAMES": "%CE14%", # \Windows\Programs\Games - "FONTS": "%CE15%", # \Windows\Fonts - "RECENT": "%CE16%", # \Windows\Recent - "FAVORITES": "%CE17%", # \Windows\Favorites - - "START_PROGRAMS": "%CE11%", # \Windows\Start Menu\Programs - "START_ACCESSORIES": "%CE12%", # \Windows\Start Menu\Accessories - "START_COMMUNICATIONS": "%CE13%", # \Windows\Start Menu\Communications - "START_GAMES": "%CE14%", # \Windows\Start Menu\Games - "START": "%CE17%", # \Windows\Start Menu -} - -def write_int16(f, value): - f.write(struct.pack(" " % sys.argv[0]) - sys.exit(0) - -if sys.argv[1] == "-d": - print_dependencies(sys.argv[2]) -else: - config = read_config_file(sys.argv[1]) - - cab_file = CabFile(config) - cab_file.write(sys.argv[2]) - diff --git a/src/Makefile.am b/src/Makefile.am index b9112c21..e6754a6b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,8 +40,7 @@ net_structrw.c net_structrw.h \ z_native.c z_zone.h @PROGRAM_PREFIX@server_SOURCES=$(COMMON_SOURCE_FILES) $(DEDSERV_FILES) -@PROGRAM_PREFIX@server_LDADD = $(top_builddir)/wince/libc_wince.a \ - @LDFLAGS@ @SDLNET_LIBS@ +@PROGRAM_PREFIX@server_LDADD = @LDFLAGS@ @SDLNET_LIBS@ # Source files used by the game binaries (chocolate-doom, etc.) @@ -137,7 +136,6 @@ SOURCE_FILES_WITH_DEH = $(SOURCE_FILES) \ $(FEATURE_DEHACKED_SOURCE_FILES) EXTRA_LIBS = \ - $(top_builddir)/wince/libc_wince.a \ $(top_builddir)/textscreen/libtextscreen.a \ $(top_builddir)/pcsound/libpcsound.a \ $(top_builddir)/opl/libopl.a \ @@ -200,7 +198,6 @@ else @PROGRAM_PREFIX@setup_SOURCES=$(SETUP_FILES) $(COMMON_SOURCE_FILES) endif @PROGRAM_PREFIX@setup_LDADD = setup/libsetup.a \ - $(top_builddir)/wince/libc_wince.a \ $(top_builddir)/textscreen/libtextscreen.a \ @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@ diff --git a/src/d_iwad.c b/src/d_iwad.c index 7e850d53..715687de 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -536,14 +536,7 @@ static void BuildIWADDirList(void) AddDoomWadPath(); -#if defined(_WIN32_WCE) - - // Windows CE locations: - - AddIWADDir("\\Storage Card"); - AddIWADDir(getenv("HOME")); - -#elif defined(_WIN32) +#ifdef _WIN32 // Search the registry and find where IWADs have been installed. diff --git a/src/doomtype.h b/src/doomtype.h index b458c1cd..fdcdb66b 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -64,13 +64,6 @@ #define PACKEDATTR #endif -// Windows CE is missing some vital ANSI C functions. We have to -// use our own replacements. - -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - // C99 integer types; with gcc we just use this. Other compilers // should add conditional statements that define the C99 types. diff --git a/src/i_main.c b/src/i_main.c index fdfa3cbc..3714bee4 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -140,15 +140,6 @@ int main(int argc, char **argv) myargc = argc; myargv = argv; -#ifdef _WIN32_WCE - - // Windows CE has no environment, but SDL provides an implementation. - // Populate the environment with the values we normally find. - - PopulateEnvironment(); - -#endif - // Only schedule on a single core, if we have multiple // cores. This is to work around a bug in SDL_mixer. diff --git a/src/i_system.c b/src/i_system.c index 328fd9f5..5e3ae89e 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -94,51 +94,6 @@ void I_Tactile(int on, int off, int total) { } -#ifdef _WIN32_WCE - -// Windows CE-specific auto-allocation function that allocates the zone -// size based on the amount of memory reported free by the OS. - -static byte *AutoAllocMemory(int *size, int default_ram, int min_ram) -{ - MEMORYSTATUS memory_status; - byte *zonemem; - size_t available; - - // Get available physical RAM. We leave one megabyte extra free - // for the OS to keep running (my PDA becomes unstable if too - // much RAM is allocated) - - GlobalMemoryStatus(&memory_status); - available = memory_status.dwAvailPhys - 2 * 1024 * 1024; - - // Limit to default_ram if we have more than that available: - - if (available > default_ram * 1024 * 1024) - { - available = default_ram * 1024 * 1024; - } - - if (available < min_ram * 1024 * 1024) - { - I_Error("Unable to allocate %i MiB of RAM for zone", min_ram); - } - - // Allocate zone: - - *size = available; - zonemem = malloc(*size); - - if (zonemem == NULL) - { - I_Error("Failed when allocating %i bytes", *size); - } - - return zonemem; -} - -#else - // Zone memory auto-allocation function that allocates the zone size // by trying progressively smaller zone sizes until one is found that // works. @@ -181,8 +136,6 @@ static byte *AutoAllocMemory(int *size, int default_ram, int min_ram) return zonemem; } -#endif - byte *I_ZoneBase (int *size) { byte *zonemem; diff --git a/src/i_video.c b/src/i_video.c index bf8ab77b..406a8c5a 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -308,17 +308,6 @@ static boolean MouseShouldBeGrabbed() if (fullscreen) return true; -#ifdef _WIN32_WCE - - // On Windows CE, always grab input. This is because hardware - // button events are only acquired by SDL when the input is grabbed. - // Almost all Windows CE devices should have touch screens anyway, - // so this shouldn't affect mouse grabbing behavior. - - return true; - -#else - // Don't grab the mouse if mouse input is disabled if (!usemouse || nomouse) @@ -340,8 +329,6 @@ static boolean MouseShouldBeGrabbed() { return true; } - -#endif /* #ifndef _WIN32_WCE */ } void I_SetGrabMouseCallback(grabmouse_callback_t func) diff --git a/src/m_controls.c b/src/m_controls.c index 409f26bf..41b97fdd 100644 --- a/src/m_controls.c +++ b/src/m_controls.c @@ -370,70 +370,6 @@ void M_BindChatControls(unsigned int num_players) } } -#ifdef _WIN32_WCE - -#define WIN32_LEAN_AND_MEAN -#include - -static int SystemHasKeyboard(void) -{ - HKEY key; - DWORD valtype; - DWORD valsize; - DWORD result; - - if (RegOpenKeyExW(HKEY_CURRENT_USER, - L"\\Software\\Microsoft\\Shell", 0, - KEY_READ, &key) != ERROR_SUCCESS) - { - return 0; - } - - valtype = REG_SZ; - valsize = sizeof(DWORD); - - if (RegQueryValueExW(key, L"HasKeyboard", NULL, &valtype, - (LPBYTE) &result, &valsize) != ERROR_SUCCESS) - { - result = 0; - } - - // Close the key - - RegCloseKey(key); - - return result; -} - -// -// Apply custom defaults for Windows CE. -// - -static void M_ApplyWindowsCEDefaults(void) -{ - // If the system doesn't have a keyboard, patch the default - // configuration to use the hardware keys. - - if (!SystemHasKeyboard()) - { - key_use = KEY_F1; - key_fire = KEY_F2; - key_menu_activate = KEY_F3; - key_map_toggle = KEY_F4; - - key_menu_help = 0; - key_menu_save = 0; - key_menu_load = 0; - key_menu_volume = 0; - - key_menu_confirm = KEY_ENTER; - key_menu_back = KEY_F2; - key_menu_abort = KEY_F2; - } -} - -#endif - // // Apply custom patches to the default values depending on the // platform we are running on. @@ -441,8 +377,6 @@ static void M_ApplyWindowsCEDefaults(void) void M_ApplyPlatformDefaults(void) { -#ifdef _WIN32_WCE - M_ApplyWindowsCEDefaults(); -#endif + // no-op. Add your platform-specific patches here. } diff --git a/src/setup/display.c b/src/setup/display.c index d22cc67b..e988e36f 100644 --- a/src/setup/display.c +++ b/src/setup/display.c @@ -22,10 +22,6 @@ #include #include -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include diff --git a/src/setup/execute.c b/src/setup/execute.c index 96a14fae..57fe71c3 100644 --- a/src/setup/execute.c +++ b/src/setup/execute.c @@ -28,10 +28,6 @@ #include -#if defined(_WIN32_WCE) -#include "libc_wince.h" -#endif - #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c index be4b0999..74e77fd5 100644 --- a/src/setup/mainmenu.c +++ b/src/setup/mainmenu.c @@ -23,10 +23,6 @@ #include #include -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - #include "config.h" #include "textscreen.h" diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 29f8de4c..488399d3 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -178,11 +178,7 @@ static void ChooseFont(void) if (modes == NULL || modes == (SDL_Rect **) -1 || *modes == NULL) { -#ifdef _WIN32_WCE - font = &small_font; -#else font = &main_font; -#endif return; } diff --git a/wince/.gitignore b/wince/.gitignore deleted file mode 100644 index d4e88e5a..00000000 --- a/wince/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -Makefile.in -.deps -tags -TAGS diff --git a/wince/Makefile.am b/wince/Makefile.am deleted file mode 100644 index c19471ca..00000000 --- a/wince/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ - -noinst_LIBRARIES=libc_wince.a - -if WINDOWS_CE - -libc_wince_a_SOURCES = \ - libc_wince.h \ - env.c env.h \ - errno.c errno.h \ - fileops.c fileops.h - -else - -libc_wince_a_SOURCES = dummy.c - -endif - diff --git a/wince/README b/wince/README deleted file mode 100644 index 76f282f4..00000000 --- a/wince/README +++ /dev/null @@ -1,8 +0,0 @@ -Windows CE is a horribly crippled operating system. The poor thing doesn't -even include a complete implementation of the ANSI standard C library. This -is a mini-library called libc_wince that implements some of the missing -library functions. I've only implemented those necessary to get Chocolate -Doom to compile. - -On non-Windows CE platforms it is just built as an empty library. - diff --git a/wince/dummy.c b/wince/dummy.c deleted file mode 100644 index 68af0caa..00000000 --- a/wince/dummy.c +++ /dev/null @@ -1,8 +0,0 @@ - -// Dummy source file so that the Windows CE workaround library is -// not empty. Some platforms don't like empty libraries. - -void DummyWindowsCEFunction(void) -{ -} - diff --git a/wince/env.c b/wince/env.c deleted file mode 100644 index c90b4c8d..00000000 --- a/wince/env.c +++ /dev/null @@ -1,92 +0,0 @@ -// -// "Extension" implementation of getenv for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#include -#include - -#include -#include -#include -#include - -#include "env.h" - -static void WCharToChar(wchar_t *src, char *dest, int buf_len) -{ - unsigned int len; - - len = wcslen(src) + 1; - - WideCharToMultiByte(CP_OEMCP, 0, src, len, dest, buf_len, NULL, NULL); -} - -static void SetEnvironment(char *env_string, wchar_t *wvalue) -{ - char value[MAX_PATH + 10]; - int env_len; - - // Construct the string for putenv: NAME=value - - env_len = strlen(env_string); - strcpy(value, env_string); - - WCharToChar(wvalue, value + env_len, sizeof(value) - env_len); - - // Set the environment variable: - - putenv(value); -} - -static int ReadOwnerName(wchar_t *value, DWORD len) -{ - HKEY key; - DWORD valtype; - - if (RegOpenKeyExW(HKEY_CURRENT_USER, - L"\\ControlPanel\\Owner", 0, - KEY_READ, &key) != ERROR_SUCCESS) - { - return 0; - } - - valtype = REG_SZ; - - if (RegQueryValueExW(key, L"Name", NULL, &valtype, - (LPBYTE) value, &len) != ERROR_SUCCESS) - { - return 0; - } - - // Close the key - - RegCloseKey(key); - - return 1; -} - -void PopulateEnvironment(void) -{ - wchar_t temp[MAX_PATH]; - - // Username: - - if (ReadOwnerName(temp, MAX_PATH)) - { - SetEnvironment("USER=", temp); - SetEnvironment("USERNAME=", temp); - } - - // Temp dir: - - GetTempPathW(MAX_PATH, temp); - SetEnvironment("TEMP=", temp); - - // Use My Documents dir as home: - - SHGetSpecialFolderPath(NULL, temp, CSIDL_PERSONAL, 0); - SetEnvironment("HOME=", temp); -} - diff --git a/wince/env.h b/wince/env.h deleted file mode 100644 index 96805c31..00000000 --- a/wince/env.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// "Extension" implementation of getenv for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#ifndef WINCE_ENV_H -#define WINCE_ENV_H - -// SDL provides an implementation of getenv/putenv: - -#include "SDL_getenv.h" - -#ifndef getenv -#define getenv SDL_getenv -#endif -#ifndef putenv -#define putenv SDL_putenv -#endif - -extern void PopulateEnvironment(void); - -#endif /* #ifndef WINCE_ENV_H */ - diff --git a/wince/errno.c b/wince/errno.c deleted file mode 100644 index 28cd0899..00000000 --- a/wince/errno.c +++ /dev/null @@ -1,20 +0,0 @@ -// -// "Extension" implementation of errno.h for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#include - -#include "errno.h" - -// This should really be a thread-local variable. Oh well. - -static int my_errno; - -int *_GetErrno() -{ - my_errno = GetLastError(); - return &my_errno; -} - diff --git a/wince/errno.h b/wince/errno.h deleted file mode 100644 index a2149b45..00000000 --- a/wince/errno.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// "Extension" implementation of errno.h for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#ifndef WINCE_ERRNO_H -#define WINCE_ERRNO_H - -#define EISDIR 21 /* Is a directory */ - -extern int *_GetErrno(); - -#define errno (*_GetErrno()) - -#endif /* #ifndef WINCE_ERROR_H */ - diff --git a/wince/fileops.c b/wince/fileops.c deleted file mode 100644 index b0617bd3..00000000 --- a/wince/fileops.c +++ /dev/null @@ -1,49 +0,0 @@ -// -// "Extension" implementation of ANSI C file functions for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#include -#include -#include - -#include - -#include "fileops.h" - -int remove(const char *pathname) -{ - wchar_t temp[MAX_PATH + 1]; - - MultiByteToWideChar(CP_OEMCP, - 0, - pathname, - strlen(pathname) + 1, - temp, - MAX_PATH); - - return DeleteFileW(temp) != 0; -} - -int rename(const char *oldpath, const char *newpath) -{ - wchar_t oldpath1[MAX_PATH + 1]; - wchar_t newpath1[MAX_PATH + 1]; - - MultiByteToWideChar(CP_OEMCP, - 0, - oldpath, - strlen(oldpath) + 1, - oldpath1, - MAX_PATH); - MultiByteToWideChar(CP_OEMCP, - 0, - newpath, - strlen(newpath) + 1, - newpath1, - MAX_PATH); - - return MoveFileW(oldpath1, newpath1); -} - diff --git a/wince/fileops.h b/wince/fileops.h deleted file mode 100644 index 757a34fd..00000000 --- a/wince/fileops.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// "Extension" implementation of ANSI C file functions for Windows CE. -// -// I (Simon Howard) release this file to the public domain. -// - -#ifndef WINCE_FILEOPS_H -#define WINCE_FILEOPS_H - -int remove(const char *pathname); -int rename(const char *oldpath, const char *newpath); - -#endif /* #ifndef WINCE_FILEOPS_H */ - diff --git a/wince/libc_wince.h b/wince/libc_wince.h deleted file mode 100644 index 0d6fac05..00000000 --- a/wince/libc_wince.h +++ /dev/null @@ -1,4 +0,0 @@ - -#include "env.h" -#include "fileops.h" - -- cgit v1.2.3