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
This commit is contained in:
Simon Howard 2013-08-11 17:32:29 +00:00
parent b1d51276a2
commit 63acb55b18
34 changed files with 5 additions and 1258 deletions

View file

@ -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)

View file

@ -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
])

View file

@ -28,10 +28,6 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32_WCE
#include "libc_wince.h"
#endif
#include "SDL.h"
#include "opl.h"

View file

@ -27,10 +27,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32_WCE
#include "libc_wince.h"
#endif
#include "config.h"
#include "pcsound.h"
#include "pcsound_internal.h"

View file

@ -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)

View file

@ -1,3 +0,0 @@
Makefile
Makefile.in
*.cab

View file

@ -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)

View file

@ -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

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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("<H", value))
def write_int32(f, value):
f.write(struct.pack("<I", value))
# Pad a string with NUL characters so that it has a length that is
# a multiple of 4. At least one NUL is always added.
def pad_string(s):
pad_len = 4 - (len(s) % 4)
return s + (pad_len * "\x00")
class HeaderSection:
def __init__(self, cab_header):
self.cab_header = cab_header
self.arch = None
self.app_name = None
self.provider = None
self.unsupported = None
def __len__(self):
return 100 # header has fixed size
def set_meta(self, arch, app_name, provider, unsupported):
if arch not in ARCHITECTURES:
raise Exception("Unknown architecture '%s'" % arch)
self.arch = ARCHITECTURES[arch]
dictionary = self.cab_header.dictionary
self.app_name = app_name
dictionary.get(self.app_name)
self.provider = provider
dictionary.get(self.provider)
self.unsupported = unsupported
dictionary.get(self.unsupported)
def write(self, stream):
# Basic header
stream.write(CAB_HEADER)
write_int32(stream, 0)
write_int32(stream, len(self.cab_header))
write_int32(stream, 0)
write_int32(stream, 1)
write_int32(stream, self.arch)
# minimum Windows CE version:
write_int32(stream, 0)
write_int32(stream, 0)
write_int32(stream, 0)
write_int32(stream, 0)
write_int32(stream, 0)
write_int32(stream, 0)
dictionary = self.cab_header.dictionary
# Write number of entries in other sections:
for section in self.cab_header.sections:
if section is not self:
write_int16(stream, section.num_entries())
# Write offsets of other sections:
for section in self.cab_header.sections:
if section is not self:
offset = self.cab_header.get_section_offset(section)
write_int32(stream, offset)
# Special strings:
special_strings = (
self.app_name,
self.provider,
self.unsupported
)
dictionary_offset = self.cab_header.get_section_offset(dictionary)
for s in special_strings:
s_offset = dictionary.get_offset(s)
write_int16(stream, dictionary_offset + s_offset)
write_int16(stream, len(s) + 1)
# Two left-over fields of unknown use:
write_int16(stream, 0)
write_int16(stream, 0)
class StringDictionary:
def __init__(self, cab_header):
self.cab_header = cab_header
self.string_list = []
self.strings = {}
self.length = 0
self.index = 1
# Get the length of the dictionary, in bytes.
def __len__(self):
return self.length
# Get the number of entries in the dictionary.
def num_entries(self):
return len(self.strings)
# Get the ID for the given string, adding it if necessary.
def get(self, s):
# Is this a new string? Add it to the dictionary.
if s not in self.strings:
offset = self.length
padded = pad_string(s)
self.strings[s] = (self.index, offset)
self.string_list.append((self.index, padded))
self.length += len(padded) + 4
self.index += 1
return self.strings[s][0]
# Get the offset of a particular string within the dictionary.
def get_offset(self, s):
return self.strings[s][1] + 4
# Write the dictionary to the output stream.
def write(self, stream):
# Write out all strings:
for i, s in self.string_list:
write_int16(stream, i)
write_int16(stream, len(s))
stream.write(s.encode("ascii"))
class DirectoryList:
def __init__(self, cab_header):
self.cab_header = cab_header
self.directories_list = []
self.directories = {}
self.length = 0
self.index = 1
def __len__(self):
return self.length
def num_entries(self):
return len(self.directories_list)
# Find whether the specified directory exists in the list
def find(self, dir):
key = dir.lower()
if key in self.directories:
return self.directories[key]
else:
return None
# Get the ID for the given directory, adding it if necessary.
def get(self, dir):
key = dir.lower()
dictionary = self.cab_header.dictionary
# Add new directory?
if key not in self.directories:
# Separate into individual directories, and map to strings:
#dir_path = dir.split("\\")
#if dir_path[0] == "":
# dir_path = dir_path[1:]
dir_path = [ dir ]
dir_path = list(map(lambda x: dictionary.get(x), dir_path))
self.directories[key] = self.index
self.directories_list.append((self.index, dir_path))
self.length += 6 + 2 * len(dir_path)
self.index += 1
return self.directories[key]
# Write the directory list to the specified stream.
def write(self, stream):
for i, dir in self.directories_list:
write_int16(stream, i)
write_int16(stream, 2 * len(dir) + 2)
for subdir in dir:
write_int16(stream, subdir)
write_int16(stream, 0)
class FileList:
def __init__(self, cab_header):
self.cab_header = cab_header
self.files = []
self.length = 0
self.index = 1
# Get the length of this section, in bytes.
def __len__(self):
return self.length
# Query whether the file list contains a particular file.
def find(self, filename):
dirname, sep, target_basename = filename.rpartition("\\")
target_basename = pad_string(target_basename)
target_dir_id = self.cab_header.directory_list.find(dirname)
if target_dir_id is None:
return None
else:
# Search the list of files:
for i, dir_id, basename, file_no, flags in self.files:
if dir_id == target_dir_id and basename == target_basename:
return file_no
else:
return None
# Get the number of entries in the file list
def num_entries(self):
return len(self.files)
# Add a file to the list.
def add(self, filename, file_no, flags=0):
dirname, sep, basename = filename.rpartition("\\")
dir_id = self.cab_header.directory_list.get(dirname)
padded = pad_string(basename)
self.files.append((self.index, dir_id, padded, file_no, flags))
self.length += 12 + len(padded)
self.index += 1
# Write this section to the output stream.
def write(self, stream):
for i, dir_id, filename, file_no, flags in self.files:
write_int16(stream, i)
write_int16(stream, dir_id)
write_int16(stream, file_no)
write_int32(stream, flags)
write_int16(stream, len(filename))
stream.write(filename.encode("ascii"))
# TODO?
class RegHiveList:
def __len__(self):
return 0
def num_entries(self):
return 0
def write(self, stream):
pass
class RegKeyList():
def __len__(self):
return 0
def num_entries(self):
return 0
def write(self, stream):
pass
class LinkList:
def __init__(self, cab_header):
self.cab_header = cab_header
self.links = []
self.length = 0
self.index = 1
def __len__(self):
return self.length
def num_entries(self):
return len(self.links)
# Determine the target type (dir/file) and ID:
def __find_target(self, target):
file_id = self.cab_header.file_list.find(target)
if file_id is not None:
return 1, file_id
dir_list = self.cab_header.get_section(DirectoryList)
dir_id = dir_list.find(target)
if dir_id is not None:
return 0, dir_id
raise Exception("Link target '%s' not found" % target)
def add(self, target, destination):
target_type, target_id = self.__find_target(target)
dest_path = destination.split("\\")
# Leading \:
if dest_path[0] == "":
dest_path = dest_path[1:]
# %CEn% to specify the install root is handled differently for
# links than it is for files/dirs.
match = re.match(r"\%CE(\d+)\%", dest_path[0])
if match:
base_dir = int(match.group(1))
dest_path = dest_path[1:]
else:
base_dir = 0
# Map dirs that make up the path to strings.
dictionary = self.cab_header.dictionary
dest_path = list(map(lambda x: dictionary.get(x), dest_path))
self.links.append((self.index, target_type, target_id,
base_dir, dest_path))
self.index += 1
self.length += 14 + 2 * len(dest_path)
def write(self, stream):
for i, target_type, target_id, base_dir, dest_path in self.links:
write_int16(stream, i)
write_int16(stream, 0)
write_int16(stream, base_dir)
write_int16(stream, target_id)
write_int16(stream, target_type)
write_int16(stream, 2 * len(dest_path) + 2)
for subdir in dest_path:
write_int16(stream, subdir)
write_int16(stream, 0)
class CabHeaderFile:
def __init__(self):
self.dictionary = StringDictionary(self)
self.directory_list = DirectoryList(self)
self.file_list = FileList(self)
self.sections = [
HeaderSection(self),
self.dictionary,
self.directory_list,
self.file_list,
RegHiveList(),
RegKeyList(),
LinkList(self)
]
def set_meta(self, *args):
header_section = self.get_section(HeaderSection)
header_section.set_meta(*args)
def add_file(self, filename, file_no, flags=0):
files_section = self.get_section(FileList)
files_section.add(filename, file_no, flags)
def add_link(self, target, destination):
links_section = self.get_section(LinkList)
links_section.add(target, destination)
def get_section(self, section_class):
for section in self.sections:
if isinstance(section, section_class):
return section
else:
raise Exception("Can't find section of class %s" % section_class)
def get_section_offset(self, section):
offset = 0
for s in self.sections:
if section is s:
return offset
offset += len(s)
else:
raise Exception("Section %s not found in list")
def __len__(self):
result = 0
for s in self.sections:
result += len(s)
return result
def write(self, stream):
old_pos = 0
for section in self.sections:
section.write(stream)
pos = stream.tell()
if pos != old_pos + len(section):
print(section)
raise Exception("Section is %i bytes long, but %i written" % \
(len(section), pos - old_pos))
old_pos = pos
class CabFile:
def __init__(self, config):
self.cab_header = CabHeaderFile()
self.__process_meta(config)
self.__process_files(config["files"])
if "links" in config:
self.__process_links(config["links"])
# Metadata:
def __process_meta(self, config):
arch = config.get("arch") or "strongarm"
app_name = config.get("app_name")
provider = config.get("provider")
unsupported = config.get("unsupported") or ""
if app_name is None or provider is None:
raise Exception("Application name and provider must be specified")
self.cab_header.set_meta(arch, app_name, provider, unsupported)
self.app_name = app_name
# Get the shortened 8.3 filename used for the specified file
# within the CAB.
def __shorten_name(self, filename, file_no):
# Strip down to base filename without extension:
basename = os.path.basename(filename)
if "." in basename:
basename = basename.rpartition(".")[0]
# Remove non-alphanumeric characters:
def only_alnum(x):
if x.isalnum():
return x
else:
return ""
cleaned_name = "".join(map(only_alnum, basename))
short_name = cleaned_name[0:8]
if len(short_name) < 8:
short_name = "0" * (8 - len(short_name)) + short_name
return "%s.%03i" % (short_name, file_no)
# Process the list of files to install:
def __process_files(self, files):
self.files = [ self.app_name ]
for filename, source_file in files.items():
file_no = len(self.files)
filename = expand_path(filename)
self.cab_header.add_file(filename, file_no)
self.files.append(source_file)
# Process the list of links:
def __process_links(self, links):
for destination, target in links.items():
target = expand_path(target)
destination = expand_path(destination)
self.cab_header.add_link(target, destination)
# Write the header file:
def __write_header(self, dir):
basename = self.__shorten_name(self.files[0], 0)
filename = os.path.join(dir, basename)
stream = open(filename, "wb")
self.cab_header.write(stream)
stream.close()
return [ filename ]
# Write the files:
def __write_files(self, dir):
result = []
for file_no in range(1, len(self.files)):
source_file = self.files[file_no]
basename = self.__shorten_name(source_file, file_no)
filename = os.path.join(dir, basename)
shutil.copy(source_file, filename)
result.append(filename)
return result
# Output to a file:
def write(self, filename):
temp_dir = tempfile.mkdtemp()
header = self.__write_header(temp_dir)
files = self.__write_files(temp_dir)
files.reverse()
args = [ "lcab", "-n" ] + header + files + [ filename ]
os.spawnlp(os.P_WAIT, "lcab", *args)
# Clean up:
for tmpfile in header + files:
os.remove(tmpfile)
os.rmdir(temp_dir)
def expand_path(filename):
# Replace Unix-style / path separators with DOS-style \
filename = filename.replace("/", "\\")
# Expand $(xyz) path variables to their Windows equivalents:
def replace_var(match):
var_name = match.group(1)
if not var_name in DIR_VARIABLES:
raise Exception("Unknown variable '%s'" % var_name)
else:
return DIR_VARIABLES[var_name]
return re.sub(r"\$\((.*?)\)", replace_var, filename)
def read_config_file(filename):
f = open(filename)
data = f.readlines()
data = "".join(data)
f.close()
prog = compile(data, filename, "exec")
result = {}
eval(prog, result)
return result
# List the files that the output CAB depends on.
def print_dependencies(filename):
config = read_config_file(filename)
files_list = config["files"]
for dest, source_file in files_list.items():
print(source_file)
if len(sys.argv) < 3:
print("Usage: %s <config file> <output file>" % 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])

View file

@ -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@

View file

@ -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.

View file

@ -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.

View file

@ -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.

View file

@ -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;

View file

@ -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)

View file

@ -370,70 +370,6 @@ void M_BindChatControls(unsigned int num_players)
}
}
#ifdef _WIN32_WCE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
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.
}

View file

@ -22,10 +22,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32_WCE
#include "libc_wince.h"
#endif
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View file

@ -28,10 +28,6 @@
#include <sys/types.h>
#if defined(_WIN32_WCE)
#include "libc_wince.h"
#endif
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN

View file

@ -23,10 +23,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32_WCE
#include "libc_wince.h"
#endif
#include "config.h"
#include "textscreen.h"

View file

@ -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;
}

5
wince/.gitignore vendored
View file

@ -1,5 +0,0 @@
Makefile
Makefile.in
.deps
tags
TAGS

View file

@ -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

View file

@ -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.

View file

@ -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)
{
}

View file

@ -1,92 +0,0 @@
//
// "Extension" implementation of getenv for Windows CE.
//
// I (Simon Howard) release this file to the public domain.
//
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <lmcons.h>
#include <secext.h>
#include <shlobj.h>
#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);
}

View file

@ -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 */

View file

@ -1,20 +0,0 @@
//
// "Extension" implementation of errno.h for Windows CE.
//
// I (Simon Howard) release this file to the public domain.
//
#include <windows.h>
#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;
}

View file

@ -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 */

View file

@ -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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#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);
}

View file

@ -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 */

View file

@ -1,4 +0,0 @@
#include "env.h"
#include "fileops.h"