diff --git a/.circleci/config.yml b/.circleci/config.yml
index b5c43d0173b257c65622f434c7c82d4d80304526..ca9105685d1d3696fbd350954b703db7d61b5568 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -58,6 +58,3 @@ jobs:
           key: v1-SRB2-{{ .Branch }}-{{ checksum "objs/Linux/SDL/Release/depend.dep" }}
           paths:
             - /root/.ccache
-
-
-
diff --git a/.travis.yml b/.travis.yml
index e5dbb58e42fedffc63db2ef06cd851b3cdac495e..4648ae567fe77f0522e7d52c2c7d924b92ea61e4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -100,6 +100,21 @@ matrix:
           compiler: gcc-6
           env: WFLAGS="-Wno-tautological-compare"
           #gcc-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511
+        - os: linux
+          addons:
+            apt:
+              sources:
+              - ubuntu-toolchain-r-test
+              packages:
+              - libsdl2-mixer-dev
+              - libpng-dev
+              - libgl1-mesa-dev
+              - libgme-dev
+              - p7zip-full
+              - gcc-7
+          compiler: gcc-7
+          env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3"
+          #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802
         - os: linux
           compiler: clang
           #clang version 3.5.0 (tags/RELEASE_350/final)
@@ -162,6 +177,51 @@ matrix:
               - clang-3.8
           compiler: clang-3.8
           #clang version 3.8.1-svn271127-1~exp1 (branches/release_38)
+        - os: linux
+          addons:
+            apt:
+              sources:
+              - llvm-toolchain-precise-3.9
+              - ubuntu-toolchain-r-test
+              packages:
+              - libsdl2-mixer-dev
+              - libpng-dev
+              - libgl1-mesa-dev
+              - libgme-dev
+              - p7zip-full
+              - clang-3.9
+          compiler: clang-3.9
+          #clang version 3.9.X
+#        - os: linux
+#          addons:
+#            apt:
+#              sources:
+#              - llvm-toolchain-precise-4.0
+#              - ubuntu-toolchain-r-test
+#              packages:
+#              - libsdl2-mixer-dev
+#              - libpng-dev
+#              - libgl1-mesa-dev
+#              - libgme-dev
+#              - p7zip-full
+#              - clang-4.0
+#          compiler: clang-4.0
+#          #clang version 4.0.X
+#        - os: linux
+#          addons:
+#            apt:
+#              sources:
+#              - llvm-toolchain-precise-5.0
+#              - ubuntu-toolchain-r-test
+#              packages:
+#              - libsdl2-mixer-dev
+#              - libpng-dev
+#              - libgl1-mesa-dev
+#              - libgme-dev
+#              - p7zip-full
+#              - clang-5.0
+#          compiler: clang-5.0
+#          #clang version 5.0.X
 #        - os: osx
 #          osx_image: beta-xcode6.1
 #          #Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
@@ -192,6 +252,9 @@ matrix:
       - compiler: clang-3.6
       - compiler: clang-3.7
       - compiler: clang-3.8
+      - compiler: clang-3.9
+      - compiler: clang-4.0
+      - compiler: clang-5.0
 
 cache:
   apt: true
@@ -219,9 +282,9 @@ before_script:
 
 before_install:
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer game-music-emu p7zip; fi
+  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2 sdl2_mixer game-music-emu p7zip; fi
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.4.dmg; hdiutil attach SDL2-2.0.4.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi
+  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi
   - mkdir -p $HOME/srb2_cache
 
diff --git a/objs/DC/SDL/Debug/.gitignore b/bin/Dos/Debug/.gitignore
similarity index 100%
rename from objs/DC/SDL/Debug/.gitignore
rename to bin/Dos/Debug/.gitignore
diff --git a/objs/DC/SDL/Release/.gitignore b/bin/Dos/Release/.gitignore
similarity index 100%
rename from objs/DC/SDL/Release/.gitignore
rename to bin/Dos/Release/.gitignore
diff --git a/objs/PS3/SDL/Debug/.gitignore b/bin/FreeBSD/Debug/.gitignore
similarity index 100%
rename from objs/PS3/SDL/Debug/.gitignore
rename to bin/FreeBSD/Debug/.gitignore
diff --git a/objs/PS3/SDL/Release/.gitignore b/bin/FreeBSD/Release/.gitignore
similarity index 100%
rename from objs/PS3/SDL/Release/.gitignore
rename to bin/FreeBSD/Release/.gitignore
diff --git a/bin/PS3/Debug/.gitignore b/bin/PS3/Debug/.gitignore
deleted file mode 100644
index c4dcd19e5bb9dda4a40bac1684e0c0979543e53f..0000000000000000000000000000000000000000
--- a/bin/PS3/Debug/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/*.elf
-/*.self
-/*.pkg
-/*.BIN
-/pkg
diff --git a/bin/PS3/Release/.gitignore b/bin/PS3/Release/.gitignore
deleted file mode 100644
index c4dcd19e5bb9dda4a40bac1684e0c0979543e53f..0000000000000000000000000000000000000000
--- a/bin/PS3/Release/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/*.elf
-/*.self
-/*.pkg
-/*.BIN
-/pkg
diff --git a/bin/PSP/Release/.gitignore b/bin/PSP/Release/.gitignore
deleted file mode 100644
index 98d08e695f8a77d0e857b148c94b9e6629de5e54..0000000000000000000000000000000000000000
--- a/bin/PSP/Release/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/EBOOT.PBP
-/PARAM.SFO
-/SRB2PSP.PBP
-/SRB2PSP.elf
diff --git a/objs/PSP/SDL/Release/.gitignore b/bin/SDL/Debug/.gitignore
similarity index 100%
rename from objs/PSP/SDL/Release/.gitignore
rename to bin/SDL/Debug/.gitignore
diff --git a/objs/Wii/SDL/Debug/.gitignore b/bin/SDL/Release/.gitignore
similarity index 100%
rename from objs/Wii/SDL/Debug/.gitignore
rename to bin/SDL/Release/.gitignore
diff --git a/bin/Wii/Debug/.gitignore b/bin/Wii/Debug/.gitignore
deleted file mode 100644
index 200eea51f36e6a94c21258089396b2db20725c8d..0000000000000000000000000000000000000000
--- a/bin/Wii/Debug/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/*.elf
-/*.dol
-/apps
diff --git a/bin/Wii/Release/.gitignore b/bin/Wii/Release/.gitignore
deleted file mode 100644
index 200eea51f36e6a94c21258089396b2db20725c8d..0000000000000000000000000000000000000000
--- a/bin/Wii/Release/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/*.elf
-/*.dol
-/apps
diff --git a/objs/Wii/SDL/Release/.gitignore b/bin/dummy/.gitignore
similarity index 100%
rename from objs/Wii/SDL/Release/.gitignore
rename to bin/dummy/.gitignore
diff --git a/bin/nds/Debug/.gitignore b/bin/nds/Debug/.gitignore
deleted file mode 100644
index 9bfc4a51d72ddd27e96051872491fc380c080f22..0000000000000000000000000000000000000000
--- a/bin/nds/Debug/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.arm9
-*.elf*
-*.nds
diff --git a/bin/nds/Release/.gitignore b/bin/nds/Release/.gitignore
deleted file mode 100644
index 9bfc4a51d72ddd27e96051872491fc380c080f22..0000000000000000000000000000000000000000
--- a/bin/nds/Release/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.arm9
-*.elf*
-*.nds
diff --git a/objs/WinCE/SDL/Release/.gitignore b/objs/FreeBSD/SDL/Debug/.gitignore
similarity index 100%
rename from objs/WinCE/SDL/Release/.gitignore
rename to objs/FreeBSD/SDL/Debug/.gitignore
diff --git a/objs/nds/Debug/.gitignore b/objs/FreeBSD/SDL/Release/.gitignore
similarity index 100%
rename from objs/nds/Debug/.gitignore
rename to objs/FreeBSD/SDL/Release/.gitignore
diff --git a/objs/nds/Release/.gitignore b/objs/MasterClient/.gitignore
similarity index 100%
rename from objs/nds/Release/.gitignore
rename to objs/MasterClient/.gitignore
diff --git a/objs/MasterServer/.gitignore b/objs/MasterServer/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..42c6dc2c662642792a8860e166dfd81126695e8f
--- /dev/null
+++ b/objs/MasterServer/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/cygwin/Debug/.gitignore b/objs/cygwin/Debug/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..42c6dc2c662642792a8860e166dfd81126695e8f
--- /dev/null
+++ b/objs/cygwin/Debug/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/cygwin/Release/.gitignore b/objs/cygwin/Release/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..42c6dc2c662642792a8860e166dfd81126695e8f
--- /dev/null
+++ b/objs/cygwin/Release/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/objs/dummy/.gitignore b/objs/dummy/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..42c6dc2c662642792a8860e166dfd81126695e8f
--- /dev/null
+++ b/objs/dummy/.gitignore
@@ -0,0 +1,2 @@
+# DON'T REMOVE
+# This keeps the folder from disappearing
diff --git a/src/Makefile b/src/Makefile
index 27569b36ca772f45fffc26b09625498e16a058d2..017bd2442b6563b64210702087418fb16f013938 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -33,8 +33,6 @@
 #       compile all HW render and 3D sound DLLs for the set
 #     opengl_dll
 #       Pure Mingw only, compile OpenGL HW render DLL
-#     minigl_dll
-#       Pure Mingw only, compile MiniGL HW render DLL
 #     ds3d_dll
 #       Pure Mingw only, compile DirectX DirectSound HW sound DLL
 #     fmod_dll
@@ -91,10 +89,6 @@ D_FILES=$(D_DIR)/srb2.srb \
 
 PKG_CONFIG?=pkg-config
 
-ifdef WIILINUX
-LINUX=1
-endif
-
 ifdef PANDORA
 LINUX=1
 endif
@@ -108,12 +102,6 @@ ifdef HAIKU
 SDL=1
 endif
 
-ifdef NDS
-# Include this before the main Makefile.cfg
-EXENAME?=srb2.elf
-include nds/Makefile.cfg
-endif
-
 include Makefile.cfg
 
 ifdef DUMMY
@@ -139,32 +127,12 @@ PNG_CFLAGS?=
 PNG_LDFLAGS?=-lpng
 endif
 
-ifdef WIILINUX
-NONX86=1
-NOTERMIOS=1
-NOHW=1
-CFLAGS+=-DWMINPUT
-NOTERMIOS=1
-NOPOSTPROCESSING=1
-endif
-
 ifdef PANDORA
 NONX86=1
 NOHW=1
 NOHS=1
 endif
 
-ifdef WII
-NONX86=1
-NOHW=1
-NOPOSTPROCESSING=1
-endif
-
-ifdef PS3N
-NONX86=1
-NOHW=1
-endif
-
 ifdef DJGPPDOS
 include djgppdos/Makefile.cfg
 endif
@@ -196,20 +164,8 @@ ifdef MACOSX
 UNIXCOMMON=1
 endif
 
-ifdef NDS
-NOPNG=1
-NONET=1
-#NOHW=1
-NOHS=1
-NOASM=1
-NOIPX=1
-NONX86=1
-OBJS+=$(OBJDIR)/i_video.o
-LIBS+=-lm
-endif
-
 ifdef SDL
-include sdl/Makefile.cfg
+	include sdl/Makefile.cfg
 endif #ifdef SDL
 
 ifdef DISTCC
@@ -231,11 +187,7 @@ ifndef ECHO
 	OBJDUMP:=@$(OBJDUMP)
 	STRIP:=@$(STRIP)
 	WINDRES:=@$(WINDRES)
-	CP:=@$(CP)
 	MKDIR:=@$(MKDIR)
-	MKISOFS:=@$(MKISOFS)
-	DD:=@$(DD)
-	NDSTOOL:=@$(NDSTOOL)
 	GZIP:=@$(GZIP)
 	MSGFMT:=@$(MSGFMT)
 	UPX:=@$(UPX)
@@ -253,10 +205,8 @@ endif
 ifdef NOHW
 	OPTS+=-DNOHW
 else
-ifndef DC
 	#Hurdler: not really supported and not tested recently
 	#OPTS+=-DUSE_PALETTED_TEXTURE
-endif
 	OPTS+=-DHWRENDER
 	OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
 		 $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
@@ -362,14 +312,6 @@ else
 	OBJS:=$(OBJDIR)/md5.o $(OBJS)
 endif
 
-ifdef FAKEDC
-	OPTS+=-DDC
-endif
-
-ifdef FAKEPSP
-	OPTS+=-DPSP
-endif
-
 ifdef NOPOSTPROCESSING
 	OPTS+=-DNOPOSTPROCESSING
 endif
@@ -521,49 +463,20 @@ ifdef DJGPPDOS
 all:	 pre-build $(BIN)/$(EXENAME)
 endif
 
-ifdef XBOX
-all:	 pre-build $(BIN)/$(BINNAME)
-endif
-
-ifdef PS3N
-all:	 pre-build $(BIN)/$(PKGNAME)
-endif
-
-ifdef WII
-all:	pre-build $(BIN)/$(DOLNAME)
-endif
-
 ifdef PANDORA
 all:	pre-build $(BIN)/$(PNDNAME)
 endif
 
-ifdef PSP
-all:	 pre-build $(BIN)/$(BINNAME) post-build
-endif
-
-ifdef DC
-all:	 pre-build $(BIN)/$(BINNAME) post-build
-endif
 
-ifndef DC
-ifndef PSP
-ifndef XBOX
 ifdef MINGW
 ifndef SDL
 all:	 pre-build $(BIN)/$(EXENAME) dll
 endif
 endif
-endif
-endif
 
 ifdef SDL
 all:	 pre-build $(BIN)/$(EXENAME)
 endif
-endif
-
-ifdef NDS
-all:	$(BIN)/$(EXENAME:.elf=.nds)
-endif
 
 ifdef DUMMY
 all:	$(BIN)/$(EXENAME)
@@ -617,12 +530,10 @@ endif
 
 # mac os x lsdlsrb2 does not like objcopy
 ifndef MACOSX
-ifndef PSP
 	$(OBJCOPY) $(BIN)/$(EXENAME) $(BIN)/$(DBGNAME)
 	$(OBJCOPY) --strip-debug $(BIN)/$(EXENAME)
 	-$(OBJCOPY) --add-gnu-debuglink=$(BIN)/$(DBGNAME) $(BIN)/$(EXENAME)
 endif
-endif
 ifndef NOUPX
 	-$(UPX) $(UPX_OPTS) $(BIN)/$(EXENAME)
 endif
@@ -647,7 +558,7 @@ else
 dll : opengl_dll
 endif
 ifdef MINGW
-all_dll: opengl_dll minigl_dll ds3d_dll fmod_dll openal_dll
+all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
 
 opengl_dll: $(BIN)/r_opengl.dll
 $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
@@ -658,12 +569,6 @@ ifndef NOUPX
 	-$(UPX) $(UPX_OPTS) $@
 endif
 
-minigl_dll: $(BIN)/r_minigl.dll
-$(BIN)/r_minigl.dll: $(OBJDIR)/r_minigl.o
-	-$(MKDIR) $(BIN)
-	@echo Linking R_MiniGL.dll...
-	$(CC) --shared  $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32
-
 ds3d_dll: $(BIN)/s_ds3d.dll
 $(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
 	@echo Linking S_DS3d.dll...
@@ -742,16 +647,6 @@ endif
 	$(REMOVE) $(OBJDIR)/depend.ped
 	@echo "Created dependency file, depend.dep"
 
-ifdef DC
-$(OBJDIR)/v_video.o: v_video.c doomdef.h doomtype.h g_state.h m_swap.h r_local.h \
-  tables.h m_fixed.h screen.h command.h m_bbox.h r_main.h d_player.h \
-  p_pspr.h info.h d_think.h sounds.h p_mobj.h doomdata.h d_ticcmd.h \
-  r_data.h r_defs.h r_state.h r_bsp.h r_segs.h r_plane.h r_sky.h \
-  r_things.h r_draw.h v_video.h hu_stuff.h d_event.h w_wad.h console.h \
-  i_video.h z_zone.h doomstat.h d_clisrv.h d_netcmd.h
-	$(CC) $(CFLAGS) -fno-omit-frame-pointer $(WFLAGS) -c $< -o $@
-endif
-
 ifdef VALGRIND
 $(OBJDIR)/z_zone.o: z_zone.c
 	$(CC) $(CFLAGS) $(WFLAGS) -DHAVE_VALGRIND $(VALGRIND_CFLAGS) -c $< -o $@
@@ -793,70 +688,6 @@ $(OBJDIR)/%.o: %.s
 $(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h
 	$(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff
 
-ifdef DC
-$(OBJDIR)/romdisk.img:
-	$(KOS_GENROMFS) -f romdisk.img -d ../data -v
-
-$(OBJDIR)/romdisk.o: romdisk.img
-	$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
-
-$(OBJDIR)/dchelp.o: $(INTERFACE)/SRB2DC/dchelp.c
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/i_udp.o: $(INTERFACE)/SRB2DC/i_udp.c
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(BIN)/IP.BIN: $(INTERFACE)/SRB2DC/IP.BIN
-	$(CP) $< $@
-
-$(BIN)/SRB2DC.cdi.pass1: $(INTERFACE)/SRB2DC/SELFBOOT.BIN
-	$(CP) $< $@
-
-$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
-	$(KOS_OBJCOPY) -R .stack -O binary $< $@
-
-$(BIN)/1ST_READ.BIN: $(BIN)/$(BINNAME) $(BIN)/scramble
-	$(BIN)/scramble $< $@
-
-$(BIN)/scramble: $(INTERFACE)/SRB2DC/scramble.c
-	-$(MKDIR) $(BIN)
-	$(HOSTCC) $< -o $@
-
-iso: $(BIN)/SRB2DC.iso
-cdi: $(BIN)/SRB2DC.cdi
-
-$(BIN)/SRB2DC.iso.pass1: $(BIN)/1ST_READ.BIN $(BIN)/IP.BIN
-	-$(MKDIR) $(BIN)/cdrom
-	$(CP) $(BIN)/1ST_READ.BIN $(D_FILES) $(BIN)/cdrom
-	$(MKISOFS) -l -r -o $@ $(BIN)/cdrom
-
-$(BIN)/SRB2DC.iso.pass2: $(BIN)/SRB2DC.iso.pass1
-	$(DD) if=$< of=$@ bs=2048 skip=16 status=noxfer
-
-$(BIN)/SRB2DC.iso: $(BIN)/SRB2DC.iso.pass2 $(BIN)/IP.BIN
-	@cat $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
-
-$(BIN)/SRB2DC.cdi: $(BIN)/SRB2DC.iso.pass2 $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN
-	@cat $(BIN)/SRB2DC.cdi.pass1 $(BIN)/IP.BIN $(BIN)/SRB2DC.iso.pass2 > $@
-
-post-build: $(BIN)/1ST_READ.BIN
-endif
-
-ifdef XBOX
-$(OBJDIR)/xboxhelp.o: $(INTERFACE)/SRB2XBOX/xboxhelp.c
-		$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(BIN)/$(BINNAME): $(BIN)/$(EXENAME)
-	$(CXBE) -OUT:"$@" -DUMPINFO:"$(BIN)/SRB2XBOX.cxbe"  -TITLE:"Sonic Robo Blast 2" $<
-endif
-
-ifdef NDS
-$(BIN)/$(EXENAME:.elf=.nds): $(BIN)/$(EXENAME:.elf=.arm9)
-	$(NDSTOOL) -c $@ -9 $(BIN)/$(EXENAME:.elf=.arm9)
-
-%.arm9: %.elf
-	$(OBJCOPY) -O binary $< $@
-endif
 
 ifdef MINGW
 ifndef SDL
@@ -876,14 +707,6 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
  d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
  p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
 	$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
-
-$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
- doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
- command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
- hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
- d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
- p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
-	$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
 endif
 
 ifndef NOHS
@@ -933,25 +756,6 @@ $(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
  hardware/hw_dll.h
 	$(CC) $(M5) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
 endif
-
-ifdef FILTERS
-$(OBJDIR)/%.o: $(INTERFACE)/filter/%.c
-	@echo $< needs deps
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/filters.o: $(INTERFACE)/filter/filters.c $(INTERFACE)/filter/filters.c \
- $(INTERFACE)/filter/filters.h
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/hq2x.o: $(INTERFACE)/filter/hq2x.c $(INTERFACE)/filter/hq2x.c \
- $(INTERFACE)/filter/filters.h
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-
-$(OBJDIR)/lq2x.o: $(INTERFACE)/filter/lq2x.c $(INTERFACE)/filter/lq2x.c \
- $(INTERFACE)/filter/filters.h $(INTERFACE)/filter/interp.h \
- $(INTERFACE)/filter/hq2x.h $(INTERFACE)/filter/lq2x.h
-	$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
-endif
 endif
 
 #############################################################
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index 5bf7f247dfc6c0f0dea25405eaa4eb8e36f8e75b..b32b522f658485252bcda374f9431bf04e248e92 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -7,6 +7,21 @@
 # and other things
 #
 
+ifdef GCC80
+GCC72=1
+endif
+
+ifdef GCC72
+GCC71=1
+endif
+
+ifdef GCC71
+GCC64=1
+endif
+
+ifdef GCC64
+GCC64=1
+endif
 
 ifdef GCC63
 GCC62=1
@@ -77,10 +92,6 @@ ifdef GCC295
 GCC29=1
 endif
 
-ifdef DC
-NOCASTALIGNWARN=1
-endif
-
 OLDWFLAGS:=$(WFLAGS)
 # -W -Wno-unused
 WFLAGS=-Wall
@@ -141,15 +152,11 @@ endif
 ifdef GCC40
  WFLAGS+=-Wold-style-definition
 endif
-ifndef XBOX
  WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
-endif
 ifdef GCC40
  WFLAGS+=-Wmissing-field-initializers
 endif
-ifndef XBOX
  WFLAGS+=-Wmissing-noreturn
-endif
 #WFLAGS+=-Wmissing-format-attribute
 #WFLAGS+=-Wno-multichar
 #WFLAGS+=-Wno-deprecated-declarations
@@ -207,18 +214,11 @@ endif
 
 
 #indicate platform and what interface use with
-ifndef WINCE
-ifndef XBOX
-ifndef PSP
-ifndef DC
-ifndef WII
-ifndef PS3N
 ifndef LINUX
 ifndef FREEBSD
 ifndef CYGWIN32
 ifndef MINGW
 ifndef SDL
-ifndef NDS
 ifndef DUMMY
 	DJGPPDOS=1
 endif
@@ -227,13 +227,6 @@ endif
 endif
 endif
 endif
-endif
-endif
-endif
-endif
-endif
-endif
-endif
 
 #determine the interface directory (where you put all i_*.c)
 i_cdmus_o=$(OBJDIR)/i_cdmus.o
@@ -251,10 +244,7 @@ else
 NASM?=nasm
 endif
 REMOVE?=rm -f
-CP?=cp
 MKDIR?=mkdir -p
-MKISOFS?=mkisofs
-DD?=dd
 GZIP?=gzip
 GZIP_OPTS?=-9 -f -n
 GZIP_OPT2=$(GZIP_OPTS) --rsyncable
@@ -321,80 +311,11 @@ ifdef MINGW64
 	OBJDIR:=$(OBJDIR)/Mingw64
 	BIN:=$(BIN)/Mingw64
 else
-ifdef WII
-	INTERFACE=sdl
-	NONX86=1
-	STATIC=1
-	PREFIX?=powerpc-eabi
-	SDL=1
-	SDLMAIN=1
-	OBJDIR:=$(OBJDIR)/Wii
-	BIN:=$(BIN)/Wii
-	NOUPX=1
-else
-ifdef PS3N
-	INTERFACE=sdl
-	NONX86=1
-	STATIC=1
-	PREFIX?=ppu
-	SDL=1
-	# unsure?
-	#SDLMAIN=1
-	# can't compile SDL_mixer for ps3...
-	NOMIXER=1
-	OBJDIR:=$(OBJDIR)/PS3
-	BIN:=$(BIN)/PS3
-else
 ifdef MINGW
 	INTERFACE=win32
 	NASMFORMAT=win32
 	OBJDIR:=$(OBJDIR)/Mingw
 	BIN:=$(BIN)/Mingw
-else
-ifdef XBOX
-	INTERFACE=sdl
-	NASMFORMAT=win32
-	PREFIX?=/usr/local/openxdk/bin/i386-pc-xbox
-	SDL=1
-	OBJDIR:=$(OBJDIR)/XBOX
-	BIN:=$(BIN)/XBOX
-else
-ifdef PSP
-	INTERFACE=sdl
-	NONX86=1
-	SDL=1
-	OBJDIR:=$(OBJDIR)/PSP
-	BIN:=$(BIN)/PSP
-	NOUPX=1
-else
-ifdef DC
-	INTERFACE=sdl
-	NONX86=1
-	SDL=1
-	OBJDIR:=$(OBJDIR)/DC
-	BIN:=$(BIN)/DC
-	NOUPX=1
-else
-ifdef WINCE
-	INTERFACE=sdl
-	NONX86=1
-	PREFIX?=arm-wince-pe
-	SDL=1
-	OBJDIR:=$(OBJDIR)/WinCE
-	BIN:=$(BIN)/WinCE
-else
-ifdef NDS
-	INTERFACE=nds
-	OBJDIR:=$(OBJDIR)/nds
-	BIN:=$(BIN)/nds
-	NOUPX=1
-endif
-endif
-endif
-endif
-endif
-endif
-endif
 endif
 endif
 endif
diff --git a/src/am_map.c b/src/am_map.c
index b28cecf11602e99caea132e326f6bff1b1bdfe0f..7e012a3043f72ccd0d139351b1f97f21f7174396 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -44,10 +44,6 @@ static const UINT8 NOCLIMBBROWNS      = (2*16);
 static const UINT8 NOCLIMBYELLOWS     = (11*16);
 
 
-#ifdef _NDS
-#undef BACKGROUND
-#endif
-
 // Automap colors
 #define BACKGROUND            DBLACK
 #define YOURCOLORS            DWHITE
diff --git a/src/blua/ldebug.c b/src/blua/ldebug.c
index 497d54980ec35bc64e767ea7b8e58fb61e4887cf..542e209a18a7386c6a225a9b07096e287b0a1717 100644
--- a/src/blua/ldebug.c
+++ b/src/blua/ldebug.c
@@ -412,7 +412,7 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
       case OP_FORLOOP:
       case OP_FORPREP:
         checkreg(pt, a+3);
-        /* go through */
+        /* FALLTHRU */
       case OP_JMP: {
         int dest = pc+1+b;
         /* not full check and jump is forward and do not skip `lastpc'? */
diff --git a/src/blua/llex.c b/src/blua/llex.c
index 0b328dcaddfeb10e5675ca92f39815865198c38a..9e3dc2929b7ffa407dfa7303a08b7cbc1f0f8970 100644
--- a/src/blua/llex.c
+++ b/src/blua/llex.c
@@ -306,11 +306,12 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
               save_and_next(ls); /* skip $ */
               seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
                             luaZ_bufflen(ls->buff) - 2);
-	      ls->refstr++; /* expect '\' anytime soon */
+              ls->refstr++; /* expect '\' anytime soon */
               lua_assert(ls->lookahead.token == TK_EOS);
-	      ls->lookahead.token = TK_CONCAT;
-	      return;
-	    }
+              ls->lookahead.token = TK_CONCAT;
+              return;
+            }
+            /* FALLTHRU */
           default: {
             if (!isdigit(ls->current))
               save_and_next(ls);  /* handles \\, \", \', and \? */
@@ -340,7 +341,8 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
               };
 
             switch (i) {
-                case 4: save( ls, (c>>8) & 0xff );  // pass-through..
+                case 4: save( ls, (c>>8) & 0xff );
+                /* FALLTHRU */
                 case 2: save( ls, c&0xff );
                         break;
                 case 5:
@@ -350,7 +352,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
           }
           continue;
 
-	    // "\u0000".."\x10FFFF": UTF-8 encoded Unicode
+            // "\u0000".."\x10FFFF": UTF-8 encoded Unicode
             //
             // Note that although codes are entered like this (must have min. four digit,
             // just to tease you!) the actual outcome in the string will vary between
@@ -482,20 +484,22 @@ static int llex (LexState *ls, SemInfo *seminfo) {
         else if (sep == -1) return '[';
         else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
       }
+      /* FALLTHRU */
       case '=': {
         next(ls);
         if (ls->current != '=') return '=';
         else { next(ls); return TK_EQ; }
       }
+      /* FALLTHRU */
       case '<': {
         next(ls);
-	if (ls->current == '<') { next(ls); return TK_SHL; }
+        if (ls->current == '<') { next(ls); return TK_SHL; }
         if (ls->current != '=') return '<';
         else { next(ls); return TK_LE; }
       }
       case '>': {
         next(ls);
-	if (ls->current == '>') { next(ls); return TK_SHR; }
+        if (ls->current == '>') { next(ls); return TK_SHR; }
         if (ls->current != '=') return '>';
         else { next(ls); return TK_GE; }
       }
@@ -547,9 +551,10 @@ static int llex (LexState *ls, SemInfo *seminfo) {
       }
       case '\\': if (ls->refstr) {
         ls->refstr--;
-	ls->current = '"'; /* whacky! */
-	return TK_CONCAT;
+        ls->current = '"'; /* whacky! */
+        return TK_CONCAT;
       }
+      /* FALLTHRU */
       default: {
         if (isspace(ls->current)) {
           lua_assert(!currIsNewline(ls));
diff --git a/src/blua/ltable.c b/src/blua/ltable.c
index 9f4d91ff2b782c9422881df8118409c6162e601a..0ddd9ef4fffbff125a76d4a30886cd6a0f35373b 100644
--- a/src/blua/ltable.c
+++ b/src/blua/ltable.c
@@ -478,6 +478,7 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
         return luaH_getnum(t, k);  /* use specialized version */
       /* else go through */
     }
+    /* FALLTHRU */
     default: {
       Node *n = mainposition(t, key);
       do {  /* check whether `key' is somewhere in the chain */
diff --git a/src/command.c b/src/command.c
index d72f845ad37cfbf942ed278990ecac749382c44e..62431b6647b5185f2d7596c93155962970e7ef65 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1189,7 +1189,10 @@ finish:
 		CONS_Printf(M_GetText("%s set to %s\n"), var->name, var->string);
 		var->flags &= ~CV_SHOWMODIFONETIME;
 	}
-	DEBFILE(va("%s set to %s\n", var->name, var->string));
+	else // display message in debug file only
+	{
+		DEBFILE(va("%s set to %s\n", var->name, var->string));
+	}
 	var->flags |= CV_MODIFIED;
 	// raise 'on change' code
 #ifdef HAVE_BLUA
@@ -1233,7 +1236,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
 
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -1252,9 +1255,6 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
 		CONS_Alert(CONS_WARNING, "Netvar not found with netid %hu\n", netid);
 		return;
 	}
-#if 0 //defined (GP2X) || defined (PSP)
-	CONS_Printf("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue);
-#endif
 	DEBFILE(va("Netvar received: %s [netid=%d] value %s\n", cvar->name, netid, svalue));
 
 	Setvalue(cvar, svalue, stealth);
@@ -1353,7 +1353,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth)
 	if (var->flags & CV_NETVAR)
 	{
 		// send the value of the variable
-		XBOXSTATIC UINT8 buf[128];
+		UINT8 buf[128];
 		UINT8 *p = buf;
 		if (!(server || (adminplayer == consoleplayer)))
 		{
diff --git a/src/console.c b/src/console.c
index fe865abe696db65e720acb52ca343eadf7147c81..a504af06d7f4d28f88c0d1f1c40e806c9f5e2b2a 100644
--- a/src/console.c
+++ b/src/console.c
@@ -12,9 +12,6 @@
 
 #ifdef __GNUC__
 #include <unistd.h>
-#ifdef _XBOX
-#include <openxdk/debug.h>
-#endif
 #endif
 
 #include "doomdef.h"
@@ -329,12 +326,7 @@ static void CON_SetupColormaps(void)
 
 // Setup the console text buffer
 //
-// for WII, libogc already has a CON_Init function, we must rename it here
-#ifdef _WII
-void CON_InitWii(void)
-#else
 void CON_Init(void)
-#endif
 {
 	INT32 i;
 
@@ -1032,10 +1024,10 @@ boolean CON_Responder(event_t *ev)
 	// allow people to use keypad in console (good for typing IP addresses) - Calum
 	if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
 	{
-		XBOXSTATIC char keypad_translation[] = {'7','8','9','-',
-		                                        '4','5','6','+',
-		                                        '1','2','3',
-		                                        '0','.'};
+		char keypad_translation[] = {'7','8','9','-',
+		                             '4','5','6','+',
+		                             '1','2','3',
+		                             '0','.'};
 
 		key = keypad_translation[key - KEY_KEYPAD7];
 	}
@@ -1171,7 +1163,7 @@ static void CON_Print(char *msg)
 
 void CON_LogMessage(const char *msg)
 {
-	XBOXSTATIC char txt[8192], *t;
+	char txt[8192], *t;
 	const char *p = msg, *e = txt+sizeof (txt)-2;
 
 	for (t = txt; *p != '\0'; p++)
@@ -1207,15 +1199,10 @@ void CONS_Printf(const char *fmt, ...)
 	va_end(argptr);
 
 	// echo console prints to log file
-#ifndef _arch_dreamcast
 	DEBFILE(txt);
-#endif
 
 	if (!con_started)
 	{
-#if defined (_XBOX) && defined (__GNUC__)
-		if (!keyboard_started) debugPrint(txt);
-#endif
 #ifdef PC_DOS
 		CON_LogMessage(txt);
 		free(txt);
@@ -1236,7 +1223,7 @@ void CONS_Printf(const char *fmt, ...)
 	// if not in display loop, force screen update
 	if (con_startup)
 	{
-#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
+#ifdef _WINDOWS
 		static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
 		patch_t *con_backpic;
 
diff --git a/src/console.h b/src/console.h
index 8cf6483ff697914cff53b85ef7dbac5d0717c2c6..1e510e89a204c2774edf779fa77efe770638183d 100644
--- a/src/console.h
+++ b/src/console.h
@@ -13,11 +13,7 @@
 #include "d_event.h"
 #include "command.h"
 
-#ifdef _WII
-void CON_InitWii(void);
-#else
 void CON_Init(void);
-#endif
 
 boolean CON_Responder(event_t *ev);
 
diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index 9719178bdb4971c3e25c6ed7815ebc4c02c49021..b14e514123819e9c221567768eef127846e406dd 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -10,9 +10,7 @@
 /// \file  d_clisrv.c
 /// \brief SRB2 Network game communication and protocol, all OS independent parts.
 
-#if !defined (UNDER_CE)
 #include <time.h>
-#endif
 #ifdef __GNUC__
 #include <unistd.h> //for unlink
 #endif
@@ -50,10 +48,6 @@
 #include "f_finale.h"
 #endif
 
-#ifdef _XBOX
-#include "sdl/SRB2XBOX/xboxhelp.h"
-#endif
-
 //
 // NETWORKING
 //
@@ -393,7 +387,7 @@ static void ExtraDataTicker(void)
 					{
 						if (server)
 						{
-							XBOXSTATIC UINT8 buf[3];
+							UINT8 buf[3];
 
 							buf[0] = (UINT8)i;
 							buf[1] = KICK_MSG_CON_FAIL;
@@ -544,6 +538,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
 	rsp->thokitem = (UINT32)LONG(players[i].thokitem); //mobjtype_t
 	rsp->spinitem = (UINT32)LONG(players[i].spinitem); //mobjtype_t
 	rsp->revitem = (UINT32)LONG(players[i].revitem); //mobjtype_t
+	rsp->followitem = (UINT32)LONG(players[i].followitem); //mobjtype_t
 	rsp->actionspd = (fixed_t)LONG(players[i].actionspd);
 	rsp->mindash = (fixed_t)LONG(players[i].mindash);
 	rsp->maxdash = (fixed_t)LONG(players[i].maxdash);
@@ -673,6 +668,7 @@ static void resynch_read_player(resynch_pak *rsp)
 	players[i].thokitem = (UINT32)LONG(rsp->thokitem); //mobjtype_t
 	players[i].spinitem = (UINT32)LONG(rsp->spinitem); //mobjtype_t
 	players[i].revitem = (UINT32)LONG(rsp->revitem); //mobjtype_t
+	players[i].followitem = (UINT32)LONG(rsp->followitem); //mobjtype_t
 	players[i].actionspd = (fixed_t)LONG(rsp->actionspd);
 	players[i].mindash = (fixed_t)LONG(rsp->mindash);
 	players[i].maxdash = (fixed_t)LONG(rsp->maxdash);
@@ -1027,7 +1023,7 @@ static void SV_SendResynch(INT32 node)
 
 	if (resynch_score[node] > (unsigned)cv_resynchattempts.value*250)
 	{
-		XBOXSTATIC UINT8 buf[2];
+		UINT8 buf[2];
 		buf[0] = (UINT8)nodetoplayer[node];
 		buf[1] = KICK_MSG_CON_FAIL;
 		SendNetXCmd(XD_KICK, &buf, 2);
@@ -1503,7 +1499,7 @@ static void SV_SavedGame(void)
 {
 	size_t length;
 	UINT8 *savebuffer;
-	XBOXSTATIC char tmpsave[256];
+	char tmpsave[256];
 
 	if (!cv_dumpconsistency.value)
 		return;
@@ -1545,7 +1541,7 @@ static void CL_LoadReceivedSavegame(void)
 {
 	UINT8 *savebuffer = NULL;
 	size_t length, decompressedlen;
-	XBOXSTATIC char tmpsave[256];
+	char tmpsave[256];
 
 	sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
 
@@ -1903,6 +1899,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
 				break; // exit the case
 
 			cl_mode = CL_ASKJOIN; // don't break case continue to cljoin request now
+			/* FALLTHRU */
 
 		case CL_ASKJOIN:
 			CL_LoadServerFiles();
@@ -2002,7 +1999,7 @@ static void CL_ConnectToServer(boolean viams)
 	tic_t asksent;
 #endif
 #ifdef JOININGAME
-	XBOXSTATIC char tmpsave[256];
+	char tmpsave[256];
 
 	sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
 #endif
@@ -2559,7 +2556,7 @@ static void Command_Ban(void)
 
 	if (server || adminplayer == consoleplayer)
 	{
-		XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
+		UINT8 buf[3 + MAX_REASONLENGTH];
 		UINT8 *p = buf;
 		const SINT8 pn = nametonum(COM_Argv(1));
 		const INT32 node = playernode[(INT32)pn];
@@ -2625,7 +2622,7 @@ static void Command_Kick(void)
 
 	if (server || adminplayer == consoleplayer)
 	{
-		XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
+		UINT8 buf[3 + MAX_REASONLENGTH];
 		UINT8 *p = buf;
 		const SINT8 pn = nametonum(COM_Argv(1));
 
@@ -2674,7 +2671,7 @@ static void Command_Kick(void)
 static void Got_KickCmd(UINT8 **p, INT32 playernum)
 {
 	INT32 pnum, msg;
-	XBOXSTATIC char buf[3 + MAX_REASONLENGTH];
+	char buf[3 + MAX_REASONLENGTH];
 	char *reason = buf;
 
 	pnum = READUINT8(*p);
@@ -3065,7 +3062,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -3150,7 +3147,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
 static boolean SV_AddWaitingPlayers(void)
 {
 	INT32 node, n, newplayer = false;
-	XBOXSTATIC UINT8 buf[2];
+	UINT8 buf[2];
 	UINT8 newplayernum = 0;
 
 	// What is the reason for this? Why can't newplayernum always be 0?
@@ -3211,7 +3208,7 @@ void CL_AddSplitscreenPlayer(void)
 
 void CL_RemoveSplitscreenPlayer(void)
 {
-	XBOXSTATIC UINT8 buf[2];
+	UINT8 buf[2];
 
 	if (cl_mode != CL_CONNECTED)
 		return;
@@ -3635,6 +3632,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
 			// Do not remove my own server (we have just get a out of order packet)
 			if (node == servernode)
 				break;
+			/* FALLTHRU */
 
 		default:
 			DEBFILE(va("unknown packet received (%d) from unknown host\n",netbuffer->packettype));
@@ -3654,11 +3652,10 @@ static void HandlePacketFromAwayNode(SINT8 node)
   *
   */
 static void HandlePacketFromPlayer(SINT8 node)
-{FILESTAMP
-	XBOXSTATIC INT32 netconsole;
-	XBOXSTATIC tic_t realend, realstart;
-	XBOXSTATIC UINT8 *pak, *txtpak, numtxtpak;
-FILESTAMP
+{
+	INT32 netconsole;
+	tic_t realend, realstart;
+	UINT8 *pak, *txtpak, numtxtpak;
 
 	txtpak = NULL;
 
@@ -3732,7 +3729,7 @@ FILESTAMP
 			if (netcmds[maketic%BACKUPTICS][netconsole].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].forwardmove < -MAXPLMOVE
 				|| netcmds[maketic%BACKUPTICS][netconsole].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].sidemove < -MAXPLMOVE)
 			{
-				XBOXSTATIC char buf[2];
+				char buf[2];
 				CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), netconsole);
 				//D_Clearticcmd(k);
 
@@ -3775,7 +3772,7 @@ FILESTAMP
 				}
 				else
 				{
-					XBOXSTATIC UINT8 buf[3];
+					UINT8 buf[3];
 
 					buf[0] = (UINT8)netconsole;
 					buf[1] = KICK_MSG_CON_FAIL;
@@ -3791,6 +3788,7 @@ FILESTAMP
 			break;
 		case PT_TEXTCMD2: // splitscreen special
 			netconsole = nodetoplayer2[node];
+			/* FALLTHRU */
 		case PT_TEXTCMD:
 			if (client)
 				break;
@@ -3865,7 +3863,7 @@ FILESTAMP
 			nodewaiting[node] = 0;
 			if (netconsole != -1 && playeringame[netconsole])
 			{
-				XBOXSTATIC UINT8 buf[2];
+				UINT8 buf[2];
 				buf[0] = (UINT8)netconsole;
 				if (netbuffer->packettype == PT_NODETIMEOUT)
 					buf[1] = KICK_MSG_TIMEOUT;
@@ -3893,7 +3891,7 @@ FILESTAMP
 
 				if (server)
 				{
-					XBOXSTATIC UINT8 buf[2];
+					UINT8 buf[2];
 					buf[0] = (UINT8)node;
 					buf[1] = KICK_MSG_CON_FAIL;
 					SendNetXCmd(XD_KICK, &buf, 2);
@@ -3918,7 +3916,7 @@ FILESTAMP
 
 				if (server)
 				{
-					XBOXSTATIC UINT8 buf[2];
+					UINT8 buf[2];
 					buf[0] = (UINT8)node;
 					buf[1] = KICK_MSG_CON_FAIL;
 					SendNetXCmd(XD_KICK, &buf, 2);
@@ -3984,7 +3982,7 @@ FILESTAMP
 
 				if (server)
 				{
-					XBOXSTATIC char buf[2];
+					char buf[2];
 					buf[0] = (char)node;
 					buf[1] = KICK_MSG_CON_FAIL;
 					SendNetXCmd(XD_KICK, &buf, 2);
@@ -4004,7 +4002,7 @@ FILESTAMP
 
 				if (server)
 				{
-					XBOXSTATIC char buf[2];
+					char buf[2];
 					buf[0] = (char)node;
 					buf[1] = KICK_MSG_CON_FAIL;
 					SendNetXCmd(XD_KICK, &buf, 2);
@@ -4034,7 +4032,7 @@ FILESTAMP
 
 				if (server)
 				{
-					XBOXSTATIC UINT8 buf[2];
+					UINT8 buf[2];
 					buf[0] = (UINT8)node;
 					buf[1] = KICK_MSG_CON_FAIL;
 					SendNetXCmd(XD_KICK, &buf, 2);
@@ -4057,9 +4055,8 @@ FILESTAMP
   *
   */
 static void GetPackets(void)
-{FILESTAMP
-	XBOXSTATIC SINT8 node; // The packet sender
-FILESTAMP
+{
+	SINT8 node; // The packet sender
 
 	player_joining = false;
 
@@ -4145,7 +4142,10 @@ static INT16 Consistancy(void)
 
 #ifdef MOBJCONSISTANCY
 	if (!thinkercap.next)
+	{
+		DEBFILE(va("Consistancy = %u\n", ret));
 		return ret;
+	}
 	for (th = thinkercap.next; th != &thinkercap; th = th->next)
 	{
 		if (th->function.acp1 != (actionf_p1)P_MobjThinker)
@@ -4214,6 +4214,8 @@ static INT16 Consistancy(void)
 	}
 #endif
 
+	DEBFILE(va("Consistancy = %u\n", (ret & 0xFFFF)));
+
 	return (INT16)(ret & 0xFFFF);
 }
 
@@ -4554,7 +4556,7 @@ static inline void PingUpdate(void)
 			{
 				if (playeringame[i] && laggers[i])
 				{
-					XBOXSTATIC char buf[2];
+					char buf[2];
 
 					buf[0] = (char)i;
 					buf[1] = KICK_MSG_PING_HIGH;
@@ -4626,9 +4628,9 @@ void NetUpdate(void)
 
 	if (server)
 		CL_SendClientCmd(); // send it
-FILESTAMP
+
 	GetPackets(); // get packet from client or from server
-FILESTAMP
+
 	// client send the command after a receive of the server
 	// the server send before because in single player is beter
 
diff --git a/src/d_clisrv.h b/src/d_clisrv.h
index b9a4eec3e56e0888d578556cdc6a218505bdf2a9..bdf3326658bd0f15c03ecf2a2744f519f6238295 100644
--- a/src/d_clisrv.h
+++ b/src/d_clisrv.h
@@ -189,6 +189,7 @@ typedef struct
 	UINT32 thokitem; // mobjtype_t
 	UINT32 spinitem; // mobjtype_t
 	UINT32 revitem; // mobjtype_t
+	UINT32 followitem; // mobjtype_t
 	fixed_t actionspd;
 	fixed_t mindash;
 	fixed_t maxdash;
diff --git a/src/d_main.c b/src/d_main.c
index bbddfe791547b3944c8475cf9b05c3cbbdc2da28..7620c6b4b4037f8ec8d49f085ecb41351e3aac82 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -30,16 +30,12 @@ int	snprintf(char *str, size_t n, const char *fmt, ...);
 //int	vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
 #endif
 
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#ifdef _WIN32
 #include <direct.h>
 #include <malloc.h>
 #endif
 
-#if !defined (UNDER_CE)
 #include <time.h>
-#elif defined (_XBOX)
-#define NO_TIME
-#endif
 
 #include "doomdef.h"
 #include "am_map.h"
@@ -82,10 +78,6 @@ int	snprintf(char *str, size_t n, const char *fmt, ...);
 #include "config.h.in"
 #endif
 
-#ifdef _XBOX
-#include "sdl/SRB2XBOX/xboxhelp.h"
-#endif
-
 #ifdef HWRENDER
 #include "hardware/hw_main.h" // 3D View Rendering
 #endif
@@ -120,13 +112,8 @@ INT32 postimgparam;
 postimg_t postimgtype2 = postimg_none;
 INT32 postimgparam2;
 
-#ifdef _XBOX
-boolean nomidimusic = true, nosound = true;
-boolean nodigimusic = true;
-#else
 boolean nomidimusic = false, nosound = false;
 boolean nodigimusic = false; // No fmod-based music
-#endif
 
 // These variables are only true if
 // the respective sound system is initialized
@@ -140,13 +127,8 @@ boolean advancedemo;
 INT32 debugload = 0;
 #endif
 
-#ifdef _arch_dreamcast
-char srb2home[256] = "/cd";
-char srb2path[256] = "/cd";
-#else
 char srb2home[256] = ".";
 char srb2path[256] = ".";
-#endif
 boolean usehome = true;
 const char *pandf = "%s" PATHSEP "%s";
 
@@ -817,17 +799,11 @@ static void IdentifyVersion(void)
 	}
 	else
 	{
-#if !defined(_WIN32_WCE) && !defined(_PS3)
 		if (getcwd(srb2path, 256) != NULL)
 			srb2waddir = srb2path;
 		else
-#endif
 		{
-#ifdef _arch_dreamcast
-			srb2waddir = "/cd";
-#else
 			srb2waddir = ".";
-#endif
 		}
 	}
 
@@ -882,11 +858,7 @@ static void IdentifyVersion(void)
 
 #if !defined (HAVE_SDL) || defined (HAVE_MIXER)
 	{
-#if defined (DC) && 0
-		const char *musicfile = "music_dc.dta";
-#else
 		const char *musicfile = "music.dta";
-#endif
 		const char *musicpath = va(pandf,srb2waddir,musicfile);
 		int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music!
 		if (ms == 1)
@@ -978,7 +950,7 @@ void D_SRB2Main(void)
 	boolean autostart = false;
 
 	// keep error messages until the final flush(stderr)
-#if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS)
+#if !defined (PC_DOS) && !defined(NOTERMIOS)
 	if (setvbuf(stderr, NULL, _IOFBF, 1000))
 		I_OutputMsg("setvbuf didnt work\n");
 #endif
@@ -1000,11 +972,11 @@ void D_SRB2Main(void)
 	// identify the main IWAD file to use
 	IdentifyVersion();
 
-#if !defined (_WIN32_WCE) && !defined(NOTERMIOS)
+#if !defined(NOTERMIOS)
 	setbuf(stdout, NULL); // non-buffered output
 #endif
 
-#if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X)
+#if 0 //defined (_DEBUG)
 	devparm = M_CheckParm("-nodebug") == 0;
 #else
 	devparm = M_CheckParm("-debug") != 0;
@@ -1030,13 +1002,8 @@ void D_SRB2Main(void)
 
 		if (!userhome)
 		{
-#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X)
+#if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)
 			I_Error("Please set $HOME to your home directory\n");
-#elif defined (_WIN32_WCE) && 0
-			if (dedicated)
-				snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME);
-			else
-				snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME);
 #else
 			if (dedicated)
 				snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME);
@@ -1073,10 +1040,6 @@ void D_SRB2Main(void)
 		}
 
 		configfile[sizeof configfile - 1] = '\0';
-
-#ifdef _arch_dreamcast
-	strcpy(downloaddir, "/ram"); // the dreamcast's TMP
-#endif
 	}
 
 	// rand() needs seeded regardless of password
@@ -1211,12 +1174,7 @@ void D_SRB2Main(void)
 	HU_Init();
 
 	COM_Init();
-	// libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc
-#ifndef _WII
 	CON_Init();
-#else
-	CON_InitWii();
-#endif
 
 	D_RegisterServerCommands();
 	D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame
@@ -1448,26 +1406,19 @@ const char *D_Home(void)
 #ifdef ANDROID
 	return "/data/data/org.srb2/";
 #endif
-#ifdef _arch_dreamcast
-	char VMUHOME[] = "HOME=/vmu/a1";
-	putenv(VMUHOME); //don't use I_PutEnv
-#endif
 
 	if (M_CheckParm("-home") && M_IsNextParm())
 		userhome = M_GetNextParm();
 	else
 	{
-#if defined (GP2X)
-		usehome = false; //let use the CWD
-		return NULL;
-#elif !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__) && !defined(_WIN32_WCE)
+#if !((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__APPLE__)
 		if (FIL_FileOK(CONFIGFILENAME))
 			usehome = false; // Let's NOT use home
 		else
 #endif
 			userhome = I_GetEnv("HOME"); //Alam: my new HOME for srb2
 	}
-#if defined (_WIN32) && !defined(_WIN32_WCE) //Alam: only Win32 have APPDATA and USERPROFILE
+#ifdef _WIN32 //Alam: only Win32 have APPDATA and USERPROFILE
 	if (!userhome && usehome) //Alam: Still not?
 	{
 		char *testhome = NULL;
diff --git a/src/d_net.c b/src/d_net.c
index 48c1d60ea7bd918840da01d31f0e488020f9cef6..2c0a8a3292bdd01047059ab7cbc3cd9a4e34b059 100644
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1030,6 +1030,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
 #endif
 			return false;
 		}
+		netbuffer->ack = netbuffer->ackreturn = 0; // don't hold over values from last packet sent/received
 		M_Memcpy(&reboundstore[rebound_head], netbuffer,
 			doomcom->datalength);
 		reboundsize[rebound_head] = doomcom->datalength;
@@ -1358,14 +1359,9 @@ boolean D_CheckNetGame(void)
 	netbuffer = (doomdata_t *)(void *)&doomcom->data;
 
 #ifdef DEBUGFILE
-#ifdef _arch_dreamcast
-	//debugfile = stderr;
-	if (debugfile)
-			CONS_Printf(M_GetText("debug output to: %s\n"), "STDERR");
-#else
 	if (M_CheckParm("-debugfile"))
 	{
-		char filename[20];
+		char filename[21];
 		INT32 k = doomcom->consoleplayer - 1;
 		if (M_IsNextParm())
 			k = atoi(M_GetNextParm()) - 1;
@@ -1380,7 +1376,6 @@ boolean D_CheckNetGame(void)
 		else
 			CONS_Alert(CONS_WARNING, M_GetText("cannot debug output to file %s!\n"), filename);
 	}
-#endif
 #endif
 
 	D_ClientServerInit();
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index f9bd43b48d4ca0476cfd10feb4982326f6b1abc9..d2439799fc31e1b1896fe56625366cbb2fdb0de7 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -244,22 +244,10 @@ INT32 cv_debug;
 consvar_t cv_usemouse = {"use_mouse", "On", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
 
-#if defined (DC) || defined (_XBOX) || defined (WMINPUT) || defined (_WII) //joystick 1 and 2
-consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
-	I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
-	I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (PSP) || defined (GP2X) || defined (_NDS) //only one joystick
-consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
-	I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
-	I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#else //all esle, no joystick
 consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
 	I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_usejoystick2 = {"use_joystick2", "0", CV_SAVE|CV_CALL, usejoystick_cons_t,
 	I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
-#endif
 #if (defined (LJOYSTICK) || defined (HAVE_SDL))
 #ifdef LJOYSTICK
 consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1044,7 +1032,7 @@ static void SetPlayerName(INT32 playernum, char *newname)
 		CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1);
 		if (server && netgame)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -1124,7 +1112,7 @@ static INT32 snacpending = 0, snac2pending = 0, chmappending = 0;
 //
 static void SendNameAndColor(void)
 {
-	XBOXSTATIC char buf[MAXPLAYERNAME+2];
+	char buf[MAXPLAYERNAME+2];
 	char *p;
 
 	p = buf;
@@ -1405,7 +1393,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
 
 		if (kick)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 			CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor);
 
 			buf[0] = (UINT8)playernum;
@@ -1432,7 +1420,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
 
 void SendWeaponPref(void)
 {
-	XBOXSTATIC UINT8 buf[1];
+	UINT8 buf[1];
 
 	buf[0] = 0;
 	if (players[consoleplayer].pflags & PF_FLIPCAM)
@@ -1448,7 +1436,7 @@ void SendWeaponPref(void)
 
 void SendWeaponPref2(void)
 {
-	XBOXSTATIC UINT8 buf[1];
+	UINT8 buf[1];
 
 	buf[0] = 0;
 	if (players[secondarydisplayplayer].pflags & PF_FLIPCAM)
@@ -1843,7 +1831,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -1920,7 +1908,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
 
 static void Command_Pause(void)
 {
-	XBOXSTATIC UINT8 buf[2];
+	UINT8 buf[2];
 	UINT8 *cp = buf;
 
 	if (COM_Argc() > 1)
@@ -1956,7 +1944,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -1999,7 +1987,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
 // Command for stuck characters in netgames, griefing, etc.
 static void Command_Suicide(void)
 {
-	XBOXSTATIC UINT8 buf[4];
+	UINT8 buf[4];
 	UINT8 *cp = buf;
 
 	WRITEINT32(cp, consoleplayer);
@@ -2036,7 +2024,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -2105,7 +2093,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -2458,7 +2446,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -2473,7 +2461,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 			CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
 			if (server)
 			{
-				XBOXSTATIC UINT8 buf[2];
+				UINT8 buf[2];
 
 				buf[0] = (UINT8)playernum;
 				buf[1] = KICK_MSG_CON_FAIL;
@@ -2512,7 +2500,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 			CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]);
 			if (server)
 			{
-				XBOXSTATIC UINT8 buf[2];
+				UINT8 buf[2];
 
 				buf[0] = (UINT8)playernum;
 				buf[1] = KICK_MSG_CON_FAIL;
@@ -2532,7 +2520,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 			error = true;
 			break;
 		}
-		//fall down
+		/* FALLTHRU */
 	case GT_TAG:
 		switch (NetPacket.packet.newteam)
 		{
@@ -2565,7 +2553,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
 
 	if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error))
 	{
-		XBOXSTATIC UINT8 buf[2];
+		UINT8 buf[2];
 
 		buf[0] = (UINT8)playernum;
 		buf[1] = KICK_MSG_CON_FAIL;
@@ -2716,7 +2704,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
 	(void)salt;
 	memset(dest, 0, 16);
 #else
-	XBOXSTATIC char tmpbuf[256];
+	char tmpbuf[256];
 	const size_t sl = strlen(salt);
 
 	if (len > 256-sl)
@@ -2771,7 +2759,7 @@ static void Command_Login_f(void)
 	// If we have no MD5 support then completely disable XD_LOGIN responses for security.
 	CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n");
 #else
-	XBOXSTATIC UINT8 finalmd5[16];
+	UINT8 finalmd5[16];
 	const char *pw;
 
 	// If the server uses login, it will effectively just remove admin privileges
@@ -2825,7 +2813,7 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
 
 static void Command_Verify_f(void)
 {
-	XBOXSTATIC char buf[8]; // Should be plenty
+	char buf[8]; // Should be plenty
 	char *temp;
 	INT32 playernum;
 
@@ -2862,7 +2850,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -2942,7 +2930,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -2963,7 +2951,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum)
 static void Command_RunSOC(void)
 {
 	const char *fn;
-	XBOXSTATIC char buf[255];
+	char buf[255];
 	size_t length = 0;
 
 	if (COM_Argc() != 2)
@@ -3005,7 +2993,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -3048,7 +3036,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
 static void Command_Addfile(void)
 {
 	const char *fn, *p;
-	XBOXSTATIC char buf[256];
+	char buf[256];
 	char *buf_p = buf;
 	INT32 i;
 	int musiconly; // W_VerifyNMUSlumps isn't boolean
@@ -3148,7 +3136,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
 
 	if ((playernum != serverplayer && playernum != adminplayer) || kick)
 	{
-		XBOXSTATIC UINT8 buf[2];
+		UINT8 buf[2];
 
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
 
@@ -3208,7 +3196,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -3950,7 +3938,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum)
 		CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
diff --git a/src/d_netfil.c b/src/d_netfil.c
index 9f2446e7e51ee13cf90ef7b2524c325af7bcfbfb..bf94e0ca778d6bfa5ef2149ba221b813301c3e44 100644
--- a/src/d_netfil.c
+++ b/src/d_netfil.c
@@ -11,21 +11,14 @@
 /// \brief Transfer a file using HSendPacket.
 
 #include <stdio.h>
-#ifndef _WIN32_WCE
-#ifdef __OS2__
-#include <sys/types.h>
-#endif // __OS2__
 #include <sys/stat.h>
-#endif
 
-#if !defined (UNDER_CE)
 #include <time.h>
-#endif
 
-#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX)
+#if defined (_WIN32) || defined (__DJGPP__)
 #include <io.h>
 #include <direct.h>
-#elif !defined (_WIN32_WCE) && !(defined (_XBOX) && !defined (__GNUC__))
+#else
 #include <sys/types.h>
 #include <dirent.h>
 #include <utime.h>
@@ -34,7 +27,7 @@
 #ifdef __GNUC__
 #include <unistd.h>
 #include <limits.h>
-#elif defined (_WIN32) && !defined (_WIN32_WCE)
+#elif defined (_WIN32)
 #include <sys/utime.h>
 #endif
 #ifdef __DJGPP__
@@ -932,7 +925,7 @@ size_t nameonlylength(const char *s)
 
 filestatus_t checkfilemd5(char *filename, const UINT8 *wantedmd5sum)
 {
-#if defined (NOMD5) || defined (_arch_dreamcast)
+#if defined (NOMD5)
 	(void)wantedmd5sum;
 	(void)filename;
 #else
@@ -967,9 +960,5 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
 	if (homecheck == FS_FOUND)
 		return filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
 
-#ifdef _arch_dreamcast
-	return filesearch(filename, "/cd", wantedmd5sum, completepath, 10);
-#else
 	return filesearch(filename, ".", wantedmd5sum, completepath, 10);
-#endif
 }
diff --git a/src/d_player.h b/src/d_player.h
index bf0b303b8ece7552fb3a40c271826a3b40905fd3..e1350fe67db507ea2de57c0a146ecb49657a778e 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -369,6 +369,8 @@ typedef struct player_s
 	mobjtype_t thokitem; // Object # to spawn for the thok
 	mobjtype_t spinitem; // Object # to spawn for spindash/spinning
 	mobjtype_t revitem; // Object # to spawn for spindash/spinning
+	mobjtype_t followitem; // Object # to spawn for Smiles
+	mobj_t *followmobj; // Smiles all around
 
 	fixed_t actionspd; // Speed of thok/glide/fly
 	fixed_t mindash; // Minimum spindash speed
diff --git a/src/dehacked.c b/src/dehacked.c
index d1d21b340f161434967d19a389b63b3c6d612a27..774257d4dbd3a87b7df1fb0f95608d99b7de6491 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -11,6 +11,7 @@
 /// \brief Load dehacked file and change tables and text
 
 #include "doomdef.h"
+#include "d_main.h" // for srb2home
 #include "g_game.h"
 #include "sounds.h"
 #include "info.h"
@@ -1803,6 +1804,7 @@ static actionpointer_t actionpointers[] =
 	{{A_FlickyHeightCheck},    "A_FLICKYHEIGHTCHECK"},
 	{{A_FlickyFlutter},        "A_FLICKYFLUTTER"},
 	{{A_FlameParticle},        "A_FLAMEPARTICLE"},
+	{{A_FadeOverlay},          "A_FADEOVERLAY"},
 
 	{{NULL},                   "NONE"},
 
@@ -1883,7 +1885,7 @@ static void readframe(MYFILE *f, INT32 num)
 			{
 				size_t z;
 				boolean found = false;
-				XBOXSTATIC char actiontocompare[32];
+				char actiontocompare[32];
 
 				memset(actiontocompare, 0x00, sizeof(actiontocompare));
 				strlcpy(actiontocompare, word2, sizeof (actiontocompare));
@@ -2800,6 +2802,8 @@ static void readmaincfg(MYFILE *f)
 
 				strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder));
 				strlcat(savegamename, "%u.ssg", sizeof(savegamename));
+				// can't use sprintf since there is %u in savegamename
+				strcatbf(savegamename, srb2home, PATHSEP);
 
 				gamedataadded = true;
 				titlechanged = true;
@@ -2828,6 +2832,11 @@ static void readmaincfg(MYFILE *f)
 				bootmap = (INT16)value;
 				//titlechanged = true;
 			}
+			else if (fastcmp(word, "STARTCHAR"))
+			{
+				startchar = (INT16)value;
+				char_on = -1;
+			}
 			else
 				deh_warning("Maincfg: unknown word '%s'", word);
 		}
@@ -3029,7 +3038,7 @@ static void DEH_LoadDehackedFile(MYFILE *f)
 	dbg_line = -1; // start at -1 so the first line is 0.
 	while (!myfeof(f))
 	{
-		XBOXSTATIC char origpos[128];
+		char origpos[128];
 		INT32 size = 0;
 		char *traverse;
 
@@ -3457,15 +3466,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
 	"S_PLAY_MELEE_LANDING",
 
 	// SF_SUPER
-	"S_PLAY_SUPERTRANS1",
-	"S_PLAY_SUPERTRANS2",
-	"S_PLAY_SUPERTRANS3",
-	"S_PLAY_SUPERTRANS4",
-	"S_PLAY_SUPERTRANS5",
-	"S_PLAY_SUPERTRANS6",
-	"S_PLAY_SUPERTRANS7",
-	"S_PLAY_SUPERTRANS8",
-	"S_PLAY_SUPERTRANS9", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes.
+	"S_PLAY_SUPER_TRANS1",
+	"S_PLAY_SUPER_TRANS2",
+	"S_PLAY_SUPER_TRANS3",
+	"S_PLAY_SUPER_TRANS4",
+	"S_PLAY_SUPER_TRANS5",
+	"S_PLAY_SUPER_TRANS6", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes.
 
 	// technically the player goes here but it's an infinite tic state
 	"S_OBJPLACE_DUMMY",
@@ -3481,15 +3487,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
 	"S_PLAY_SIGN",
 
 	// NiGHTS character (uses player sprite)
-	"S_PLAY_NIGHTS_TRANS",
+	"S_PLAY_NIGHTS_TRANS1",
 	"S_PLAY_NIGHTS_TRANS2",
 	"S_PLAY_NIGHTS_TRANS3",
 	"S_PLAY_NIGHTS_TRANS4",
 	"S_PLAY_NIGHTS_TRANS5",
 	"S_PLAY_NIGHTS_TRANS6",
-	"S_PLAY_NIGHTS_TRANS7",
-	"S_PLAY_NIGHTS_TRANS8",
-	"S_PLAY_NIGHTS_TRANS9",
 
 	"S_PLAY_NIGHTS_STAND",
 	"S_PLAY_NIGHTS_FLOAT",
@@ -3524,6 +3527,20 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
 	"S_PLAY_NIGHTS_FLYC",
 	"S_PLAY_NIGHTS_DRILLC",
 
+	// c:
+	"S_TAILSOVERLAY_STAND",
+	"S_TAILSOVERLAY_0DEGREES",
+	"S_TAILSOVERLAY_PLUS30DEGREES",
+	"S_TAILSOVERLAY_PLUS60DEGREES",
+	"S_TAILSOVERLAY_MINUS30DEGREES",
+	"S_TAILSOVERLAY_MINUS60DEGREES",
+	"S_TAILSOVERLAY_RUN",
+	"S_TAILSOVERLAY_FLY",
+	"S_TAILSOVERLAY_TIRE",
+	"S_TAILSOVERLAY_PAIN",
+	"S_TAILSOVERLAY_GASP",
+	"S_TAILSOVERLAY_EDGE",
+
 	// Blue Crawla
 	"S_POSS_STND",
 	"S_POSS_RUN1",
@@ -5878,6 +5895,7 @@ static const char *const MOBJTYPE_LIST[] = {  // array length left dynamic for s
 
 	"MT_THOK", // Thok! mobj
 	"MT_PLAYER",
+	"MT_TAILSOVERLAY", // c:
 
 	// Enemies
 	"MT_BLUECRAWLA",
@@ -7071,7 +7089,7 @@ struct {
 	{"ME_ALLEMERALDS",ME_ALLEMERALDS},
 	{"ME_ULTIMATE",ME_ULTIMATE},
 	{"ME_PERFECT",ME_PERFECT},
-	
+
 #ifdef HAVE_BLUA
 	// p_local.h constants
 	{"FLOATSPEED",FLOATSPEED},
diff --git a/src/doomdef.h b/src/doomdef.h
index 4d6bf75bbb65c0089d5d51dd98a7eb81de071c7b..a49fb0207a1783ba03f64700dd2ad674d0d92fbf 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -28,13 +28,11 @@
 
 // Use Mixer interface?
 #ifdef HAVE_MIXER
-    //#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
     #define SOUND SOUND_MIXER
     #define NOHS // No HW3SOUND
     #ifdef HW3SOUND
     #undef HW3SOUND
     #endif
-    //#endif
 #endif
 
 // Use generic SDL interface.
@@ -70,7 +68,7 @@
 #endif
 #endif
 
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
 #define ASMCALL __cdecl
 #else
 #define ASMCALL
@@ -87,13 +85,6 @@
 // warning C4152: nonstandard extension, function/data pointer conversion in expression
 // warning C4213: nonstandard extension used : cast on l-value
 
-#if defined (_WIN32_WCE) && defined (DEBUG) && defined (ARM)
-#if defined (ARMV4) || defined (ARMV4I)
-//#pragma warning(disable : 1166)
-// warning LNK1166: cannot adjust code at offset=
-#endif
-#endif
-
 
 #include "doomtype.h"
 
@@ -110,13 +101,11 @@
 #include <locale.h>
 #endif
 
-#if !defined (_WIN32_WCE)
 #include <sys/types.h>
 #include <sys/stat.h>
-#endif
 #include <ctype.h>
 
-#if ((defined (_WIN32) && !defined (_WIN32_WCE)) || defined (__DJGPP__)) && !defined (_XBOX)
+#if defined (_WIN32) || defined (__DJGPP__)
 #include <io.h>
 #endif
 
@@ -381,13 +370,11 @@ enum {
 };
 
 // Name of local directory for config files and savegames
-#if !defined(_arch_dreamcast) && !defined(_WIN32_WCE) && !defined(GP2X) && !defined(_WII) && !defined(_PS3)
 #if (((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON)) && !defined (__CYGWIN__)) && !defined (__APPLE__)
 #define DEFAULTDIR ".srb2"
 #else
 #define DEFAULTDIR "srb2"
 #endif
-#endif
 
 #include "g_state.h"
 
@@ -548,19 +535,15 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
 ///	    	Most modifications should probably enable this.
 //#define SAVEGAME_OTHERVERSIONS
 
-#if !defined (_NDS) && !defined (_PSP)
 ///	Shuffle's incomplete OpenGL sorting code.
 #define SHUFFLE // This has nothing to do with sorting, why was it disabled?
-#endif
 
-#if !defined (_NDS) && !defined (_PSP)
 ///	Allow the use of the SOC RESETINFO command.
 ///	\note	Builds that are tight on memory should disable this.
 ///	    	This stops the game from storing backups of the states, sprites, and mobjinfo tables.
 ///	    	Though this info is compressed under normal circumstances, it's still a lot of extra
 ///	    	memory that never gets touched.
 #define ALLOW_RESETDATA
-#endif
 
 #ifndef NONET
 ///	Display a connection screen on join attempts.
diff --git a/src/doomtype.h b/src/doomtype.h
index a711b466d6ccf61d8262534cb585f0a7a3ef7c2e..b0623de9ac410dae011b3ca97ad72f8eb60a8c3a 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -17,16 +17,12 @@
 #ifndef __DOOMTYPE__
 #define __DOOMTYPE__
 
-#if (defined (_WIN32) && !defined (_XBOX)) || (defined (_WIN32_WCE) && !defined (__GNUC__))
+#ifdef _WIN32
 //#define WIN32_LEAN_AND_MEAN
 #define RPC_NO_WINDOWS_H
 #include <windows.h>
 #endif
 
-#ifdef _NDS
-#include <nds.h>
-#endif
-
 /* 7.18.1.1  Exact-width integer types */
 #ifdef _MSC_VER
 #define UINT8 unsigned __int8
@@ -51,19 +47,6 @@ typedef long ssize_t;
 #if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR)))
 #define PDWORD_PTR PDWORD
 #endif
-#elif defined (_arch_dreamcast) // KOS Dreamcast
-#include <arch/types.h>
-
-#define UINT8 unsigned char
-#define SINT8 signed char
-
-#define UINT16 uint16
-#define INT16 int16
-
-#define INT32 int
-#define UINT32 unsigned int
-#define INT64  int64
-#define UINT64 uint64
 #elif defined (__DJGPP__)
 #define UINT8 unsigned char
 #define SINT8 signed char
@@ -97,15 +80,13 @@ typedef long ssize_t;
 #define NOIPX
 #endif
 
-#if defined (_MSC_VER) || defined (__OS2__)
-	// Microsoft VisualC++
 #ifdef _MSC_VER
+	// Microsoft VisualC++
 #if (_MSC_VER <= 1800) // MSVC 2013 and back
 	#define snprintf                _snprintf
 #if (_MSC_VER <= 1200) // MSVC 2012 and back
 	#define vsnprintf               _vsnprintf
 #endif
-#endif
 #endif
 	#define strncasecmp             strnicmp
 	#define strcasecmp              stricmp
@@ -118,23 +99,12 @@ typedef long ssize_t;
 	#define strncasecmp             strnicmp
 	#define strcasecmp              strcmpi
 #endif
-#ifdef _PSP
-	#include <malloc.h>
-#elif (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
+#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
 	#undef stricmp
 	#define stricmp(x,y) strcasecmp(x,y)
 	#undef strnicmp
 	#define strnicmp(x,y,n) strncasecmp(x,y,n)
 #endif
-#ifdef _WIN32_WCE
-#ifndef __GNUC__
-	#define stricmp(x,y)            _stricmp(x,y)
-	#define strnicmp                _strnicmp
-#endif
-	#define strdup                  _strdup
-	#define strupr                  _strupr
-	#define strlwr                  _strlwr
-#endif
 
 #if defined (macintosh) //|| defined (__APPLE__) //skip all boolean/Boolean crap
 	#define true 1
@@ -154,7 +124,7 @@ typedef long ssize_t;
 	#endif
 #endif //macintosh
 
-#if defined (PC_DOS) || defined (_WIN32) || defined (_WII) || defined (_PSP) || defined (_arch_dreamcast) || defined (__HAIKU__) || defined(_NDS)  || defined(_PS3)
+#if defined (PC_DOS) || defined (_WIN32) || defined (__HAIKU__)
 #define HAVE_DOSSTR_FUNCS
 #endif
 
@@ -186,15 +156,10 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
 	//faB: clean that up !!
 	#if defined( _MSC_VER)  && (_MSC_VER >= 1800) // MSVC 2013 and forward
 	#include "stdbool.h"
-	#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
+	#elif defined (_WIN32)
 		#define false   FALSE           // use windows types
 		#define true    TRUE
 		#define boolean BOOL
-	#elif defined(_NDS)
-		#define boolean bool
-	#elif defined(_PS3) // defined(__GNUC__)?
-		#include <stdbool.h>  //_bool_true_false_are_defined?
-		#define boolean bool
 	#else
 		typedef enum {false, true} boolean;
 	#endif
@@ -317,10 +282,6 @@ typedef UINT32 tic_t;
 #define ATTRPACK __attribute__((packed))
 #endif
 #define ATTRUNUSED __attribute__((unused))
-#ifdef _XBOX
-#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
-#define XBOXSTATIC static
-#endif
 #elif defined (_MSC_VER)
 #define ATTRNORETURN __declspec(noreturn)
 #define ATTRINLINE __forceinline
@@ -374,10 +335,4 @@ typedef UINT32 tic_t;
 #ifndef ATTRNOINLINE
 #define ATTRNOINLINE
 #endif
-#ifndef XBOXSTATIC
-#define XBOXSTATIC
-#endif
-#ifndef FILESTAMP
-#define FILESTAMP
-#endif
 #endif //__DOOMTYPE__
diff --git a/src/f_wipe.c b/src/f_wipe.c
index acc4efaaa6d446b7f383766c1977d5311d0c77a9..49ab9cc01442ae5496a9d7533647fb688207ebd0 100644
--- a/src/f_wipe.c
+++ b/src/f_wipe.c
@@ -94,7 +94,7 @@ static fixed_t paldiv = 0;
   * \return	fademask_t for lump
   */
 static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
-	static char lumpname[9] = "FADEmmss";
+	static char lumpname[10] = "FADEmmss";
 	static fademask_t fm = {NULL,0,0,0,0,0};
 	lumpnum_t lumpnum;
 	UINT8 *lump, *mask;
diff --git a/src/filesrch.c b/src/filesrch.c
index a28c4d83c24f03564d456fa3094decb07a1139d7..b4a995154b26e7edd6ddf36c7688320308422e54 100644
--- a/src/filesrch.c
+++ b/src/filesrch.c
@@ -16,16 +16,12 @@
 #ifdef __GNUC__
 #include <dirent.h>
 #endif
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
 //#define WIN32_LEAN_AND_MEAN
 #define RPC_NO_WINDOWS_H
 #include <windows.h>
 #endif
-#ifdef _WIN32_WCE
-#include "sdl/SRB2CE/cehelp.h"
-#else
 #include <sys/stat.h>
-#endif
 #include <string.h>
 
 #include "filesrch.h"
@@ -34,7 +30,7 @@
 #include "z_zone.h"
 #include "m_menu.h" // Addons_option_Onchange
 
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && defined (_MSC_VER) && !defined (_XBOX)
+#if defined (_WIN32) && defined (_MSC_VER)
 
 #include <errno.h>
 #include <io.h>
@@ -338,81 +334,6 @@ UINT8 refreshdirmenu = 0;
 size_t packetsizetally = 0;
 size_t mainwadstally = 0;
 
-#if defined (_XBOX) && defined (_MSC_VER)
-filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
-	boolean completepath, int maxsearchdepth)
-{
-//NONE?
-	startpath = filename = NULL;
-	wantedmd5sum = NULL;
-	maxsearchdepth = 0;
-	completepath = false;
-	return FS_NOTFOUND;
-}
-
-boolean preparefilemenu(boolean samedepth)
-{
-	(void)samedepth;
-	return false;
-}
-
-#elif defined (_WIN32_WCE)
-filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
-	boolean completepath, int maxsearchdepth)
-{
-#ifdef __GNUC__
-//NONE?
-	startpath = filename = NULL;
-	wantedmd5sum = NULL;
-	maxsearchdepth = 0;
-	completepath = false;
-#else
-	WIN32_FIND_DATA dta;
-	HANDLE searchhandle = INVALID_HANDLE_VALUE;
-	const wchar_t wm[4] = L"*.*";
-
-	//if (startpath) SetCurrentDirectory(startpath);
-	if (FIL_ReadFileOK(filename))
-	{
-		// checkfilemd5 returns an FS_* value, either FS_FOUND or FS_MD5SUMBAD
-		return checkfilemd5(filename, wantedmd5sum);
-	}
-	ZeroMemory(&dta,sizeof (dta));
-	if (maxsearchdepth)
-		searchhandle = FindFirstFile(wm,&dta);
-	if (searchhandle != INVALID_HANDLE_VALUE)
-	{
-		do
-		{
-			if ((dta.cFileName[0]!='.') && (dta.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
-			{
-				//if (SetCurrentDirectory(dta.cFileName))
-				{ // can fail if we haven't the right
-					filestatus_t found;
-					found = filesearch(filename,NULL,wantedmd5sum,completepath,maxsearchdepth-1);
-					//SetCurrentDirectory("..");
-					if (found == FS_FOUND || found == FS_MD5SUMBAD)
-					{
-						if (completepath)
-							strcatbf(filename,(char *)dta.cFileName,"\\");
-						FindClose(searchhandle);
-						return found;
-					}
-				}
-			}
-		} while (FindNextFile(searchhandle,&dta)==0);
-		FindClose(searchhandle);
-	}
-#endif
-	return FS_NOTFOUND;
-}
-
-boolean preparefilemenu(boolean samedepth)
-{
-	(void)samedepth;
-	return false;
-}
-#else
 filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
 {
 	filestatus_t retval = FS_NOTFOUND;
@@ -765,4 +686,3 @@ boolean preparefilemenu(boolean samedepth)
 
 	return true;
 }
-#endif
diff --git a/src/g_game.c b/src/g_game.c
index 0d5d35ec595b9fdab5b93d93df9f27677707025b..a2507d3d68ad09d1c2c6cecf4b53a5e9e60042b5 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -302,43 +302,7 @@ void SendWeaponPref2(void);
 
 static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
 static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
-#ifdef _WII
-{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"},
-#if JOYAXISSET > 1
-{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"},
-#endif
-#if JOYAXISSET > 2
-{5, "RTrigger"}, {6, "LTrigger"}, {-5, "RTrigger-"}, {-6, "LTrigger-"},
-#endif
-#if JOYAXISSET > 3
-{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
-#endif
-#if JOYAXISSET > 4
-{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
-#endif
-#if JOYAXISSET > 4
-{9, "LAnalog"}, {10, "RAnalog"}, {-9, "LAnalog-"}, {-10, "RAnalog-"},
-#endif
-#elif defined (WMINPUT)
-{1, "LStick.X"}, {2, "LStick.Y"}, {-1, "LStick.X-"}, {-2, "LStick.Y-"},
-#if JOYAXISSET > 1
-{3, "RStick.X"}, {4, "RStick.Y"}, {-3, "RStick.X-"}, {-4, "RStick.Y-"},
-#endif
-#if JOYAXISSET > 2
-{5, "NStick.X"}, {6, "NStick.Y"}, {-5, "NStick.X-"}, {-6, "NStick.Y-"},
-#endif
-#if JOYAXISSET > 3
-{7, "LAnalog"}, {8, "RAnalog"}, {-7, "LAnalog-"}, {-8, "RAnalog-"},
-#endif
-#else
 {1, "X-Axis"}, {2, "Y-Axis"}, {-1, "X-Axis-"}, {-2, "Y-Axis-"},
-#ifdef _arch_dreamcast
-{3, "R-Trig"}, {4, "L-Trig"}, {-3, "R-Trig-"}, {-4, "L-Trig-"},
-{5, "Alt X-Axis"}, {6, "Alt Y-Axis"}, {-5, "Alt X-Axis-"}, {-6, "Alt Y-Axis-"},
-{7, "Triggers"}, {-7,"Triggers-"},
-#elif defined (_XBOX)
-{3, "Alt X-Axis"}, {4, "Alt Y-Axis"}, {-3, "Alt X-Axis-"}, {-4, "Alt Y-Axis-"},
-#else
 #if JOYAXISSET > 1
 {3, "Z-Axis"}, {4, "X-Rudder"}, {-3, "Z-Axis-"}, {-4, "X-Rudder-"},
 #endif
@@ -347,19 +311,11 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
 #endif
 #if JOYAXISSET > 3
 {7, "U-Axis"}, {8, "V-Axis"}, {-7, "U-Axis-"}, {-8, "V-Axis-"},
-#endif
-#endif
 #endif
  {0, NULL}};
-#ifdef _WII
-#if JOYAXISSET > 5
-"More Axis Sets"
-#endif
-#else
 #if JOYAXISSET > 4
 "More Axis Sets"
 #endif
-#endif
 
 consvar_t cv_crosshair = {"crosshair", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_crosshair2 = {"crosshair2", "Cross", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -371,13 +327,8 @@ consvar_t cv_mousemove = {"mousemove", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, N
 consvar_t cv_mousemove2 = {"mousemove2", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_analog = {"analog", "Off", CV_CALL, CV_OnOff, Analog_OnChange, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_analog2 = {"analog2", "Off", CV_CALL, CV_OnOff, Analog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#ifdef DC
-consvar_t cv_useranalog = {"useranalog", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_useranalog2 = {"useranalog2", "On", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_useranalog = {"useranalog", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog_OnChange, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_useranalog2 = {"useranalog2", "Off", CV_SAVE|CV_CALL, CV_OnOff, UserAnalog2_OnChange, 0, NULL, NULL, 0, 0, NULL};
-#endif
 
 static CV_PossibleValue_t directionchar_cons_t[] = {{0, "Camera"}, {1, "Movement"}, {0, NULL}};
 
@@ -399,68 +350,19 @@ typedef enum
 	AXISFIRENORMAL,
 } axis_input_e;
 
-#if defined (_WII) || defined  (WMINPUT)
-consvar_t cv_turnaxis = {"joyaxis_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_moveaxis = {"joyaxis_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_sideaxis = {"joyaxis_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis = {"joyaxis_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_fireaxis = {"joyaxis_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_firenaxis = {"joyaxis_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_turnaxis = {"joyaxis_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#ifdef PSP
-consvar_t cv_moveaxis = {"joyaxis_move", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_moveaxis = {"joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifdef _arch_dreamcast
-consvar_t cv_sideaxis = {"joyaxis_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_XBOX)
-consvar_t cv_sideaxis = {"joyaxis_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis = {"joyaxis_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (PSP)
-consvar_t cv_sideaxis = {"joyaxis_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_sideaxis = {"joyaxis_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifndef _XBOX
-#ifdef PSP
-consvar_t cv_lookaxis = {"joyaxis_look", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#endif
 consvar_t cv_fireaxis = {"joyaxis_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_firenaxis = {"joyaxis_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
 
-#if defined (_WII) || defined  (WMINPUT)
-consvar_t cv_turnaxis2 = {"joyaxis2_turn", "LStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_moveaxis2 = {"joyaxis2_move", "LStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "RStick.X", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis2 = {"joyaxis2_look", "RStick.Y", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_fireaxis2 = {"joyaxis2_fire", "LAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "RAnalog", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_turnaxis2 = {"joyaxis2_turn", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_moveaxis2 = {"joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#ifdef _arch_dreamcast
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "Triggers", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_XBOX)
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "Alt X-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_lookaxis2 = {"joyaxis2_look", "Alt Y-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#elif defined (_PSP)
-consvar_t cv_sideaxis2 = {"joyaxis2_side", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_sideaxis2 = {"joyaxis2_side", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-#ifndef _XBOX
 consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
 consvar_t cv_fireaxis2 = {"joyaxis2_fire", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_firenaxis2 = {"joyaxis2_firenormal", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-
 
 #if MAXPLAYERS > 32
 #error "please update player_name table using the new value for MAXPLAYERS"
@@ -747,7 +649,7 @@ void G_SetGameModified(boolean silent)
   */
 const char *G_BuildMapName(INT32 map)
 {
-	static char mapname[9] = "MAPXX"; // internal map name (wad resource name)
+	static char mapname[10] = "MAPXX"; // internal map name (wad resource name)
 
 	I_Assert(map > 0);
 	I_Assert(map <= NUMMAPS);
@@ -838,14 +740,6 @@ static INT32 JoyAxis(axis_input_e axissel)
 		axisval = -axisval;
 		flp = true;
 	}
-#ifdef _arch_dreamcast
-	if (axisval == 7) // special case
-	{
-		retaxis = joyxmove[1] - joyymove[1];
-		goto skipDC;
-	}
-	else
-#endif
 	if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
 		return 0;
 
@@ -861,10 +755,6 @@ static INT32 JoyAxis(axis_input_e axissel)
 		retaxis = joyymove[axisval];
 	}
 
-#ifdef _arch_dreamcast
-	skipDC:
-#endif
-
 	if (retaxis < (-JOYAXISRANGE))
 		retaxis = -JOYAXISRANGE;
 	if (retaxis > (+JOYAXISRANGE))
@@ -916,14 +806,7 @@ static INT32 Joy2Axis(axis_input_e axissel)
 		axisval = -axisval;
 		flp = true;
 	}
-#ifdef _arch_dreamcast
-	if (axisval == 7) // special case
-	{
-		retaxis = joy2xmove[1] - joy2ymove[1];
-		goto skipDC;
-	}
-	else
-#endif
+
 	if (axisval > JOYAXISSET*2 || axisval == 0) //not there in array or None
 		return 0;
 
@@ -939,10 +822,6 @@ static INT32 Joy2Axis(axis_input_e axissel)
 		retaxis = joy2ymove[axisval];
 	}
 
-#ifdef _arch_dreamcast
-	skipDC:
-#endif
-
 	if (retaxis < (-JOYAXISRANGE))
 		retaxis = -JOYAXISRANGE;
 	if (retaxis > (+JOYAXISRANGE))
@@ -2064,6 +1943,7 @@ void G_Ticker(boolean run)
 
 		case GS_TITLESCREEN:
 			if (titlemapinaction) P_Ticker(run); // then intentionally fall through
+			/* FALLTHRU */
 		case GS_WAITINGPLAYERS:
 			F_TitleScreenTicker(run);
 			break;
@@ -2141,6 +2021,7 @@ void G_PlayerReborn(INT32 player)
 	UINT32 thokitem;
 	UINT32 spinitem;
 	UINT32 revitem;
+	UINT32 followitem;
 	fixed_t actionspd;
 	fixed_t mindash;
 	fixed_t maxdash;
@@ -2212,6 +2093,7 @@ void G_PlayerReborn(INT32 player)
 	thokitem = players[player].thokitem;
 	spinitem = players[player].spinitem;
 	revitem = players[player].revitem;
+	followitem = players[player].followitem;
 	actionspd = players[player].actionspd;
 	mindash = players[player].mindash;
 	maxdash = players[player].maxdash;
@@ -2249,6 +2131,7 @@ void G_PlayerReborn(INT32 player)
 	p->thokitem = thokitem;
 	p->spinitem = spinitem;
 	p->revitem = revitem;
+	p->followitem = followitem;
 	p->actionspd = actionspd;
 	p->mindash = mindash;
 	p->maxdash = maxdash;
diff --git a/src/g_input.c b/src/g_input.c
index 36b8373aa7c9ef5c7eb39f53cdeb9206186d580f..67aaf41791c33d90a360a38fe78faaec960155e9 100644
--- a/src/g_input.c
+++ b/src/g_input.c
@@ -204,11 +204,9 @@ static keyname_t keynames[] =
 	{KEY_SCROLLLOCK, "SCROLLLOCK"},
 
 	// bill gates keys
-#ifndef _arch_dreamcast
 	{KEY_LEFTWIN, "LEFTWIN"},
 	{KEY_RIGHTWIN, "RIGHTWIN"},
 	{KEY_MENU, "MENU"},
-#endif
 
 	{KEY_LSHIFT, "LSHIFT"},
 	{KEY_RSHIFT, "RSHIFT"},
@@ -270,140 +268,24 @@ static keyname_t keynames[] =
 	{KEY_MOUSE1+0,"MOUSE1"},
 	{KEY_MOUSE1+1,"MOUSE2"},
 	{KEY_MOUSE1+2,"MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_MOUSE1+3,"MOUSE4"},
 	{KEY_MOUSE1+4,"MOUSE5"},
 	{KEY_MOUSE1+5,"MOUSE6"},
 	{KEY_MOUSE1+6,"MOUSE7"},
 	{KEY_MOUSE1+7,"MOUSE8"},
-#endif
 	{KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
 	{KEY_2MOUSE1+1,"SEC_MOUSE1"},
 	{KEY_2MOUSE1+2,"SEC_MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_2MOUSE1+3,"SEC_MOUSE4"},
 	{KEY_2MOUSE1+4,"SEC_MOUSE5"},
 	{KEY_2MOUSE1+5,"SEC_MOUSE6"},
 	{KEY_2MOUSE1+6,"SEC_MOUSE7"},
 	{KEY_2MOUSE1+7,"SEC_MOUSE8"},
-#endif
 	{KEY_MOUSEWHEELUP, "Wheel 1 UP"},
 	{KEY_MOUSEWHEELDOWN, "Wheel 1 Down"},
 	{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
 	{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
 
-#ifdef DC
-	{KEY_JOY1+0, "JOYC"},
-	{KEY_JOY1+1, "JOYB"},
-	{KEY_JOY1+2, "JOYA"},
-	{KEY_JOY1+3, "JOYS"},
-	{KEY_JOY1+4, "JOYZ"},
-	{KEY_JOY1+5, "JOYY"},
-	{KEY_JOY1+6, "JOYX"},
-	{KEY_JOY1+7, "JOYD"},
-#elif defined (_XBOX)
-	{KEY_JOY1+0, "JOYA"},
-	{KEY_JOY1+1, "JOYB"},
-	{KEY_JOY1+2, "JOYX"},
-	{KEY_JOY1+3, "JOYY"},
-	{KEY_JOY1+4, "JOYG"},
-	{KEY_JOY1+5, "JOYW"},
-	{KEY_JOY1+6, "JOYL"},
-	{KEY_JOY1+7, "JOYR"},
-	{KEY_JOY1+8, "JOYS"},
-	{KEY_JOY1+9, "JOYN"},
-	{KEY_JOY1+10,"JOYW"},
-	{KEY_JOY1+11,"JOYE"},
-#define NOMOREJOYBTN_1S
-#elif defined (_PSP)
-	{KEY_JOY1+0, "TRIANGLE"},
-	{KEY_JOY1+1, "CIRCLE"  },
-	{KEY_JOY1+2, "CROSS"   },
-	{KEY_JOY1+3, "SQUARE"  },
-	{KEY_JOY1+4, "LTRIGGER"},
-	{KEY_JOY1+5, "RTRIGGER"},
-	{KEY_JOY1+6, "SELECT"  },
-	{KEY_JOY1+7, "START"   },
-	{KEY_JOY1+8, "HOME"    },
-	{KEY_JOY1+9, "HOLD"    },
-#define NOMOREJOYBTN_1S
-#elif defined (GP2X)
-	{KEY_JOY1+0, "JOYA"},
-	{KEY_JOY1+1, "JOYY"},
-	{KEY_JOY1+2, "JOYB"},
-	{KEY_JOY1+3, "JOYX"},
-	{KEY_JOY1+4, "JOYL"},
-	{KEY_JOY1+5, "JOYR"},
-	{KEY_JOY1+6, "JOYVOLUP"},
-	{KEY_JOY1+7, "JOYVOLDOWN"},
-	{KEY_JOY1+8, "JOYSELECT"},
-#elif defined (_NDS)
-	{KEY_JOY1+0, "JOYA"},
-	{KEY_JOY1+1, "JOYB"},
-	{KEY_JOY1+2, "JOYX"},
-	{KEY_JOY1+3, "JOYY"},
-	{KEY_JOY1+4, "JOYL"},
-	{KEY_JOY1+5, "JOYR"},
-	{KEY_JOY1+6, "JOYSTART"},
-	{KEY_JOY1+7, "JOYSELECT"},
-#define NOMOREJOYBTN_1S
-#elif defined (WMINPUT)
-	{KEY_JOY1+0,  "JOYB"},
-	{KEY_JOY1+1,  "JOYA"},
-	{KEY_JOY1+2,  "JOYUP"},
-	{KEY_JOY1+3,  "JOYDOWN"},
-	{KEY_JOY1+4,  "JOYLEFT"},
-	{KEY_JOY1+5,  "JOYRIGHT"},
-	{KEY_JOY1+6,  "JOYAA"},
-	{KEY_JOY1+7,  "JOYBB"},
-	{KEY_JOY1+8,  "JOYCC"},
-	{KEY_JOY1+9,  "JOYXX"},
-	{KEY_JOY1+10, "JOYYY"},
-	{KEY_JOY1+11, "JOYZZ"},
-	{KEY_JOY1+12, "JOYL"},
-	{KEY_JOY1+13, "JOYR"},
-	{KEY_JOY1+14, "JOYZL"},
-	{KEY_JOY1+15, "JOYZR"},
-	{KEY_JOY1+16, "JOYSELECT"},
-	{KEY_JOY1+17, "JOYSTART"},
-	{KEY_JOY1+18, "JOYHOME"},
-	{KEY_JOY1+19, "JOYMINUS"},
-	{KEY_JOY1+20, "JOYPLUS"},
-	{KEY_JOY1+21, "JOY_1"},
-	{KEY_JOY1+22, "JOY_2"},
-	{KEY_JOY1+23, "JOY24"},
-	{KEY_JOY1+24, "JOY25"},
-	{KEY_JOY1+25, "JOY26"},
-	{KEY_JOY1+26, "JOY27"},
-	{KEY_JOY1+27, "JOY28"},
-	{KEY_JOY1+28, "JOY29"},
-	{KEY_JOY1+29, "JOY30"},
-	{KEY_JOY1+30, "JOY31"},
-	{KEY_JOY1+31, "JOY32"},
-#define NOMOREJOYBTN_1S
-#elif defined (_WII)
-	{KEY_JOY1+0,  "JOYA"},
-	{KEY_JOY1+1,  "JOYB"},
-	{KEY_JOY1+2,  "JOY1"},
-	{KEY_JOY1+3,  "JOY2"},
-	{KEY_JOY1+4,  "JOYMINUS"},
-	{KEY_JOY1+5,  "JOYPLUS"},
-	{KEY_JOY1+6,  "JOYHOME"},
-	{KEY_JOY1+7,  "JOYZ"},
-	{KEY_JOY1+8,  "JOYC"},
-	{KEY_JOY1+9,  "JOYA_CC"},
-	{KEY_JOY1+10, "JOYB_CC"},
-	{KEY_JOY1+11, "JOYX"},
-	{KEY_JOY1+12, "JOYY"},
-	{KEY_JOY1+13, "JOYL"},
-	{KEY_JOY1+14, "JOYR"},
-	{KEY_JOY1+15, "JOYZL"},
-	{KEY_JOY1+16, "JOYZR"},
-	{KEY_JOY1+17, "JOYMINUS_CC"},
-	{KEY_JOY1+18, "JOYHPLUS_CC"},
-	{KEY_JOY1+19, "JOYMHOME_CC"},
-#define NOMOREJOYBTN_1S
-#else
 	{KEY_JOY1+0, "JOY1"},
 	{KEY_JOY1+1, "JOY2"},
 	{KEY_JOY1+2, "JOY3"},
@@ -413,8 +295,7 @@ static keyname_t keynames[] =
 	{KEY_JOY1+6, "JOY7"},
 	{KEY_JOY1+7, "JOY8"},
 	{KEY_JOY1+8, "JOY9"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1S)
+#if !defined (NOMOREJOYBTN_1S)
 	// we use up to 32 buttons in DirectInput
 	{KEY_JOY1+9, "JOY10"},
 	{KEY_JOY1+10, "JOY11"},
@@ -445,12 +326,10 @@ static keyname_t keynames[] =
 	{KEY_HAT1+1, "HATDOWN"},
 	{KEY_HAT1+2, "HATLEFT"},
 	{KEY_HAT1+3, "HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_HAT1+4, "HATUP2"},
 	{KEY_HAT1+5, "HATDOWN2"},
 	{KEY_HAT1+6, "HATLEFT2"},
 	{KEY_HAT1+7, "HATRIGHT2"},
-#ifndef _arch_dreamcast
 	{KEY_HAT1+8, "HATUP3"},
 	{KEY_HAT1+9, "HATDOWN3"},
 	{KEY_HAT1+10, "HATLEFT3"},
@@ -459,142 +338,24 @@ static keyname_t keynames[] =
 	{KEY_HAT1+13, "HATDOWN4"},
 	{KEY_HAT1+14, "HATLEFT4"},
 	{KEY_HAT1+15, "HATRIGHT4"},
-#endif
-#endif
 
 	{KEY_DBLMOUSE1+0, "DBLMOUSE1"},
 	{KEY_DBLMOUSE1+1, "DBLMOUSE2"},
 	{KEY_DBLMOUSE1+2, "DBLMOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_DBLMOUSE1+3, "DBLMOUSE4"},
 	{KEY_DBLMOUSE1+4, "DBLMOUSE5"},
 	{KEY_DBLMOUSE1+5, "DBLMOUSE6"},
 	{KEY_DBLMOUSE1+6, "DBLMOUSE7"},
 	{KEY_DBLMOUSE1+7, "DBLMOUSE8"},
-#endif
 	{KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
 	{KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"},
 	{KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"},
-#if !defined (_arch_dreamcast) && !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"},
 	{KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"},
 	{KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"},
 	{KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"},
 	{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
-#endif
 
-#ifdef DC
-	{KEY_DBLJOY1+0, "DBLJOYC"},
-	{KEY_DBLJOY1+1, "DBLJOYB"},
-	{KEY_DBLJOY1+2, "DBLJOYA"},
-	{KEY_DBLJOY1+3, "DBLJOYS"},
-	{KEY_DBLJOY1+4, "DBLJOYZ"},
-	{KEY_DBLJOY1+5, "DBLJOYY"},
-	{KEY_DBLJOY1+6, "DBLJOYX"},
-	{KEY_DBLJOY1+7, "DBLJOYD"},
-#elif defined (_XBOX)
-	{KEY_DBLJOY1+0, "DBLJOYA"},
-	{KEY_DBLJOY1+1, "DBLJOYB"},
-	{KEY_DBLJOY1+2, "DBLJOYX"},
-	{KEY_DBLJOY1+3, "DBLJOYY"},
-	{KEY_DBLJOY1+4, "DBLJOYG"},
-	{KEY_DBLJOY1+5, "DBLJOYW"},
-	{KEY_DBLJOY1+6, "DBLJOYL"},
-	{KEY_DBLJOY1+7, "DBLJOYR"},
-	{KEY_DBLJOY1+8, "DBLJOYS"},
-	{KEY_DBLJOY1+9, "DBLJOYN"},
-	{KEY_DBLJOY1+10,"DBLJOYW"},
-	{KEY_DBLJOY1+11,"DBLJOYE"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_PSP)
-	{KEY_DBLJOY1+0, "DBLTRIANGLE"},
-	{KEY_DBLJOY1+1, "DBLCIRCLE"  },
-	{KEY_DBLJOY1+2, "DBLCROSS"   },
-	{KEY_DBLJOY1+3, "DBLSQUARE"  },
-	{KEY_DBLJOY1+4, "DBLLTRIGGER"},
-	{KEY_DBLJOY1+5, "DBLRTRIGGER"},
-	{KEY_DBLJOY1+6, "DBLSELECT"  },
-	{KEY_DBLJOY1+7, "DBLSTART"   },
-	{KEY_DBLJOY1+8, "DBLHOME"    },
-	{KEY_DBLJOY1+9, "DBLHOLD"    },
-#elif defined (GP2X)
-	{KEY_DBLJOY1+0, "DBLJOYA"},
-	{KEY_DBLJOY1+1, "DBLJOYY"},
-	{KEY_DBLJOY1+2, "DBLJOYB"},
-	{KEY_DBLJOY1+3, "DBLJOYX"},
-	{KEY_DBLJOY1+4, "DBLJOYL"},
-	{KEY_DBLJOY1+5, "DBLJOYR"},
-	{KEY_DBLJOY1+6, "DBLJOYVOLUP"},
-	{KEY_DBLJOY1+7, "DBLJOYVOLDOWN"},
-	{KEY_DBLJOY1+8, "DBLJOYSELECT"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_NDS)
-	{KEY_DBLJOY1+0, "DBLJOYA"},
-	{KEY_DBLJOY1+1, "DBLJOYB"},
-	{KEY_DBLJOY1+2, "DBLJOYX"},
-	{KEY_DBLJOY1+3, "DBLJOYY"},
-	{KEY_DBLJOY1+4, "DBLJOYL"},
-	{KEY_DBLJOY1+5, "DBLJOYR"},
-	{KEY_DBLJOY1+6, "DBLJOYSTART"},
-	{KEY_DBLJOY1+7, "DBLJOYSELECT"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (WMINPUT)
-	{KEY_DBLJOY1+0,  "DBLJOYB"},
-	{KEY_DBLJOY1+1,  "DBLJOYA"},
-	{KEY_DBLJOY1+2,  "DBLJOYUP"},
-	{KEY_DBLJOY1+3,  "DBLJOYDOWN"},
-	{KEY_DBLJOY1+4,  "DBLJOYLEFT"},
-	{KEY_DBLJOY1+5,  "DBLJOYRIGHT"},
-	{KEY_DBLJOY1+6,  "DBLJOYAA"},
-	{KEY_DBLJOY1+7,  "DBLJOYBB"},
-	{KEY_DBLJOY1+8,  "DBLJOYCC"},
-	{KEY_DBLJOY1+9,  "DBLJOYXX"},
-	{KEY_DBLJOY1+10, "DBLJOYYY"},
-	{KEY_DBLJOY1+11, "DBLJOYZZ"},
-	{KEY_DBLJOY1+12, "DBLJOYL"},
-	{KEY_DBLJOY1+13, "DBLJOYR"},
-	{KEY_DBLJOY1+14, "DBLJOYZL"},
-	{KEY_DBLJOY1+15, "DBLJOYZR"},
-	{KEY_DBLJOY1+16, "DBLJOYSELECT"},
-	{KEY_DBLJOY1+17, "DBLJOYSTART"},
-	{KEY_DBLJOY1+18, "DBLJOYHOME"},
-	{KEY_DBLJOY1+19, "DBLJOYMINUS"},
-	{KEY_DBLJOY1+20, "DBLJOYPLUS"},
-	{KEY_DBLJOY1+21, "DBLJOY_1"},
-	{KEY_DBLJOY1+22, "DBLJOY_2"},
-	{KEY_DBLJOY1+23, "DBLJOY24"},
-	{KEY_DBLJOY1+24, "DBLJOY25"},
-	{KEY_DBLJOY1+25, "DBLJOY26"},
-	{KEY_DBLJOY1+26, "DBLJOY27"},
-	{KEY_DBLJOY1+27, "DBLJOY28"},
-	{KEY_DBLJOY1+28, "DBLJOY29"},
-	{KEY_DBLJOY1+29, "DBLJOY30"},
-	{KEY_DBLJOY1+30, "DBLJOY31"},
-	{KEY_DBLJOY1+31, "DBLJOY32"},
-#define NOMOREJOYBTN_1DBL
-#elif defined (_WII)
-	{KEY_DBLJOY1+0,  "DBLJOYA"},
-	{KEY_DBLJOY1+1,  "DBLJOYB"},
-	{KEY_DBLJOY1+2,  "DBLJOY1"},
-	{KEY_DBLJOY1+3,  "DBLJOY2"},
-	{KEY_DBLJOY1+4,  "DBLJOYMINUS"},
-	{KEY_DBLJOY1+5,  "DBLJOYPLUS"},
-	{KEY_DBLJOY1+6,  "DBLJOYHOME"},
-	{KEY_DBLJOY1+7,  "DBLJOYZ"},
-	{KEY_DBLJOY1+8,  "DBLJOYC"},
-	{KEY_DBLJOY1+9,  "DBLJOYA_CC"},
-	{KEY_DBLJOY1+10, "DBLJOYB_CC"},
-	{KEY_DBLJOY1+11, "DBLJOYX"},
-	{KEY_DBLJOY1+12, "DBLJOYY"},
-	{KEY_DBLJOY1+13, "DBLJOYL"},
-	{KEY_DBLJOY1+14, "DBLJOYR"},
-	{KEY_DBLJOY1+15, "DBLJOYZL"},
-	{KEY_DBLJOY1+16, "DBLJOYZR"},
-	{KEY_DBLJOY1+17, "DBLJOYMINUS_CC"},
-	{KEY_DBLJOY1+18, "DBLJOYHPLUS_CC"},
-	{KEY_DBLJOY1+19, "DBLJOYMHOME_CC"},
-#define NOMOREJOYBTN_1DBL
-#else
 	{KEY_DBLJOY1+0, "DBLJOY1"},
 	{KEY_DBLJOY1+1, "DBLJOY2"},
 	{KEY_DBLJOY1+2, "DBLJOY3"},
@@ -603,8 +364,7 @@ static keyname_t keynames[] =
 	{KEY_DBLJOY1+5, "DBLJOY6"},
 	{KEY_DBLJOY1+6, "DBLJOY7"},
 	{KEY_DBLJOY1+7, "DBLJOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_1DBL)
+#if !defined (NOMOREJOYBTN_1DBL)
 	{KEY_DBLJOY1+8, "DBLJOY9"},
 	{KEY_DBLJOY1+9, "DBLJOY10"},
 	{KEY_DBLJOY1+10, "DBLJOY11"},
@@ -634,12 +394,10 @@ static keyname_t keynames[] =
 	{KEY_DBLHAT1+1, "DBLHATDOWN"},
 	{KEY_DBLHAT1+2, "DBLHATLEFT"},
 	{KEY_DBLHAT1+3, "DBLHATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_DBLHAT1+4, "DBLHATUP2"},
 	{KEY_DBLHAT1+5, "DBLHATDOWN2"},
 	{KEY_DBLHAT1+6, "DBLHATLEFT2"},
 	{KEY_DBLHAT1+7, "DBLHATRIGHT2"},
-#ifndef _arch_dreamcast
 	{KEY_DBLHAT1+8, "DBLHATUP3"},
 	{KEY_DBLHAT1+9, "DBLHATDOWN3"},
 	{KEY_DBLHAT1+10, "DBLHATLEFT3"},
@@ -648,101 +406,7 @@ static keyname_t keynames[] =
 	{KEY_DBLHAT1+13, "DBLHATDOWN4"},
 	{KEY_DBLHAT1+14, "DBLHATLEFT4"},
 	{KEY_DBLHAT1+15, "DBLHATRIGHT4"},
-#endif
-#endif
 
-#ifdef DC
-	{KEY_2JOY1+0, "SEC_JOYC"},
-	{KEY_2JOY1+1, "SEC_JOYB"},
-	{KEY_2JOY1+2, "SEC_JOYA"},
-	{KEY_2JOY1+3, "SEC_JOYS"},
-	{KEY_2JOY1+4, "SEC_JOYZ"},
-	{KEY_2JOY1+5, "SEC_JOYY"},
-	{KEY_2JOY1+6, "SEC_JOYX"},
-	{KEY_2JOY1+7, "SEC_JOYD"},
-#elif defined (_XBOX)
-	{KEY_2JOY1+0, "SEC_JOYA"},
-	{KEY_2JOY1+1, "SEC_JOYB"},
-	{KEY_2JOY1+2, "SEC_JOYX"},
-	{KEY_2JOY1+3, "SEC_JOYY"},
-	{KEY_2JOY1+4, "SEC_JOYG"},
-	{KEY_2JOY1+5, "SEC_JOYW"},
-	{KEY_2JOY1+6, "SEC_JOYL"},
-	{KEY_2JOY1+7, "SEC_JOYR"},
-	{KEY_2JOY1+8, "SEC_JOYS"},
-	{KEY_2JOY1+9, "SEC_JOYN"},
-	{KEY_2JOY1+10,"SEC_JOYW"},
-	{KEY_2JOY1+11,"SEC_JOYE"},
-#define NOMOREJOYBTN_2S
-#elif defined (_PSP)
-	{KEY_2JOY1+0, "SEC_TRIANGLE"},
-	{KEY_2JOY1+1, "SEC_CIRCLE"  },
-	{KEY_2JOY1+2, "SEC_CROSS"   },
-	{KEY_2JOY1+3, "SEC_SQUARE"  },
-	{KEY_2JOY1+4, "SEC_LTRIGGER"},
-	{KEY_2JOY1+5, "SEC_RTRIGGER"},
-	{KEY_2JOY1+6, "SEC_SELECT"  },
-	{KEY_2JOY1+7, "SEC_START"   },
-	{KEY_2JOY1+8, "SEC_HOME"    },
-	{KEY_2JOY1+9, "SEC_HOLD"    },
-#define NOMOREJOYBTN_2S
-#elif defined (WMINPUT)
-	{KEY_2JOY1+0,  "SEC_JOYB"},
-	{KEY_2JOY1+1,  "SEC_JOYA"},
-	{KEY_2JOY1+2,  "SEC_JOYUP"},
-	{KEY_2JOY1+3,  "SEC_JOYDOWN"},
-	{KEY_2JOY1+4,  "SEC_JOYLEFT"},
-	{KEY_2JOY1+5,  "SEC_JOYRIGHT"},
-	{KEY_2JOY1+6,  "SEC_JOYAA"},
-	{KEY_2JOY1+7,  "SEC_JOYBB"},
-	{KEY_2JOY1+8,  "SEC_JOYCC"},
-	{KEY_2JOY1+9,  "SEC_JOYXX"},
-	{KEY_2JOY1+10, "SEC_JOYYY"},
-	{KEY_2JOY1+11, "SEC_JOYZZ"},
-	{KEY_2JOY1+12, "SEC_JOYL"},
-	{KEY_2JOY1+13, "SEC_JOYR"},
-	{KEY_2JOY1+14, "SEC_JOYZL"},
-	{KEY_2JOY1+15, "SEC_JOYZR"},
-	{KEY_2JOY1+16, "SEC_JOYSELECT"},
-	{KEY_2JOY1+17, "SEC_JOYSTART"},
-	{KEY_2JOY1+18, "SEC_JOYHOME"},
-	{KEY_2JOY1+19, "SEC_JOYMINUS"},
-	{KEY_2JOY1+20, "SEC_JOYPLUS"},
-	{KEY_2JOY1+21, "SEC_JOY_1"},
-	{KEY_2JOY1+22, "SEC_JOY_2"},
-	{KEY_2JOY1+23, "SEC_JOY24"},
-	{KEY_2JOY1+24, "SEC_JOY25"},
-	{KEY_2JOY1+25, "SEC_JOY26"},
-	{KEY_2JOY1+26, "SEC_JOY27"},
-	{KEY_2JOY1+27, "SEC_JOY28"},
-	{KEY_2JOY1+28, "SEC_JOY29"},
-	{KEY_2JOY1+29, "SEC_JOY30"},
-	{KEY_2JOY1+30, "SEC_JOY31"},
-	{KEY_2JOY1+31, "SEC_JOY32"},
-#define NOMOREJOYBTN_2S
-#elif defined (_WII)
-	{KEY_2JOY1+0,  "SEC_JOYA"},
-	{KEY_2JOY1+1,  "SEC_JOYB"},
-	{KEY_2JOY1+2,  "SEC_JOY1"},
-	{KEY_2JOY1+3,  "SEC_JOY2"},
-	{KEY_2JOY1+4,  "SEC_JOYMINUS"},
-	{KEY_2JOY1+5,  "SEC_JOYPLUS"},
-	{KEY_2JOY1+6,  "SEC_JOYHOME"},
-	{KEY_2JOY1+7,  "SEC_JOYZ"},
-	{KEY_2JOY1+8,  "SEC_JOYC"},
-	{KEY_2JOY1+9,  "SEC_JOYA_CC"},
-	{KEY_2JOY1+10, "SEC_JOYB_CC"},
-	{KEY_2JOY1+11, "SEC_JOYX"},
-	{KEY_2JOY1+12, "SEC_JOYY"},
-	{KEY_2JOY1+13, "SEC_JOYL"},
-	{KEY_2JOY1+14, "SEC_JOYR"},
-	{KEY_2JOY1+15, "SEC_JOYZL"},
-	{KEY_2JOY1+16, "SEC_JOYZR"},
-	{KEY_2JOY1+17, "SEC_JOYMINUS_CC"},
-	{KEY_2JOY1+18, "SEC_JOYHPLUS_CC"},
-	{KEY_2JOY1+19, "SEC_JOYMHOME_CC"},
-#define NOMOREJOYBTN_2S
-#else
 	{KEY_2JOY1+0, "SEC_JOY1"},
 	{KEY_2JOY1+1, "SEC_JOY2"},
 	{KEY_2JOY1+2, "SEC_JOY3"},
@@ -751,8 +415,7 @@ static keyname_t keynames[] =
 	{KEY_2JOY1+5, "SEC_JOY6"},
 	{KEY_2JOY1+6, "SEC_JOY7"},
 	{KEY_2JOY1+7, "SEC_JOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2S)
+#if !defined (NOMOREJOYBTN_2S)
 	// we use up to 32 buttons in DirectInput
 	{KEY_2JOY1+8, "SEC_JOY9"},
 	{KEY_2JOY1+9, "SEC_JOY10"},
@@ -784,12 +447,10 @@ static keyname_t keynames[] =
 	{KEY_2HAT1+1,  "SEC_HATDOWN"},
 	{KEY_2HAT1+2,  "SEC_HATLEFT"},
 	{KEY_2HAT1+3,  "SEC_HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_2HAT1+4, "SEC_HATUP2"},
 	{KEY_2HAT1+5, "SEC_HATDOWN2"},
 	{KEY_2HAT1+6, "SEC_HATLEFT2"},
 	{KEY_2HAT1+7, "SEC_HATRIGHT2"},
-#ifndef _arch_dreamcast
 	{KEY_2HAT1+8, "SEC_HATUP3"},
 	{KEY_2HAT1+9, "SEC_HATDOWN3"},
 	{KEY_2HAT1+10, "SEC_HATLEFT3"},
@@ -798,101 +459,7 @@ static keyname_t keynames[] =
 	{KEY_2HAT1+13, "SEC_HATDOWN4"},
 	{KEY_2HAT1+14, "SEC_HATLEFT4"},
 	{KEY_2HAT1+15, "SEC_HATRIGHT4"},
-#endif
-#endif
 
-#ifdef DC
-	{KEY_DBL2JOY1+0, "DBLSEC_JOYC"},
-	{KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
-	{KEY_DBL2JOY1+2, "DBLSEC_JOYA"},
-	{KEY_DBL2JOY1+3, "DBLSEC_JOYS"},
-	{KEY_DBL2JOY1+4, "DBLSEC_JOYZ"},
-	{KEY_DBL2JOY1+5, "DBLSEC_JOYY"},
-	{KEY_DBL2JOY1+6, "DBLSEC_JOYX"},
-	{KEY_DBL2JOY1+7, "DBLSEC_JOYD"},
-#elif defined (_XBOX)
-	{KEY_DBL2JOY1+0, "DBLSEC_JOYA"},
-	{KEY_DBL2JOY1+1, "DBLSEC_JOYB"},
-	{KEY_DBL2JOY1+2, "DBLSEC_JOYX"},
-	{KEY_DBL2JOY1+3, "DBLSEC_JOYY"},
-	{KEY_DBL2JOY1+4, "DBLSEC_JOYG"},
-	{KEY_DBL2JOY1+5, "DBLSEC_JOYW"},
-	{KEY_DBL2JOY1+6, "DBLSEC_JOYL"},
-	{KEY_DBL2JOY1+7, "DBLSEC_JOYR"},
-	{KEY_DBL2JOY1+8, "DBLSEC_JOYS"},
-	{KEY_DBL2JOY1+9, "DBLSEC_JOYN"},
-	{KEY_DBL2JOY1+10,"DBLSEC_JOYW"},
-	{KEY_DBL2JOY1+11,"DBLSEC_JOYE"},
-#define NOMOREJOYBTN_2DBL
-#elif defined (_PSP)
-	{KEY_DBL2JOY1+0, "DBLSEC_TRIANGLE"},
-	{KEY_DBL2JOY1+1, "DBLSEC_CIRCLE"  },
-	{KEY_DBL2JOY1+2, "DBLSEC_CROSS"   },
-	{KEY_DBL2JOY1+3, "DBLSEC_SQUARE"  },
-	{KEY_DBL2JOY1+4, "DBLSEC_LTRIGGER"},
-	{KEY_DBL2JOY1+5, "DBLSEC_RTRIGGER"},
-	{KEY_DBL2JOY1+6, "DBLSEC_SELECT"  },
-	{KEY_DBL2JOY1+7, "DBLSEC_START"   },
-	{KEY_DBL2JOY1+8, "DBLSEC_HOME"    },
-	{KEY_DBL2JOY1+9, "DBLSEC_HOLD"    },
-#define NOMOREJOYBTN_2DBL
-#elif defined (WMINPUT)
-	{KEY_DBL2JOY1+0,  "DBLSEC_JOYB"},
-	{KEY_DBL2JOY1+1,  "DBLSEC_JOYA"},
-	{KEY_DBL2JOY1+2,  "DBLSEC_JOYUP"},
-	{KEY_DBL2JOY1+3,  "DBLSEC_JOYDOWN"},
-	{KEY_DBL2JOY1+4,  "DBLSEC_JOYLEFT"},
-	{KEY_DBL2JOY1+5,  "DBLSEC_JOYRIGHT"},
-	{KEY_DBL2JOY1+6,  "DBLSEC_JOYAA"},
-	{KEY_DBL2JOY1+7,  "DBLSEC_JOYBB"},
-	{KEY_DBL2JOY1+8,  "DBLSEC_JOYCC"},
-	{KEY_DBL2JOY1+9,  "DBLSEC_JOYXX"},
-	{KEY_DBL2JOY1+10, "DBLSEC_JOYYY"},
-	{KEY_DBL2JOY1+11, "DBLSEC_JOYZZ"},
-	{KEY_DBL2JOY1+12, "DBLSEC_JOYL"},
-	{KEY_DBL2JOY1+13, "DBLSEC_JOYR"},
-	{KEY_DBL2JOY1+14, "DBLSEC_JOYZL"},
-	{KEY_DBL2JOY1+15, "DBLSEC_JOYZR"},
-	{KEY_DBL2JOY1+16, "DBLSEC_JOYSELECT"},
-	{KEY_DBL2JOY1+17, "DBLSEC_JOYSTART"},
-	{KEY_DBL2JOY1+18, "DBLSEC_JOYHOME"},
-	{KEY_DBL2JOY1+19, "DBLSEC_JOYMINUS"},
-	{KEY_DBL2JOY1+20, "DBLSEC_JOYPLUS"},
-	{KEY_DBL2JOY1+21, "DBLSEC_JOY_1"},
-	{KEY_DBL2JOY1+22, "DBLSEC_JOY_2"},
-	{KEY_DBL2JOY1+23, "DBLSEC_JOY24"},
-	{KEY_DBL2JOY1+24, "DBLSEC_JOY25"},
-	{KEY_DBL2JOY1+25, "DBLSEC_JOY26"},
-	{KEY_DBL2JOY1+26, "DBLSEC_JOY27"},
-	{KEY_DBL2JOY1+27, "DBLSEC_JOY28"},
-	{KEY_DBL2JOY1+28, "DBLSEC_JOY29"},
-	{KEY_DBL2JOY1+29, "DBLSEC_JOY30"},
-	{KEY_DBL2JOY1+30, "DBLSEC_JOY31"},
-	{KEY_DBL2JOY1+31, "DBLSEC_JOY32"},
-#define NOMOREJOYBTN_2SDBL
-#elif defined (_WII)
-	{KEY_DBL2JOY1+0,  "DBLSEC_JOYA"},
-	{KEY_DBL2JOY1+1,  "DBLSEC_JOYB"},
-	{KEY_DBL2JOY1+2,  "DBLSEC_JOY1"},
-	{KEY_DBL2JOY1+3,  "DBLSEC_JOY2"},
-	{KEY_DBL2JOY1+4,  "DBLSEC_JOYMINUS"},
-	{KEY_DBL2JOY1+5,  "DBLSEC_JOYPLUS"},
-	{KEY_DBL2JOY1+6,  "DBLSEC_JOYHOME"},
-	{KEY_DBL2JOY1+7,  "DBLSEC_JOYZ"},
-	{KEY_DBL2JOY1+8,  "DBLSEC_JOYC"},
-	{KEY_DBL2JOY1+9,  "DBLSEC_JOYA_CC"},
-	{KEY_DBL2JOY1+10, "DBLSEC_JOYB_CC"},
-	{KEY_DBL2JOY1+11, "DBLSEC_JOYX"},
-	{KEY_DBL2JOY1+12, "DBLSEC_JOYY"},
-	{KEY_DBL2JOY1+13, "DBLSEC_JOYL"},
-	{KEY_DBL2JOY1+14, "DBLSEC_JOYR"},
-	{KEY_DBL2JOY1+15, "DBLSEC_JOYZL"},
-	{KEY_DBL2JOY1+16, "DBLSEC_JOYZR"},
-	{KEY_DBL2JOY1+17, "DBLSEC_JOYMINUS_CC"},
-	{KEY_DBL2JOY1+18, "DBLSEC_JOYHPLUS_CC"},
-	{KEY_DBL2JOY1+19, "DBLSEC_JOYMHOME_CC"},
-#define NOMOREJOYBTN_2DBL
-#else
 	{KEY_DBL2JOY1+0, "DBLSEC_JOY1"},
 	{KEY_DBL2JOY1+1, "DBLSEC_JOY2"},
 	{KEY_DBL2JOY1+2, "DBLSEC_JOY3"},
@@ -901,8 +468,7 @@ static keyname_t keynames[] =
 	{KEY_DBL2JOY1+5, "DBLSEC_JOY6"},
 	{KEY_DBL2JOY1+6, "DBLSEC_JOY7"},
 	{KEY_DBL2JOY1+7, "DBLSEC_JOY8"},
-#endif
-#if !defined (_arch_dreamcast) && !defined (NOMOREJOYBTN_2DBL)
+#if !defined (NOMOREJOYBTN_2DBL)
 	{KEY_DBL2JOY1+8, "DBLSEC_JOY9"},
 	{KEY_DBL2JOY1+9, "DBLSEC_JOY10"},
 	{KEY_DBL2JOY1+10, "DBLSEC_JOY11"},
@@ -932,12 +498,10 @@ static keyname_t keynames[] =
 	{KEY_DBL2HAT1+1, "DBLSEC_HATDOWN"},
 	{KEY_DBL2HAT1+2, "DBLSEC_HATLEFT"},
 	{KEY_DBL2HAT1+3, "DBLSEC_HATRIGHT"},
-#if !defined (_XBOX) && !defined (_PSP) && !defined (_WII)
 	{KEY_DBL2HAT1+4, "DBLSEC_HATUP2"},
 	{KEY_DBL2HAT1+5, "DBLSEC_HATDOWN2"},
 	{KEY_DBL2HAT1+6, "DBLSEC_HATLEFT2"},
 	{KEY_DBL2HAT1+7, "DBLSEC_HATRIGHT2"},
-#ifndef _arch_dreamcast
 	{KEY_DBL2HAT1+8, "DBLSEC_HATUP3"},
 	{KEY_DBL2HAT1+9, "DBLSEC_HATDOWN3"},
 	{KEY_DBL2HAT1+10, "DBLSEC_HATLEFT3"},
@@ -946,8 +510,6 @@ static keyname_t keynames[] =
 	{KEY_DBL2HAT1+13, "DBLSEC_HATDOWN4"},
 	{KEY_DBL2HAT1+14, "DBLSEC_HATLEFT4"},
 	{KEY_DBL2HAT1+15, "DBLSEC_HATRIGHT4"},
-#endif
-#endif
 
 };
 
@@ -1049,105 +611,6 @@ INT32 G_KeyStringtoNum(const char *keystr)
 	return 0;
 }
 
-#ifdef DC
-void G_Controldefault(void)
-{
-	gamecontrol[gc_forward    ][0] = KEY_HAT1+0; //Up
-	gamecontrol[gc_forward    ][1] = KEY_UPARROW;
-	gamecontrol[gc_backward   ][0] = KEY_HAT1+1; //Down
-	gamecontrol[gc_backward   ][1] = KEY_DOWNARROW;
-	//gamecontrol[gc_straferight][0] = '[';
-	//gamecontrol[gc_strafeleft ][0] = ']';
-	gamecontrol[gc_turnleft   ][0] = KEY_HAT1+2; //Left
-	gamecontrol[gc_turnleft   ][1] = KEY_LEFTARROW;
-	gamecontrol[gc_turnright  ][0] = KEY_HAT1+3; //Right
-	gamecontrol[gc_turnright  ][1] = KEY_RIGHTARROW;
-	gamecontrol[gc_weaponnext ][0] = ']';
-	gamecontrol[gc_weaponprev ][0] = '[';
-	gamecontrol[gc_fire       ][0] = KEY_JOY1+6; //X
-	gamecontrol[gc_fire       ][1] = KEY_RCTRL;
-	gamecontrol[gc_firenormal ][0] = KEY_JOY1+5; //Y
-	gamecontrol[gc_firenormal ][1] = ';';
-	gamecontrol[gc_tossflag   ][0] = '\'';
-	gamecontrol[gc_use        ][0] = KEY_JOY1+1; //B
-	gamecontrol[gc_use        ][1] = '.';
-	gamecontrol[gc_camtoggle  ][1] = ',';
-	gamecontrol[gc_camreset   ][0] = 'c';
-	gamecontrol[gc_lookup     ][0] = KEY_PGUP;
-	gamecontrol[gc_lookdown   ][0] = KEY_PGDN;
-	gamecontrol[gc_centerview ][0] = KEY_END;
-	gamecontrol[gc_mouseaiming][0] = 's';
-	gamecontrol[gc_talkkey    ][0] = 't';
-	gamecontrol[gc_teamkey    ][0] = 'y';
-	gamecontrol[gc_scores     ][0] = KEY_TAB;
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+2; //A
-	gamecontrol[gc_jump       ][1] = '/';
-	gamecontrol[gc_console    ][0] = KEY_CONSOLE;
-	gamecontrol[gc_console    ][1] = KEY_F5;
-	//gamecontrolbis
-	gamecontrolbis[gc_forward   ][0] = KEY_2HAT1+0;
-	gamecontrolbis[gc_forward   ][1] = 'w';
-	gamecontrolbis[gc_backward  ][0] = KEY_2HAT1+1;
-	gamecontrolbis[gc_backward  ][1] = 's';
-	gamecontrolbis[gc_turnleft  ][0] = KEY_2HAT1+2;
-	gamecontrolbis[gc_turnleft  ][1] = 'a';
-	gamecontrolbis[gc_turnright ][0] = KEY_2HAT1+3;
-	gamecontrolbis[gc_turnright ][1] = 'd';
-	gamecontrolbis[gc_weaponnext][0] = 't';
-	gamecontrolbis[gc_weaponprev][0] = 'r';
-	gamecontrolbis[gc_fire      ][0] = KEY_2JOY1+6; //X
-	gamecontrolbis[gc_firenormal][0] = KEY_2JOY1+5; //Y
-	gamecontrolbis[gc_use       ][0] = KEY_2JOY1+1; //B
-	gamecontrolbis[gc_jump      ][0] = KEY_2JOY1+2; //A
-	//gamecontrolbis[gc_straferight][0] = 'x';
-	//gamecontrolbis[gc_strafeleft ][0] = 'z';
-}
-#elif defined (_PSP)
-void G_Controldefault(void)
-{
-	gamecontrol[gc_forward    ][0] = KEY_HAT1+0; // Up
-	gamecontrol[gc_backward   ][0] = KEY_HAT1+1; // Down
-	gamecontrol[gc_turnleft   ][0] = KEY_HAT1+2; // Left
-	gamecontrol[gc_turnright  ][0] = KEY_HAT1+3; // Right
-	gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; // L
-	gamecontrol[gc_straferight][0] = KEY_JOY1+5; // R
-	gamecontrol[gc_tossflag   ][0] = KEY_JOY1+0; // Triangle
-	gamecontrol[gc_use        ][0] = KEY_JOY1+1; // Circle
-	gamecontrol[gc_camtoggle  ][0] = KEY_JOY1+6; // Select
-	gamecontrol[gc_camreset   ][0] = KEY_JOY1+3; // Square
-	gamecontrol[gc_centerview ][0] = KEY_JOY1+9; // Hold
-	gamecontrol[gc_pause      ][0] = KEY_JOY1+8; // Start
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+2; // Cross
-}
-#elif defined (GP2X)
-void G_Controldefault(void)
-{
-	gamecontrol[gc_fire       ][0] = KEY_JOY1+0; //A
-	gamecontrol[gc_forward    ][0] = KEY_JOY1+1; //Y
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+2; //B
-	gamecontrol[gc_use        ][0] = KEY_JOY1+3; //X
-	gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L
-	gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R
-	gamecontrol[gc_lookup     ][0] = KEY_JOY1+6; //U
-	gamecontrol[gc_lookdown   ][0] = KEY_JOY1+7; //D
-	gamecontrol[gc_pause      ][0] = KEY_JOY1+8; //S
-}
-#elif defined (_NDS)
-void G_Controldefault(void)
-{
-	gamecontrol[gc_fire       ][0] = KEY_JOY1+2; //X
-	gamecontrol[gc_forward    ][0] = KEY_UPARROW;
-	gamecontrol[gc_backward   ][0] = KEY_DOWNARROW;
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+0; //A
-	gamecontrol[gc_use        ][0] = KEY_JOY1+3; //Y
-	gamecontrol[gc_strafeleft ][0] = KEY_JOY1+4; //L
-	gamecontrol[gc_straferight][0] = KEY_JOY1+5; //R
-	gamecontrol[gc_turnleft   ][0] = KEY_LEFTARROW;
-	gamecontrol[gc_turnright  ][0] = KEY_RIGHTARROW;
-	gamecontrol[gc_pause      ][0] = KEY_JOY1+6; //Start
-	gamecontrol[gc_weaponnext ][0] = KEY_JOY1+7; //Select
-}
-#else
 void G_Controldefault(void)
 {
 	gamecontrol[gc_forward    ][0] = 'w';
@@ -1184,80 +647,7 @@ void G_Controldefault(void)
 	gamecontrol[gc_jump       ][0] = KEY_SPACE;
 	gamecontrol[gc_console    ][0] = KEY_CONSOLE;
 	gamecontrol[gc_pause      ][0] = KEY_PAUSE;
-#ifdef WMINPUT
-	gamecontrol[gc_forward    ][0] = KEY_JOY1+02; //UP
-	gamecontrol[gc_backward   ][0] = KEY_JOY1+03; //DOWN
-	gamecontrol[gc_turnleft   ][0] = KEY_JOY1+04; //LEFT
-	gamecontrol[gc_turnright  ][0] = KEY_JOY1+05; //RIGHT
-	gamecontrol[gc_weaponnext ][0] = KEY_JOY1+10; //y
-	gamecontrol[gc_weaponprev ][0] = KEY_JOY1+9;  //x
-	gamecontrol[gc_fire       ][0] = KEY_JOY1+12; //L
-	gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //R
-	gamecontrol[gc_use        ][0] = KEY_JOY1+00; //B
-	gamecontrol[gc_use        ][1] = KEY_JOY1+07; //b
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+01; //A
-	gamecontrol[gc_jump       ][1] = KEY_JOY1+06; //a
-	gamecontrol[gc_pause      ][0] = KEY_JOY1+18; //Home
-	gamecontrolbis[gc_forward    ][0] = KEY_2JOY1+02; //UP
-	gamecontrolbis[gc_backward   ][0] = KEY_2JOY1+03; //DOWN
-	gamecontrolbis[gc_turnleft   ][0] = KEY_2JOY1+04; //LEFT
-	gamecontrolbis[gc_turnright  ][0] = KEY_2JOY1+05; //RIGHT
-	gamecontrolbis[gc_weaponnext ][0] = KEY_2JOY1+10; //y
-	gamecontrolbis[gc_weaponprev ][0] = KEY_2JOY1+9;  //x
-	gamecontrolbis[gc_fire       ][0] = KEY_2JOY1+12; //L
-	gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //R
-	gamecontrolbis[gc_use        ][0] = KEY_2JOY1+00; //B
-	gamecontrolbis[gc_use        ][1] = KEY_2JOY1+07; //b
-	gamecontrolbis[gc_jump       ][0] = KEY_2JOY1+01; //A
-	gamecontrolbis[gc_jump       ][1] = KEY_2JOY1+06; //a
-	gamecontrolbis[gc_pause      ][0] = KEY_2JOY1+18; //Home
-#endif
-#ifdef _WII
-	gamecontrol[gc_forward    ][1] = KEY_HAT1+00; //UP
-	gamecontrol[gc_backward   ][1] = KEY_HAT1+01; //DOWN
-	gamecontrol[gc_straferight][1] = KEY_JOY1+16; //ZR
-	gamecontrol[gc_strafeleft ][1] = KEY_JOY1+15; //ZL
-	gamecontrol[gc_turnleft   ][1] = KEY_HAT1+02; //LEFT
-	gamecontrol[gc_turnright  ][1] = KEY_HAT1+03; //RIGHT
-	gamecontrol[gc_weaponnext ][1] = KEY_JOY1+11; //x
-	gamecontrol[gc_fire       ][0] = KEY_JOY1+12; //y
-	gamecontrol[gc_fire       ][1] = KEY_JOY1+01; //B
-	gamecontrol[gc_firenormal ][0] = KEY_JOY1+13; //L
-	gamecontrol[gc_firenormal ][1] = KEY_JOY1+00; //A
-	gamecontrol[gc_tossflag   ][1] = KEY_JOY1+17; //Plus CC
-	gamecontrol[gc_use        ][0] = KEY_JOY1+9;  //a
-	gamecontrol[gc_use        ][1] = KEY_JOY1+02; //1
-	gamecontrol[gc_centerview ][1] = KEY_JOY1+14; //R
-	gamecontrol[gc_scores     ][0] = KEY_JOY1+04; //Minus
-	gamecontrol[gc_scores     ][1] = KEY_JOY1+18; //Minus
-	gamecontrol[gc_jump       ][0] = KEY_JOY1+10; //b
-	gamecontrol[gc_jump       ][1] = KEY_JOY1+3;  //2
-	gamecontrol[gc_pause      ][0] = KEY_JOY1+06; //Home
-	gamecontrol[gc_pause      ][1] = KEY_JOY1+19; //Home
-	gamecontrolbis[gc_forward    ][1] = KEY_2HAT1+00; //UP
-	gamecontrolbis[gc_backward   ][1] = KEY_2HAT1+01; //DOWN
-	gamecontrolbis[gc_straferight][1] = KEY_2JOY1+16; //ZR
-	gamecontrolbis[gc_strafeleft ][1] = KEY_2JOY1+15; //ZL
-	gamecontrolbis[gc_turnleft   ][1] = KEY_2HAT1+02; //LEFT
-	gamecontrolbis[gc_turnright  ][1] = KEY_2HAT1+03; //RIGHT
-	gamecontrolbis[gc_weaponnext ][1] = KEY_2JOY1+11; //x
-	gamecontrolbis[gc_fire       ][0] = KEY_2JOY1+12; //y
-	gamecontrolbis[gc_fire       ][1] = KEY_2JOY1+01; //B
-	gamecontrolbis[gc_firenormal ][0] = KEY_2JOY1+13; //L
-	gamecontrolbis[gc_firenormal ][1] = KEY_2JOY1+00; //A
-	gamecontrolbis[gc_tossflag   ][1] = KEY_2JOY1+17; //Plus CC
-	gamecontrolbis[gc_use        ][0] = KEY_2JOY1+9;  //a
-	gamecontrolbis[gc_use        ][1] = KEY_2JOY1+02; //1
-	gamecontrolbis[gc_centerview ][1] = KEY_2JOY1+14; //R
-	gamecontrolbis[gc_scores     ][0] = KEY_2JOY1+04; //Minus
-	gamecontrolbis[gc_scores     ][1] = KEY_2JOY1+18; //Minus
-	gamecontrolbis[gc_jump       ][0] = KEY_2JOY1+10; //b
-	gamecontrolbis[gc_jump       ][1] = KEY_2JOY1+3;  //2
-	gamecontrolbis[gc_pause      ][0] = KEY_2JOY1+06; //Home
-	gamecontrolbis[gc_pause      ][1] = KEY_2JOY1+19; //Home
-#endif
 }
-#endif
 
 void G_SaveKeySetting(FILE *f)
 {
diff --git a/src/g_input.h b/src/g_input.h
index 8083974389d2eeda1587f566d85fe18015ae6fbc..2a447c683d35bcf083c81222185e45be8cc2c28f 100644
--- a/src/g_input.h
+++ b/src/g_input.h
@@ -22,33 +22,10 @@
 // keys (mousebuttons and joybuttons becomes keys)
 #define NUMKEYS 256
 
-
-#ifdef _arch_dreamcast
-#define MOUSEBUTTONS 5
-#define JOYBUTTONS   8 //  8 buttons
-#define JOYHATS      2  // 2 hats
-#define JOYAXISSET   3  // 3 Sets of 2 axises
-#elif defined (_XBOX)
-#define MOUSEBUTTONS 5
-#define JOYBUTTONS   12 // 12 buttons
-#define JOYHATS      1  // 1 hat
-#define JOYAXISSET   2  // 2 Sets of 2 axises
-#elif defined (_PSP)
-#define MOUSEBUTTONS 3
-#define JOYBUTTONS   14 // 10 buttons
-#define JOYHATS      1  // 1 hat
-#define JOYAXISSET   1  // 1 Set of 2 axises
-#elif defined (_WII)
-#define MOUSEBUTTONS 3
-#define JOYBUTTONS   20 // 20 buttons
-#define JOYHATS      1  // 1 hat
-#define JOYAXISSET   5  // 5 Sets of 2 axises
-#else
 #define MOUSEBUTTONS 8
 #define JOYBUTTONS   32 // 32 buttons
 #define JOYHATS      4  // 4 hats
 #define JOYAXISSET   4  // 4 Sets of 2 axises
-#endif
 
 //
 // mouse and joystick buttons are handled as 'virtual' keys
diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c
index 8b01cabd5ed37696652b931548eed18de3aea344..fd6ba13f331b47ee14d547c71c4b5b54cbb2b561 100644
--- a/src/hardware/hw_clip.c
+++ b/src/hardware/hw_clip.c
@@ -338,7 +338,7 @@ angle_t gld_FrustumAngle(void)
 	}
 
 	// If the pitch is larger than this you can look all around at a FOV of 90
-	if (abs(aimingangle) > 46 * ANG1)
+	if (aimingangle > (ANGLE_45+ANG1) && (ANGLE_315-ANG1) > aimingangle)
 		return 0xffffffff;
 
 	// ok, this is a gross hack that barely works...
diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h
index a6525a2f5ce029e430e3ff9adba2211594191dc1..f6bbf9455a2415184f2d7d69abe5b56f079d4c5e 100644
--- a/src/hardware/hw_data.h
+++ b/src/hardware/hw_data.h
@@ -20,7 +20,7 @@
 #ifndef _HWR_DATA_
 #define _HWR_DATA_
 
-#if defined (_WIN32) && !defined (__CYGWIN__) && !defined (_XBOX)
+#if defined (_WIN32) && !defined (__CYGWIN__)
 //#define WIN32_LEAN_AND_MEAN
 #define RPC_NO_WINDOWS_H
 #include <windows.h>
@@ -64,7 +64,7 @@ typedef struct GLMipmap_s GLMipmap_t;
 //
 struct GLTexture_s
 {
-	GLMipmap_t mipmap;
+	GLMipmap_t  mipmap;
 	float       scaleX;             //used for scaling textures on walls
 	float       scaleY;
 };
@@ -88,7 +88,7 @@ struct GLPatch_s
 	UINT16              wadnum;      // the software patch lump num for when the hardware patch
 	UINT16              lumpnum;     // was flushed, and we need to re-create it
 	GLMipmap_t          mipmap;
-} ATTRPACK;
+};
 typedef struct GLPatch_s GLPatch_t;
 
 #endif //_HWR_DATA_
diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h
index 52110121b9bb47c34a7ed7e903ee94ead00d9a97..47c7c02a0b76a6e7f229f20a2036e243338eaffc 100644
--- a/src/hardware/hw_defs.h
+++ b/src/hardware/hw_defs.h
@@ -41,14 +41,8 @@ typedef unsigned char   FBOOLEAN;
 // ==========================================================================
 
 // byte value for paletted graphics, which represent the transparent color
-#ifdef _NDS
-// NDS is hardwired to use zero as transparent color
-#define HWR_PATCHES_CHROMAKEY_COLORINDEX   0
-#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1
-#else
 #define HWR_PATCHES_CHROMAKEY_COLORINDEX   255
 #define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130
-#endif
 
 // the chroma key color shows on border sprites, set it to black
 #define HWR_PATCHES_CHROMAKEY_COLORVALUE     (0x00000000)    //RGBA format as in grSstWinOpen()
diff --git a/src/hardware/hw_dll.h b/src/hardware/hw_dll.h
index 6b9f4d538860d29a61967ccd7e2c538d65fecdaa..452e9037c2dab8f14bf1798113a22b87f3f95049 100644
--- a/src/hardware/hw_dll.h
+++ b/src/hardware/hw_dll.h
@@ -40,14 +40,14 @@
    #define EXPORT
   #endif
  #endif
- #if defined (_WIN32) && !defined (_XBOX)
+ #ifdef _WIN32
   #define HWRAPI(fn)  WINAPI fn
  #else
   #define HWRAPI(fn)  fn
  #endif
 #else // _CREATE_DLL_
  #define EXPORT      typedef
- #if defined (_WIN32) && !defined (_XBOX)
+ #ifdef _WIN32
   #define HWRAPI(fn)  (WINAPI *fn)
  #else
   #define HWRAPI(fn)  (*fn)
diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index cc3f404028a4c440acfc7fb02765fd14441e0c9e..864cd04b66eec0bc710dcd54ac392e4e2623bb23 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -5726,12 +5726,8 @@ if (0)
 		HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
 }
 
-#ifndef _NDS
 	if (drawsky)
 		HWR_DrawSkyBackground(player);
-#else
-	(void)HWR_DrawSkyBackground;
-#endif
 
 	//Hurdler: it doesn't work in splitscreen mode
 	drawsky = splitscreen;
@@ -5970,12 +5966,8 @@ if (0)
 		HWD.pfnSetSpecialState(HWD_SET_FOG_MODE, 0); // Turn it off
 }
 
-#ifndef _NDS
 	if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
 		HWR_DrawSkyBackground(player);
-#else
-	(void)HWR_DrawSkyBackground;
-#endif
 
 	//Hurdler: it doesn't work in splitscreen mode
 	drawsky = splitscreen;
@@ -6225,12 +6217,7 @@ void HWR_Startup(void)
 	}
 
 	if (rendermode == render_opengl)
-		textureformat = patchformat =
-#ifdef _NDS
-			GR_TEXFMT_P_8;
-#else
-			GR_RGBA;
-#endif
+		textureformat = patchformat = GR_RGBA;
 
 	startupdone = true;
 }
diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c
index b34ddfc01d5e55501d55271fc5a07f5d9e3902a2..70a257c928e5ee4a6af093daf680e6a578449328 100644
--- a/src/hardware/hw_md2.c
+++ b/src/hardware/hw_md2.c
@@ -428,7 +428,7 @@ static md2_model_t *md2_readModel(const char *filename)
 							spr2 |= FF_SPR2SUPER;
 						if (model->spr2frames[spr2*2 + 1]++ == 0) // numspr2frames
 							model->spr2frames[spr2*2] = i; // starting frame
-						CONS_Debug(DBG_RENDER, "frame %s, sprite2 %s - starting frame %d, number of frames %d\n", frame->name, spr2names[spr2 & ~FF_SPR2SUPER], model->spr2frames[spr2*2], model->spr2frames[spr2*2 + 1]);
+						CONS_Debug(DBG_RENDER, "frame %s, sprite2 %s - starting frame %s, number of frames %s\n", frame->name, spr2names[spr2 & ~FF_SPR2SUPER], sizeu1(model->spr2frames[spr2*2]), sizeu2(model->spr2frames[spr2*2 + 1]));
 					}
 				}
 			}
diff --git a/src/hardware/hws_data.h b/src/hardware/hws_data.h
index 9e2d0547eb6b980ee6c69d23e08aebd1fcf4d69e..b890d976b0ec0831dbad6bab765f3befe9ba5dd9 100644
--- a/src/hardware/hws_data.h
+++ b/src/hardware/hws_data.h
@@ -114,7 +114,7 @@ typedef struct snddev_s
 	size_t  numsfxs;
 
 // Windows specific data
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
 	UINT32   cooplevel;
 	HWND    hWnd;
 #endif
diff --git a/src/hardware/r_minigl/r_minigl.c b/src/hardware/r_minigl/r_minigl.c
deleted file mode 100644
index b2482a5521e702b1f0d87812e0e577aaf081cc4b..0000000000000000000000000000000000000000
--- a/src/hardware/r_minigl/r_minigl.c
+++ /dev/null
@@ -1,33 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief MiniGL API for Doom Legacy
-
-
-// tell r_opengl.cpp to compile for MiniGL Drivers
-#define MINI_GL_COMPATIBILITY
-
-// tell r_opengl.cpp to compile for ATI Rage Pro OpenGL driver
-//#define ATI_RAGE_PRO_COMPATIBILITY
-
-#define DRIVER_STRING "HWRAPI Init(): SRB2 MiniGL renderer"
-
-// Include this at end
-#include "../r_opengl/r_opengl.c"
-#include "../r_opengl/ogl_win.c"
-
-// That's all ;-)
-// Just, be sure to do the right changes in r_opengl.cpp
diff --git a/src/hardware/r_minigl/r_minigl.dev b/src/hardware/r_minigl/r_minigl.dev
deleted file mode 100644
index edf725ac55d9d03823b4325a6f15b1f3b52ec873..0000000000000000000000000000000000000000
--- a/src/hardware/r_minigl/r_minigl.dev
+++ /dev/null
@@ -1,89 +0,0 @@
-[Project]
-FileName=r_minigl.dev
-Name=r_minigl
-Ver=1
-IsCpp=1
-Type=3
-Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-DUSE_WGL_SWAP_@@_-Os_@@_-fomit-frame-pointer_@@_
-CppCompiler=
-Includes=
-Linker=--def ../r_mingw.def_@@_-lgdi32_@@_
-Libs=
-UnitCount=4
-Folders=
-ObjFiles=
-PrivateResource=
-ResourceIncludes=
-MakeIncludes=
-Icon=
-ExeOutput=C:\srb2demo2
-ObjectOutput=..\..\..\objs\Mingw\r_minigl
-OverrideOutput=1
-OverrideOutputName=r_minigl.dll
-HostApplication=
-CommandLine=
-IncludeVersionInfo=0
-SupportXPThemes=0
-CompilerSet=0
-CompilerSettings=00000000000000000111d0
-UseCustomMakefile=0
-CustomMakefile=
-
-[Unit1]
-FileName=..\r_opengl\ogl_win.c
-Folder=
-Compile=0
-CompileCpp=0
-Link=0
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c ogl_win.c -o ../../../objs/Mingw/r_minigl/ogl_win.o $(CFLAGS)
-
-[Unit2]
-FileName=..\r_opengl\r_opengl.c
-Folder=
-Compile=0
-CompileCpp=0
-Link=0
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c r_opengl.c -o ../../../objs/Mingw/r_minigl/r_opengl.o $(CFLAGS)
-
-[Unit3]
-FileName=..\r_opengl\r_opengl.h
-Folder=
-Compile=1
-CompileCpp=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[VersionInfo]
-Major=0
-Minor=1
-Release=1
-Build=1
-LanguageID=1033
-CharsetID=1252
-CompanyName=
-FileVersion=0.1
-FileDescription=Developed using the Dev-C++ IDE
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=r_opengl.exe
-ProductName=r_opengl
-ProductVersion=0.1
-AutoIncBuildNr=0
-
-[Unit4]
-FileName=r_minigl.c
-CompileCpp=0
-Folder=r_minigl
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=$(CC) -c r_minigl.c -o ../../../objs/Mingw/r_minigl/r_minigl.o $(CFLAGS)
-
diff --git a/src/hardware/r_minigl/r_minigl.dsp b/src/hardware/r_minigl/r_minigl.dsp
deleted file mode 100644
index 686ca35a3dd6eec4ab45596e50f8f5b3752f1ecc..0000000000000000000000000000000000000000
--- a/src/hardware/r_minigl/r_minigl.dsp
+++ /dev/null
@@ -1,103 +0,0 @@
-# Microsoft Developer Studio Project File - Name="r_minigl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=r_minigl - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "r_minigl.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "r_minigl.mak" CFG="r_minigl - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "r_minigl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "r_minigl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "r_minigl - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "..\..\..\objs\Release"
-# PROP BASE Intermediate_Dir "..\..\..\objs\Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\..\bin\VC\Release\r_minigl"
-# PROP Intermediate_Dir "..\..\..\objs\VC\Release\r_minigl"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x80c /d "NDEBUG"
-# ADD RSC /l 0x40c /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 user32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\r_minigl.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\r_minigl.dll"
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF  "$(CFG)" == "r_minigl - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "..\..\..\objs\Debug"
-# PROP BASE Intermediate_Dir "..\..\..\objs\Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\..\bin\VC\Debug\r_minigl"
-# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\r_minigl"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "R_MINIGL_EXPORTS" /FR /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x80c /d "_DEBUG"
-# ADD RSC /l 0x40c /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ouser32.lib gdi32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\r_minigl.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\r_minigl.dll" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF 
-
-# Begin Target
-
-# Name "r_minigl - Win32 Release"
-# Name "r_minigl - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\r_minigl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_opengl\r_opengl.h
-# End Source File
-# End Target
-# End Project
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index e6ff83e89698439c947fb7b73833e551c55387fd..bd1cd95ebd5c7a05cc21e11fc753522b89276aee 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -30,10 +30,8 @@
 #include <stdarg.h>
 #include <math.h>
 #ifndef SHUFFLE
-#ifndef KOS_GL_COMPATIBILITY
 #define SHUFFLE
 #endif
-#endif
 #include "r_opengl.h"
 
 #if defined (HWRENDER) && !defined (NOROPENGL)
@@ -83,9 +81,7 @@ GLint   screen_height   = 0;
 GLbyte  screen_depth    = 0;
 GLint   textureformatGL = 0;
 GLint maximumAnisotropy = 0;
-#ifndef KOS_GL_COMPATIBILITY
 static GLboolean MipMap = GL_FALSE;
-#endif
 static GLint min_filter = GL_LINEAR;
 static GLint mag_filter = GL_LINEAR;
 static GLint anisotropic_filter = 0;
@@ -94,11 +90,9 @@ static FTransform  md2_transform;
 const GLubyte *gl_extensions = NULL;
 
 //Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-)
-#ifndef MINI_GL_COMPATIBILITY
 static GLdouble    modelMatrix[16];
 static GLdouble    projMatrix[16];
 static GLint       viewport[4];
-#endif
 
 
 #ifdef USE_PALETTED_TEXTURE
@@ -158,9 +152,7 @@ float byteasfloat(UINT8 fbyte)
 
 static I_Error_t I_Error_GL = NULL;
 
-#ifndef MINI_GL_COMPATIBILITY
 static boolean gl13 = false; // whether we can use opengl 1.3 functions
-#endif
 
 
 // -----------------+
@@ -198,14 +190,9 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
 #define pglScissor glScissor
 #define pglEnable glEnable
 #define pglDisable glDisable
-#ifndef MINI_GL_COMPATIBILITY
 #define pglGetDoublev glGetDoublev
-#endif
 //glGetIntegerv
 //glGetString
-#ifdef KOS_GL_COMPATIBILITY
-#define pglHint glHint
-#endif
 
 /* Depth Buffer */
 #define pglClearDepth glClearDepth
@@ -219,11 +206,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
 #define pglPushMatrix glPushMatrix
 #define pglPopMatrix glPopMatrix
 #define pglLoadIdentity glLoadIdentity
-#ifdef MINI_GL_COMPATIBILITY
-#define pglMultMatrixf glMultMatrixf
-#else
 #define pglMultMatrixd glMultMatrixd
-#endif
 #define pglRotatef glRotatef
 #define pglScalef glScalef
 #define pglTranslatef glTranslatef
@@ -261,9 +244,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
 #define pglDeleteTextures glDeleteTextures
 #define pglBindTexture glBindTexture
 /* texture mapping */ //GL_EXT_copy_texture
-#ifndef KOS_GL_COMPATIBILITY
 #define pglCopyTexImage2D glCopyTexImage2D
-#endif
 
 #else //!STATIC_OPENGL
 
@@ -290,10 +271,8 @@ typedef void (APIENTRY * PFNglEnable) (GLenum cap);
 static PFNglEnable pglEnable;
 typedef void (APIENTRY * PFNglDisable) (GLenum cap);
 static PFNglDisable pglDisable;
-#ifndef MINI_GL_COMPATIBILITY
 typedef void (APIENTRY * PFNglGetDoublev) (GLenum pname, GLdouble *params);
 static PFNglGetDoublev pglGetDoublev;
-#endif
 //glGetIntegerv
 //glGetString
 
@@ -318,13 +297,8 @@ typedef void (APIENTRY * PFNglPopMatrix) (void);
 static PFNglPopMatrix pglPopMatrix;
 typedef void (APIENTRY * PFNglLoadIdentity) (void);
 static PFNglLoadIdentity pglLoadIdentity;
-#ifdef MINI_GL_COMPATIBILITY
-typedef void (APIENTRY * PFNglMultMatrixf) (const GLfloat *m);
-static PFNglMultMatrixf pglMultMatrixf;
-#else
 typedef void (APIENTRY * PFNglMultMatrixd) (const GLdouble *m);
 static PFNglMultMatrixd pglMultMatrixd;
-#endif
 typedef void (APIENTRY * PFNglRotatef) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
 static PFNglRotatef pglRotatef;
 typedef void (APIENTRY * PFNglScalef) (GLfloat x, GLfloat y, GLfloat z);
@@ -392,15 +366,12 @@ static PFNglCopyTexImage2D pglCopyTexImage2D;
 typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
 static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
 
-#ifndef MINI_GL_COMPATIBILITY
 /* 1.3 functions for multitexturing */
 typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
 static PFNglActiveTexture pglActiveTexture;
 typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
 static PFNglMultiTexCoord2f pglMultiTexCoord2f;
-#endif
 
-#ifndef MINI_GL_COMPATIBILITY
 /* 1.2 Parms */
 /* GL_CLAMP_TO_EDGE_EXT */
 #ifndef GL_CLAMP_TO_EDGE
@@ -421,14 +392,6 @@ static PFNglMultiTexCoord2f pglMultiTexCoord2f;
 #define GL_TEXTURE1 0x84C1
 #endif
 
-#endif
-
-#ifdef MINI_GL_COMPATIBILITY
-#undef GL_CLAMP_TO_EDGE
-#undef GL_TEXTURE_MIN_LOD
-#undef GL_TEXTURE_MAX_LOD
-#endif
-
 boolean SetupGLfunc(void)
 {
 #ifndef STATIC_OPENGL
@@ -451,9 +414,7 @@ boolean SetupGLfunc(void)
 	GETOPENGLFUNC(pglScissor , glScissor)
 	GETOPENGLFUNC(pglEnable , glEnable)
 	GETOPENGLFUNC(pglDisable , glDisable)
-#ifndef MINI_GL_COMPATIBILITY
 	GETOPENGLFUNC(pglGetDoublev , glGetDoublev)
-#endif
 	GETOPENGLFUNC(pglGetIntegerv , glGetIntegerv)
 	GETOPENGLFUNC(pglGetString , glGetString)
 
@@ -467,11 +428,7 @@ boolean SetupGLfunc(void)
 	GETOPENGLFUNC(pglPushMatrix , glPushMatrix)
 	GETOPENGLFUNC(pglPopMatrix , glPopMatrix)
 	GETOPENGLFUNC(pglLoadIdentity , glLoadIdentity)
-#ifdef MINI_GL_COMPATIBILITY
-	GETOPENGLFUNC(pglMultMatrixf , glMultMatrixf)
-#else
 	GETOPENGLFUNC(pglMultMatrixd , glMultMatrixd)
-#endif
 	GETOPENGLFUNC(pglRotatef , glRotatef)
 	GETOPENGLFUNC(pglScalef , glScalef)
 	GETOPENGLFUNC(pglTranslatef , glTranslatef)
@@ -515,9 +472,6 @@ boolean SetupGLfunc(void)
 // This has to be done after the context is created so the version number can be obtained
 boolean SetupGLFunc13(void)
 {
-#ifdef MINI_GL_COMPATIBILITY
-	return false;
-#else
 	const GLubyte *version = pglGetString(GL_VERSION);
 	int glmajor, glminor;
 
@@ -553,7 +507,6 @@ boolean SetupGLFunc13(void)
 	else
 		DBG_Printf("GL_ARB_multitexture support: disabled\n");
 	return true;
-#endif
 }
 
 // -----------------+
@@ -571,11 +524,7 @@ static void SetNoTexture(void)
 
 static void GLPerspective(GLdouble fovy, GLdouble aspect)
 {
-#ifdef MINI_GL_COMPATIBILITY
-	GLfloat m[4][4] =
-#else
 	GLdouble m[4][4] =
-#endif
 	{
 		{ 1.0f, 0.0f, 0.0f, 0.0f},
 		{ 0.0f, 1.0f, 0.0f, 0.0f},
@@ -598,14 +547,9 @@ static void GLPerspective(GLdouble fovy, GLdouble aspect)
 	m[1][1] = cotangent;
 	m[2][2] = -(zFar + zNear) / deltaZ;
 	m[3][2] = -2.0f * zNear * zFar / deltaZ;
-#ifdef MINI_GL_COMPATIBILITY
-	pglMultMatrixf(&m[0][0]);
-#else
 	pglMultMatrixd(&m[0][0]);
-#endif
 }
 
-#ifndef MINI_GL_COMPATIBILITY
 static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
                       GLdouble* winX, GLdouble* winY, GLdouble* winZ)
 {
@@ -645,7 +589,6 @@ static void GLProject(GLdouble objX, GLdouble objY, GLdouble objZ,
 	*winY=in[1];
 	*winZ=in[2];
 }
-#endif
 
 // -----------------+
 // SetModelView     :
@@ -672,10 +615,8 @@ void SetModelView(GLint w, GLint h)
 	//pglScalef(1.0f, 320.0f/200.0f, 1.0f);  // gr_scalefrustum (ORIGINAL_ASPECT)
 
 	// added for new coronas' code (without depth buffer)
-#ifndef MINI_GL_COMPATIBILITY
 	pglGetIntegerv(GL_VIEWPORT, viewport);
 	pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
-#endif
 }
 
 
@@ -700,17 +641,13 @@ void SetStates(void)
 	//pglShadeModel(GL_FLAT);
 
 	pglEnable(GL_TEXTURE_2D);      // two-dimensional texturing
-#ifndef KOS_GL_COMPATIBILITY
 	pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 
 	pglAlphaFunc(GL_NOTEQUAL, 0.0f);
-#endif
 	//pglBlendFunc(GL_ONE, GL_ZERO); // copy pixel to frame buffer (opaque)
 	pglEnable(GL_BLEND);           // enable color blending
 
-#ifndef KOS_GL_COMPATIBILITY
 	pglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-#endif
 
 	//pglDisable(GL_DITHER);         // faB: ??? (undocumented in OpenGL 1.1)
 	                              // Hurdler: yes, it is!
@@ -735,9 +672,7 @@ void SetStates(void)
 	//tex_downloaded = NOTEXTURE_NUM;
 	//pglTexImage2D(GL_TEXTURE_2D, 0, 4, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);
 
-#ifndef KOS_GL_COMPATIBILITY
 	pglPolygonOffset(-1.0f, -1.0f);
-#endif
 
 	//pglEnable(GL_CULL_FACE);
 	//pglCullFace(GL_FRONT);
@@ -758,9 +693,7 @@ void SetStates(void)
 	// bp : when no t&l :)
 	pglLoadIdentity();
 	pglScalef(1.0f, 1.0f, -1.0f);
-#ifndef MINI_GL_COMPATIBILITY
 	pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
-#endif
 }
 
 
@@ -863,14 +796,6 @@ EXPORT void HWRAPI(ClearMipMapCache) (void)
 EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
                                 INT32 dst_stride, UINT16 * dst_data)
 {
-#ifdef KOS_GL_COMPATIBILITY
-	(void)x;
-	(void)y;
-	(void)width;
-	(void)height;
-	(void)dst_stride;
-	(void)dst_data;
-#else
 	INT32 i;
 	// DBG_Printf ("ReadRect()\n");
 	if (dst_stride == width*3)
@@ -912,7 +837,6 @@ EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height,
 		}
 		free(image);
 	}
-#endif
 }
 
 
@@ -933,10 +857,8 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
 	pglMatrixMode(GL_MODELVIEW);
 
 	// added for new coronas' code (without depth buffer)
-#ifndef MINI_GL_COMPATIBILITY
 	pglGetIntegerv(GL_VIEWPORT, viewport);
 	pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
-#endif
 }
 
 
@@ -983,12 +905,6 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
 	GLRGBAFloat c;
 
 	// DBG_Printf ("DrawLine() (%f %f %f) %d\n", v1->x, -v1->y, -v1->z, v1->argb);
-#ifdef MINI_GL_COMPATIBILITY
-	GLfloat px1, px2, px3, px4;
-	GLfloat py1, py2, py3, py4;
-	GLfloat dx, dy;
-	GLfloat angle;
-#endif
 
 	// BP: we should reflect the new state in our variable
 	//SetBlend(PF_Modulated|PF_NoTexture);
@@ -1000,33 +916,11 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
 	c.blue  = byte2float[Color.s.blue];
 	c.alpha = byte2float[Color.s.alpha];
 
-#ifndef MINI_GL_COMPATIBILITY
 	pglColor4fv(&c.red);    // is in RGBA float format
 	pglBegin(GL_LINES);
 		pglVertex3f(v1->x, -v1->y, 1.0f);
 		pglVertex3f(v2->x, -v2->y, 1.0f);
 	pglEnd();
-#else
-	if (v2->x != v1->x)
-		angle = (float)atan((v2->y-v1->y)/(v2->x-v1->x));
-	else
-		angle = N_PI_DEMI;
-	dx = (float)sin(angle) / (float)screen_width;
-	dy = (float)cos(angle) / (float)screen_height;
-
-	px1 = v1->x - dx;  py1 = v1->y + dy;
-	px2 = v2->x - dx;  py2 = v2->y + dy;
-	px3 = v2->x + dx;  py3 = v2->y - dy;
-	px4 = v1->x + dx;  py4 = v1->y - dy;
-
-	pglColor4f(c.red, c.green, c.blue, c.alpha);
-	pglBegin(GL_TRIANGLE_FAN);
-		pglVertex3f(px1, -py1, 1);
-		pglVertex3f(px2, -py2, 1);
-		pglVertex3f(px3, -py3, 1);
-		pglVertex3f(px4, -py4, 1);
-	pglEnd();
-#endif
 
 	pglEnable(GL_TEXTURE_2D);
 }
@@ -1034,9 +928,7 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
 static void Clamp2D(GLenum pname)
 {
 	pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP); // fallback clamp
-#ifdef GL_CLAMP_TO_EDGE
 	pglTexParameteri(GL_TEXTURE_2D, pname, GL_CLAMP_TO_EDGE);
-#endif
 }
 
 
@@ -1063,11 +955,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
 					pglBlendFunc(GL_SRC_ALPHA, GL_ZERO);                // 0 alpha = holes in texture
 					break;
 				case PF_Additive & PF_Blending:
-#ifdef ATI_RAGE_PRO_COMPATIBILITY
-					pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
-#else
 					pglBlendFunc(GL_SRC_ALPHA, GL_ONE);                 // src * alpha + dest
-#endif
 					break;
 				case PF_Environment & PF_Blending:
 					pglBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1083,7 +971,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
 					break;
 			}
 		}
-#ifndef KOS_GL_COMPATIBILITY
 		if (Xor & PF_NoAlphaTest)
 		{
 			if (PolyFlags & PF_NoAlphaTest)
@@ -1099,7 +986,7 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
 			else
 				pglDisable(GL_POLYGON_OFFSET_FILL);
 		}
-#endif
+
 		if (Xor&PF_NoDepthTest)
 		{
 			if (PolyFlags & PF_NoDepthTest)
@@ -1126,10 +1013,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
 				pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
 		}
 
-#ifdef KOS_GL_COMPATIBILITY
-		if (Xor&PF_Modulated && !(PolyFlags & PF_Modulated))
-			pglColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-#else
 		if (Xor&PF_Modulated)
 		{
 #if defined (__unix__) || defined (UNIXCOMMON)
@@ -1149,7 +1032,6 @@ EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
 				pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
 			}
 		}
-#endif
 
 		if (Xor & PF_Occlude) // depth test but (no) depth write
 		{
@@ -1203,11 +1085,7 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 	else
 	{
 		// Download a mipmap
-#ifdef KOS_GL_COMPATIBILITY
-		static GLushort tex[2048*2048];
-#else
 		static RGBA_t   tex[2048*2048];
-#endif
 		const GLvoid   *ptex = tex;
 		INT32             w, h;
 
@@ -1222,106 +1100,9 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 			!(pTexInfo->flags & TF_CHROMAKEYED))
 		{
 			// do nothing here.
-			// Not a problem with MiniGL since we don't use paletted texture
 		}
 		else
 #endif
-#ifdef KOS_GL_COMPATIBILITY
-		if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) ||
-			(pTexInfo->grInfo.format == GR_TEXFMT_AP_88))
-		{
-			const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
-			INT32 i, j;
-
-			for (j = 0; j < h; j++)
-			{
-				for (i = 0; i < w; i++)
-				{
-					if ((*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX) &&
-					    (pTexInfo->flags & TF_CHROMAKEYED))
-					{
-						tex[w*j+i] = 0;
-					}
-					else
-					{
-						if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88 && !(pTexInfo->flags & TF_CHROMAKEYED))
-							tex[w*j+i] = 0;
-						else
-							tex[w*j+i] = (myPaletteData[*pImgData].s.alpha>>4)<<12;
-
-						tex[w*j+i] |= (myPaletteData[*pImgData].s.red  >>4)<<8;
-						tex[w*j+i] |= (myPaletteData[*pImgData].s.green>>4)<<4;
-						tex[w*j+i] |= (myPaletteData[*pImgData].s.blue >>4);
-					}
-
-					pImgData++;
-
-					if (pTexInfo->grInfo.format == GR_TEXFMT_AP_88)
-					{
-						if (!(pTexInfo->flags & TF_CHROMAKEYED))
-							tex[w*j+i] |= ((*pImgData)>>4)<<12;
-						pImgData++;
-					}
-
-				}
-			}
-		}
-		else if (pTexInfo->grInfo.format == GR_RGBA)
-		{
-			// corona test : passed as ARGB 8888, which is not in glide formats
-			// Hurdler: not used for coronas anymore, just for dynamic lighting
-			const RGBA_t *pImgData = (const RGBA_t *)pTexInfo->grInfo.data;
-			INT32 i, j;
-
-			for (j = 0; j < h; j++)
-			{
-				for (i = 0; i < w; i++)
-				{
-					tex[w*j+i]  = (pImgData->s.alpha>>4)<<12;
-					tex[w*j+i] |= (pImgData->s.red  >>4)<<8;
-					tex[w*j+i] |= (pImgData->s.green>>4)<<4;
-					tex[w*j+i] |= (pImgData->s.blue >>4);
-					pImgData++;
-				}
-			}
-		}
-		else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88)
-		{
-			const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
-			INT32 i, j;
-
-			for (j = 0; j < h; j++)
-			{
-				for (i = 0; i < w; i++)
-				{
-					const GLubyte sID = (*pImgData)>>4;
-					tex[w*j+i] = sID<<8 | sID<<4 | sID;
-					pImgData++;
-					tex[w*j+i] |= ((*pImgData)>>4)<<12;
-					pImgData++;
-				}
-			}
-		}
-		else if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_8) // Used for fade masks
-		{
-			const GLubyte *pImgData = (const GLubyte *)pTexInfo->grInfo.data;
-			INT32 i, j;
-
-			for (j = 0; j < h; j++)
-			{
-				for (i = 0; i < w; i++)
-				{
-					tex[w*j+i]  = (pImgData>>4)<<12;
-					tex[w*j+i] |= (255>>4)<<8;
-					tex[w*j+i] |= (255>>4)<<4;
-					tex[w*j+i] |= (255>>4);
-					pImgData++;
-				}
-			}
-		}
-		else
-			DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format);
-#else
 		if ((pTexInfo->grInfo.format == GR_TEXFMT_P_8) ||
 			(pTexInfo->grInfo.format == GR_TEXFMT_AP_88))
 		{
@@ -1403,7 +1184,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 		}
 		else
 			DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format);
-#endif
 
 		pTexInfo->downloaded = NextTexAvail++;
 		tex_downloaded = pTexInfo->downloaded;
@@ -1412,18 +1192,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 		pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
 		pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
 
-#ifdef KOS_GL_COMPATIBILITY
-		pglTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, w, h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, ptex);
-#else
-#ifdef MINI_GL_COMPATIBILITY
-		//if (pTexInfo->grInfo.format == GR_TEXFMT_ALPHA_INTENSITY_88)
-			//pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-		//else
-			if (MipMap)
-				pgluBuild2DMipmaps(GL_TEXTURE_2D, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-			else
-				pglTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#else
 #ifdef USE_PALETTED_TEXTURE
 			//Hurdler: not really supported and not tested recently
 		if (glColorTableEXT &&
@@ -1441,15 +1209,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 			if (MipMap)
 			{
 				pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#ifdef GL_TEXTURE_MIN_LOD
 				pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
 				if (pTexInfo->flags & TF_TRANSPARENT)
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
 				else
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
-#endif
 				//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
 			}
 			else
@@ -1461,15 +1225,11 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 			if (MipMap)
 			{
 				pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
-#ifdef GL_TEXTURE_MIN_LOD
 				pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
 				if (pTexInfo->flags & TF_TRANSPARENT)
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
 				else
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 4);
-#endif
 				//pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_LINEAR_MIPMAP_LINEAR);
 			}
 			else
@@ -1481,21 +1241,15 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 			{
 				pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
 				// Control the mipmap level of detail
-#ifdef GL_TEXTURE_MIN_LOD
 				pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail
-#endif
-#ifdef GL_TEXTURE_MAX_LOD
 				if (pTexInfo->flags & TF_TRANSPARENT)
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff
 				else
 					pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 5);
-#endif
 			}
 			else
 				pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex);
 		}
-#endif
-#endif
 
 		if (pTexInfo->flags & TF_WRAPX)
 			pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -1519,19 +1273,6 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
 		else // initialisation de la liste
 			gr_cachetail = gr_cachehead =  pTexInfo;
 	}
-#ifdef MINI_GL_COMPATIBILITY
-	switch (pTexInfo->flags)
-	{
-		case 0 :
-			pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
-			pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-			break;
-		default:
-			pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-			pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-			break;
-	}
-#endif
 }
 
 
@@ -1545,18 +1286,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo  *pSurf,
                                     FBITFIELD     PolyFlags)
 {
 	FUINT i;
-#ifndef MINI_GL_COMPATIBILITY
 	FUINT j;
-#endif
 	GLRGBAFloat c = {0,0,0,0};
 
-#ifdef MINI_GL_COMPATIBILITY
-	if (PolyFlags & PF_Corona)
-		PolyFlags &= ~PF_NoDepthTest;
-#else
 	if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD))
 		PolyFlags &= ~(PF_NoDepthTest|PF_Corona);
-#endif
 
 	SetBlend(PolyFlags);    //TODO: inline (#pragma..)
 
@@ -1578,16 +1312,11 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo  *pSurf,
 			c.alpha = byte2float[pSurf->FlatColor.s.alpha];
 		}
 
-#ifdef MINI_GL_COMPATIBILITY
-		pglColor4f(c.red, c.green, c.blue, c.alpha);
-#else
 		pglColor4fv(&c.red);    // is in RGBA float format
-#endif
 	}
 
 	// this test is added for new coronas' code (without depth buffer)
 	// I think I should do a separate function for drawing coronas, so it will be a little faster
-#ifndef MINI_GL_COMPATIBILITY
 	if (PolyFlags & PF_Corona) // check to see if we need to draw the corona
 	{
 		//rem: all 8 (or 8.0f) values are hard coded: it can be changed to a higher value
@@ -1634,7 +1363,6 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo  *pSurf,
 		c.alpha *= scalef; // change the alpha value (it seems better than changing the size of the corona)
 		pglColor4fv(&c.red);
 	}
-#endif
 	if (PolyFlags & PF_MD2)
 		return;
 
@@ -1728,41 +1456,15 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
 			break;
 
 		case HWD_SET_POLYGON_SMOOTH:
-#ifdef KOS_GL_COMPATIBILITY // GL_POLYGON_SMOOTH_HINT
-			if (Value)
-				pglHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
-			else
-				pglHint(GL_POLYGON_SMOOTH_HINT,GL_FASTEST);
-#else
 			if (Value)
 				pglEnable(GL_POLYGON_SMOOTH);
 			else
 				pglDisable(GL_POLYGON_SMOOTH);
-#endif
 			break;
 
 		case HWD_SET_TEXTUREFILTERMODE:
 			switch (Value)
 			{
-#ifdef KOS_GL_COMPATIBILITY
-				case HWD_SET_TEXTUREFILTER_TRILINEAR:
-				case HWD_SET_TEXTUREFILTER_BILINEAR:
-					min_filter = mag_filter = GL_FILTER_BILINEAR;
-					break;
-				case HWD_SET_TEXTUREFILTER_POINTSAMPLED:
-					min_filter = mag_filter = GL_FILTER_NONE;
-				case HWD_SET_TEXTUREFILTER_MIXED1:
-					min_filter = GL_FILTER_NONE;
-					mag_filter = GL_LINEAR;
-				case HWD_SET_TEXTUREFILTER_MIXED2:
-					min_filter = GL_LINEAR;
-					mag_filter = GL_FILTER_NONE;
-					break;
-				case HWD_SET_TEXTUREFILTER_MIXED3:
-					min_filter = GL_FILTER_BILINEAR;
-					mag_filter = GL_FILTER_NONE;
-					break;
-#elif !defined (MINI_GL_COMPATIBILITY)
 				case HWD_SET_TEXTUREFILTER_TRILINEAR:
 					min_filter = GL_LINEAR_MIPMAP_LINEAR;
 					mag_filter = GL_LINEAR;
@@ -1791,14 +1493,9 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
 					mag_filter = GL_NEAREST;
 					MipMap = GL_TRUE;
 					break;
-#endif
 				default:
-#ifdef KOS_GL_COMPATIBILITY
-					min_filter = mag_filter = GL_FILTER_NONE;
-#else
 					mag_filter = GL_LINEAR;
 					min_filter = GL_NEAREST;
-#endif
 			}
 			if (!pgluBuild2DMipmaps)
 			{
@@ -1831,9 +1528,7 @@ static  void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
 	float scalex = scale, scaley = scale, scalez = scale;
 
 	// Because Otherwise, scaling the screen negatively vertically breaks the lighting
-#ifndef KOS_GL_COMPATIBILITY
 	GLfloat LightPos[] = {0.0f, 1.0f, 0.0f, 0.0f};
-#endif
 
 	if (duration == 0)
 		duration = 1;
@@ -1885,9 +1580,7 @@ static  void DrawMD2Ex(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration
 		pglCullFace(GL_BACK);
 	}
 
-#ifndef KOS_GL_COMPATIBILITY
 	pglLightfv(GL_LIGHT0, GL_POSITION, LightPos);
-#endif
 
 	pglShadeModel(GL_SMOOTH);
 	if (color)
@@ -2029,9 +1722,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
 			GLPerspective(53.13l, 2*ASPECT_RATIO);  // 53.13 = 2*atan(0.5)
 		else
 			GLPerspective(stransform->fovxangle, ASPECT_RATIO);
-#ifndef MINI_GL_COMPATIBILITY
 		pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
-#endif
 		pglMatrixMode(GL_MODELVIEW);
 	}
 	else
@@ -2045,15 +1736,11 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
 		else
 			//Hurdler: is "fov" correct?
 			GLPerspective(fov, ASPECT_RATIO);
-#ifndef MINI_GL_COMPATIBILITY
 		pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
-#endif
 		pglMatrixMode(GL_MODELVIEW);
 	}
 
-#ifndef MINI_GL_COMPATIBILITY
 	pglGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
-#endif
 }
 
 EXPORT INT32  HWRAPI(GetTextureUsed) (void)
@@ -2149,18 +1836,11 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
 
 	// Create screen texture
 	pglBindTexture(GL_TEXTURE_2D, startScreenWipe);
-#ifdef KOS_GL_COMPATIBILITY
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
 	Clamp2D(GL_TEXTURE_WRAP_S);
 	Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
 	pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
 
 	tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
 }
@@ -2178,18 +1858,11 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
 
 	// Create screen texture
 	pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
-#ifdef KOS_GL_COMPATIBILITY
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
 	Clamp2D(GL_TEXTURE_WRAP_S);
 	Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
 	pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
 
 	tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
 }
@@ -2242,9 +1915,7 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
 	INT32 texsize = 2048;
 	float xfix, yfix;
 
-#ifndef MINI_GL_COMPATIBILITY
 	INT32 fademaskdownloaded = tex_downloaded; // the fade mask that has been set
-#endif
 
 	// Use a power of two texture, dammit
 	if(screen_width <= 1024)
@@ -2284,7 +1955,6 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
 
 	SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest|PF_Clip|PF_NoZClip);
 
-#ifndef MINI_GL_COMPATIBILITY
 	if (gl13)
 	{
 		// Draw the end screen that fades in
@@ -2327,31 +1997,28 @@ EXPORT void HWRAPI(DoScreenWipe)(float alpha)
 	}
 	else
 	{
-#endif
-	// Draw the end screen that fades in
-	pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
-	pglBegin(GL_QUADS);
-		pglColor4f(1.0f, 1.0f, 1.0f, alpha);
+		// Draw the end screen that fades in
+		pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
+		pglBegin(GL_QUADS);
+			pglColor4f(1.0f, 1.0f, 1.0f, alpha);
 
-		// Bottom left
-		pglTexCoord2f(0.0f, 0.0f);
-		pglVertex3f(-1.0f, -1.0f, 1.0f);
+			// Bottom left
+			pglTexCoord2f(0.0f, 0.0f);
+			pglVertex3f(-1.0f, -1.0f, 1.0f);
 
-		// Top left
-		pglTexCoord2f(0.0f, yfix);
-		pglVertex3f(-1.0f, 1.0f, 1.0f);
+			// Top left
+			pglTexCoord2f(0.0f, yfix);
+			pglVertex3f(-1.0f, 1.0f, 1.0f);
 
-		// Top right
-		pglTexCoord2f(xfix, yfix);
-		pglVertex3f(1.0f, 1.0f, 1.0f);
+			// Top right
+			pglTexCoord2f(xfix, yfix);
+			pglVertex3f(1.0f, 1.0f, 1.0f);
 
-		// Bottom right
-		pglTexCoord2f(xfix, 0.0f);
-		pglVertex3f(1.0f, -1.0f, 1.0f);
-	pglEnd();
-#ifndef MINI_GL_COMPATIBILITY
+			// Bottom right
+			pglTexCoord2f(xfix, 0.0f);
+			pglVertex3f(1.0f, -1.0f, 1.0f);
+		pglEnd();
 	}
-#endif
 
 	tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
 }
@@ -2370,18 +2037,11 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
 
 	// Create screen texture
 	pglBindTexture(GL_TEXTURE_2D, screentexture);
-#ifdef KOS_GL_COMPATIBILITY
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
 	Clamp2D(GL_TEXTURE_WRAP_S);
 	Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
 	pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
 
 	tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
 }
@@ -2398,18 +2058,11 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
 
 	// Create screen texture
 	pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
-#ifdef KOS_GL_COMPATIBILITY
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_FILTER_NONE);
-	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_FILTER_NONE);
-#else
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
 	pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-#endif
 	Clamp2D(GL_TEXTURE_WRAP_S);
 	Clamp2D(GL_TEXTURE_WRAP_T);
-#ifndef KOS_GL_COMPATIBILITY
 	pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0);
-#endif
 
 	tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now
 
diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h
index 6a2eba1df00e548cb93e52abae6e9c4f2d8ee81a..e6cf164bb088b72ae778bc40fa02814e7f96fcd9 100644
--- a/src/hardware/r_opengl/r_opengl.h
+++ b/src/hardware/r_opengl/r_opengl.h
@@ -37,13 +37,11 @@
 #include <GL/gl.h>
 #include <GL/glu.h>
 
-#ifndef MINI_GL_COMPATIBILITY
 #ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static
 #define GL_GLEXT_PROTOTYPES
 #include <GL/glext.h>
 #endif
 #endif
-#endif
 
 #define  _CREATE_DLL_  // necessary for Unix AND Windows
 #include "../../doomdef.h"
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index b49d3eb96c62bcf87b2e16948463c916b23bd7e8..55aaee943f1deabc8a45e487618c8c5abcfac221 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -328,7 +328,7 @@ void HU_Start(void)
   */
 static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
 {
-	XBOXSTATIC char buf[254];
+	char buf[254];
 	size_t numwords, ix;
 	char *msg = &buf[2];
 	const size_t msgspace = sizeof buf - 2;
@@ -473,7 +473,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
 			player_names[playernum]);
 		if (server)
 		{
-			XBOXSTATIC UINT8 buf[2];
+			UINT8 buf[2];
 
 			buf[0] = (UINT8)playernum;
 			buf[1] = KICK_MSG_CON_FAIL;
@@ -493,7 +493,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
 				CONS_Alert(CONS_WARNING, M_GetText("Illegal say command received from %s containing invalid characters\n"), player_names[playernum]);
 				if (server)
 				{
-					XBOXSTATIC char buf[2];
+					char buf[2];
 
 					buf[0] = (char)playernum;
 					buf[1] = KICK_MSG_CON_FAIL;
@@ -1180,7 +1180,7 @@ void HU_Erase(void)
 //                   IN-LEVEL MULTIPLAYER RANKINGS
 //======================================================================
 
-#define supercheckdef ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS] || players[tab[i].num].mo->state > &states[S_PLAY_SUPER_TRANS9])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin].flags & SF_SUPER))
+#define supercheckdef ((players[tab[i].num].powers[pw_super] && players[tab[i].num].mo && (players[tab[i].num].mo->state < &states[S_PLAY_SUPER_TRANS1] || players[tab[i].num].mo->state >= &states[S_PLAY_SUPER_TRANS6])) || (players[tab[i].num].powers[pw_carry] == CR_NIGHTSMODE && skins[players[tab[i].num].skin].flags & SF_SUPER))
 #define greycheckdef ((players[tab[i].num].mo && players[tab[i].num].mo->health <= 0) || players[tab[i].num].spectator)
 
 //
diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c
index eb29e360879bb19edf9f24a1e3b04cb4d5c9ee0b..208f470f4c4e525b53986072010dc95d198109a4 100644
--- a/src/i_addrinfo.c
+++ b/src/i_addrinfo.c
@@ -20,17 +20,11 @@
 #else
 #include <winsock.h>
 #endif
-#elif !defined (__DJGPP__) && !defined(_WII)
+#elif !defined (__DJGPP__)
 #include <sys/socket.h>
-#ifndef _NDS
 #include <arpa/inet.h>
-#endif
-#ifdef _PS3
-#include <net/netdb.h>
-#elif ! defined (_arch_dreamcast)
 #include <netdb.h>
 #endif
-#endif
 
 #include "i_addrinfo.h"
 
@@ -262,9 +256,6 @@ int I_getaddrinfo(const char *node, const char *service,
 	for (i = 0, j = 0; i < ailen; i++, j++)
 	{
 		ai = *res+i;
-#ifdef _PS3
-		addr[i].sin_len = famsize;
-#endif
 		addr[i].sin_port = htons((UINT16)sockport);
 		if (nodename)
 		{
diff --git a/src/i_addrinfo.h b/src/i_addrinfo.h
index 744ea0cf7cac03a3607aeb4440d9393f550ff011..4cda8968b9bb4bb09f9b62ebd715abdb3f1a407b 100644
--- a/src/i_addrinfo.h
+++ b/src/i_addrinfo.h
@@ -39,17 +39,7 @@
 #define EAI_NONAME -2
 #endif
 
-#ifdef _PS3 // PSL1GHT v2
-struct my_addrinfo {
-	int                 ai_flags;
-	int                 ai_family;
-	int                 ai_socktype;
-	int                 ai_protocol;
-	size_t              ai_addrlen;
-	struct sockaddr    *ai_addr;
-	struct my_addrinfo *ai_next;
-};
-#elif defined (_WIN32) // already use the stub for Win32
+#ifdef _WIN32 // already use the stub for Win32
 // w32api, ws2tcpip.h, r1.12
 struct my_addrinfo {
         int     ai_flags;
diff --git a/src/i_tcp.c b/src/i_tcp.c
index c65a536a8577bef3e132b15d4eaab4ad6aa4374f..b6c72f8593d92b89fd99485c1ac344084bcf7f7b 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -18,20 +18,12 @@
 #ifdef __GNUC__
 #include <unistd.h>
 #endif
-#ifdef __OS2__
-#include <sys/types.h>
-#include <sys/time.h>
-#endif // __OS2__
-
-#ifdef _PS3
-#define NO_IPV6 // PSL1GHT v2 do not have IPv6 support
-#endif
 
 #ifndef NO_IPV6
 #define HAVE_IPV6
 #endif
 
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
 #define USE_WINSOCK
 #if defined (_WIN64) || defined (HAVE_IPV6)
 #define USE_WINSOCK2
@@ -40,12 +32,6 @@
 #endif
 #endif //WIN32 OS
 
-#ifdef _XBOX // XBox have on WinSock API?
-#undef USE_WINSOCK
-#undef USE_WINSOCK1
-#undef USE_WINSOCK2
-#endif
-
 #ifdef USE_WINSOCK2
 #include <ws2tcpip.h>
 #endif
@@ -61,17 +47,12 @@
 #else
 #ifdef USE_WINSOCK1
 #include <winsock.h>
-#elif !defined (SCOUW2) && !defined (SCOUW7) && !defined (__OS2__)
-#ifdef HAVE_LWIP
-#include <lwip/inet.h>
-#elif !defined (USE_WINSOCK)
+#elif !defined (SCOUW2) && !defined (SCOUW7)
+#ifndef USE_WINSOCK
 #include <arpa/inet.h>
 #endif //normal BSD API
 
-#ifdef HAVE_LWIP
-#include <lwip/sockets.h>
-#define ioctl lwip_ioctl
-#elif !defined (USE_WINSOCK) //!HAVE_LWIP
+#ifndef USE_WINSOCK
 #ifdef __APPLE_CC__
 #ifndef _BSD_SOCKLEN_T_
 #define _BSD_SOCKLEN_T_
@@ -81,14 +62,7 @@
 #include <netinet/in.h>
 #endif //normal BSD API
 
-#if defined(_arch_dreamcast) && !defined(HAVE_LWIP)
-#include <kos/net.h>
-#elif defined(HAVE_LWIP)
-#include <lwip/lwip.h>
-#elif defined (_PS3)
-#include <net/select.h>
-#include <net/net.h>
-#elif !defined(USE_WINSOCK) //!HAVE_LWIP
+#ifndef USE_WINSOCK
 #include <netdb.h>
 #include <sys/ioctl.h>
 #endif //normal BSD API
@@ -96,10 +70,6 @@
 #include <errno.h>
 #include <time.h>
 
-#ifdef _arch_dreamcast
-#include "sdl/SRB2DC/dchelp.h"
-#endif
-
 #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
 	#include <sys/time.h>
 #endif // UNIXCOMMON
@@ -190,11 +160,6 @@ static UINT8 UPNP_support = TRUE;
 	// winsock stuff (in winsock a socket is not a file)
 	#define ioctl ioctlsocket
 	#define close closesocket
-
-	#ifdef _WIN32_WCE
-	#include "sdl/SRB2CE/cehelp.h"
-	#endif
-
 #endif
 
 #include "i_addrinfo.h"
@@ -205,9 +170,7 @@ static UINT8 UPNP_support = TRUE;
 #define SELECTTEST
 #endif
 
-#elif defined(HAVE_LWIP)
-#define SELECTTEST
-#elif !defined( _arch_dreamcast)
+#else
 #define SELECTTEST
 #endif
 
@@ -218,7 +181,7 @@ typedef SOCKET SOCKET_TYPE;
 #define BADSOCKET INVALID_SOCKET
 #define ERRSOCKET (SOCKET_ERROR)
 #else
-#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) || defined(_PS3)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__)
 typedef int SOCKET_TYPE;
 #else
 typedef unsigned long SOCKET_TYPE;
@@ -1165,12 +1128,6 @@ boolean I_InitTcpDriver(void)
 		CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
 		CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
 #endif
-#ifdef HAVE_LWIP
-		lwip_kos_init();
-#elif defined(_arch_dreamcast)
-		//return;
-		net_init();
-#endif
 #ifdef __DJGPP__
 #ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load
 		survive_eth   = 1; // would be needed to not exit if pkt_eth_init() fails
@@ -1223,9 +1180,6 @@ boolean I_InitTcpDriver(void)
 			CONS_Debug(DBG_NETPLAY, "No TCP/IP driver detected\n");
 #endif // libsocket
 #endif // __DJGPP__
-#ifdef _PS3
-		netInitialize();
-#endif
 #ifndef __DJGPP__
 		init_tcp_driver = true;
 #endif
@@ -1274,11 +1228,6 @@ void I_ShutdownTcpDriver(void)
 	WS_addrinfocleanup();
 	WSACleanup();
 #endif
-#ifdef HAVE_LWIP
-	lwip_kos_shutdown();
-#elif defined(_arch_dreamcast)
-	net_shutdown();
-#endif
 #ifdef __DJGPP__
 #ifdef WATTCP // wattcp
 	//_outch = NULL;
@@ -1287,9 +1236,6 @@ void I_ShutdownTcpDriver(void)
 	__lsck_uninit();
 #endif // libsocket
 #endif // __DJGPP__
-#ifdef _PS3
-	netDeinitialize();
-#endif
 	CONS_Printf("shut down\n");
 	init_tcp_driver = false;
 #endif
diff --git a/src/info.c b/src/info.c
index d62111640efa8660cc0b094dc826e76538d7872f..acb12379a9e021c93fa07155ab668b1592dc075b 100644
--- a/src/info.c
+++ b/src/info.c
@@ -479,6 +479,19 @@ char spr2names[NUMPLAYERSPRITES][5] =
 	"DRLB",
 	"DRLC",
 
+	"TAL0",
+	"TAL1",
+	"TAL2",
+	"TAL3",
+	"TAL4",
+	"TAL5",
+	"TAL6",
+	"TAL7",
+	"TAL8",
+	"TAL9",
+	"TALA",
+	"TALB",
+
 	"SIGN",
 	"LIFE"
 };
@@ -562,8 +575,21 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
 	SPR2_NGTB, // SPR2_DRLB,
 	SPR2_NGTC, // SPR2_DRLC,
 
+	0, // SPR2_TAL0,
+	SPR2_TAL0, // SPR2_TAL1,
+	SPR2_TAL1, // SPR2_TAL2,
+	SPR2_TAL2, // SPR2_TAL3,
+	SPR2_TAL1, // SPR2_TAL4,
+	SPR2_TAL4, // SPR2_TAL5,
+	SPR2_TAL0, // SPR2_TAL6,
+	SPR2_TAL3, // SPR2_TAL7,
+	SPR2_TAL7, // SPR2_TAL8,
+	SPR2_TAL0, // SPR2_TAL9,
+	SPR2_TAL9, // SPR2_TALA,
+	SPR2_TAL0, // SPR2_TALB,
+
 	0, // SPR2_SIGN,
-	0, // SPR2_LIFE
+	0, // SPR2_LIFE,
 };
 
 // Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@@ -644,15 +670,12 @@ state_t states[NUMSTATES] =
 	{SPR_PLAY, SPR2_MLEL,                35, {NULL},                   0, 0, S_PLAY_WALK},  // S_PLAY_MELEE_LANDING
 
 	// SF_SUPER
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER,                4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER,                4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8
-	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 16, {NULL}, 0, 0, S_PLAY_WALK},         // S_PLAY_SUPER_TRANS9
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER,                3, {NULL},          0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS1
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER,                3, {NULL},          0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
+	{SPR_PLAY, SPR2_TRNS|FF_SPR2SUPER|FF_FULLBRIGHT, 20, {A_FadeOverlay}, 0, 0, S_PLAY_FALL},         // S_PLAY_SUPER_TRANS6
 
 	{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
 
@@ -667,15 +690,12 @@ state_t states[NUMSTATES] =
 	{SPR_PLAY, SPR2_SIGN, 1, {NULL}, 0, 24, S_PLAY_SIGN},         // S_PLAY_SIGN
 
 	// NiGHTS Player, transforming
-	{SPR_PLAY, SPR2_TRNS,                4, {A_Scream}, 0, 0, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS
-	{SPR_PLAY, SPR2_TRNS,                4, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS3}, // S_PLAY_NIGHTS_TRANS2
-	{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT,  4, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS4}, // S_PLAY_NIGHTS_TRANS3
-	{SPR_PLAY, SPR2_TRNS,                3, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4
-	{SPR_PLAY, SPR2_TRNS,                3, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5
-	{SPR_PLAY, SPR2_TRNS,                3, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS7}, // S_PLAY_NIGHTS_TRANS6
-	{SPR_PLAY, SPR2_TRNS,                3, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS8}, // S_PLAY_NIGHTS_TRANS7
-	{SPR_PLAY, SPR2_TRNS,                3, {NULL},     0, 0, S_PLAY_NIGHTS_TRANS9}, // S_PLAY_NIGHTS_TRANS8
-	{SPR_PLAY, SPR2_TRNS,               16, {NULL},     0, 0, S_PLAY_NIGHTS_FLOAT},  // S_PLAY_NIGHTS_TRANS9
+	{SPR_PLAY, SPR2_TRNS,                3, {NULL},          0, 0, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1
+	{SPR_PLAY, SPR2_TRNS,                3, {NULL},          0, 0, S_PLAY_NIGHTS_TRANS3}, // S_PLAY_NIGHTS_TRANS2
+	{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_NIGHTS_TRANS4}, // S_PLAY_NIGHTS_TRANS3
+	{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_NIGHTS_TRANS5}, // S_PLAY_NIGHTS_TRANS4
+	{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT,  2, {NULL},          0, 0, S_PLAY_NIGHTS_TRANS6}, // S_PLAY_NIGHTS_TRANS5
+	{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 25, {A_FadeOverlay}, 4, 0, S_PLAY_NIGHTS_FLOAT},  // S_PLAY_NIGHTS_TRANS5
 
 	// NiGHTS Player, stand, float, pain, pull and attack
 	{SPR_PLAY, SPR2_NSTD, 7, {NULL}, 0, 0, S_PLAY_NIGHTS_STAND},  // S_PLAY_NIGHTS_STAND
@@ -712,6 +732,20 @@ state_t states[NUMSTATES] =
 	{SPR_PLAY, SPR2_NGTC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_FLYC},   // S_PLAY_NIGHTS_FLYC
 	{SPR_PLAY, SPR2_DRLC, 2, {NULL}, 0, 0, S_PLAY_NIGHTS_DRILLC}, // S_PLAY_NIGHTS_DRILLC
 
+	// c:
+	{SPR_PLAY, SPR2_TAL0|FF_SPR2MIDSTART,  5, {NULL}, 0, 0, S_TAILSOVERLAY_STAND}, // S_TAILSOVERLAY_STAND
+	{SPR_PLAY, SPR2_TAL1|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_0DEGREES}, // S_TAILSOVERLAY_0DEGREES
+	{SPR_PLAY, SPR2_TAL2|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS30DEGREES}, // S_TAILSOVERLAY_PLUS30DEGREES
+	{SPR_PLAY, SPR2_TAL3|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PLUS60DEGREES}, // S_TAILSOVERLAY_PLUS60DEGREES
+	{SPR_PLAY, SPR2_TAL4|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS30DEGREES}, // S_TAILSOVERLAY_MINUS30DEGREES
+	{SPR_PLAY, SPR2_TAL5|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_MINUS60DEGREES}, // S_TAILSOVERLAY_MINUS60DEGREES
+	{SPR_PLAY, SPR2_TAL6|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_RUN}, // S_TAILSOVERLAY_RUN
+	{SPR_PLAY, SPR2_TAL7|FF_SPR2MIDSTART,  4, {NULL}, 0, 0, S_TAILSOVERLAY_FLY}, // S_TAILSOVERLAY_FLY
+	{SPR_PLAY, SPR2_TAL8|FF_SPR2MIDSTART,  4, {NULL}, 0, 0, S_TAILSOVERLAY_TIRE}, // S_TAILSOVERLAY_TIRE
+	{SPR_PLAY, SPR2_TAL9|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_PAIN}, // S_TAILSOVERLAY_PAIN
+	{SPR_PLAY, SPR2_TALA|FF_SPR2MIDSTART, 35, {NULL}, 0, 0, S_TAILSOVERLAY_GASP}, // S_TAILSOVERLAY_GASP
+	{SPR_PLAY, SPR2_TALB                , 35, {NULL}, 0, 0, S_TAILSOVERLAY_EDGE}, // S_TAILSOVERLAY_EDGE
+
 	// Blue Crawla
 	{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND},   // S_POSS_STND
 	{SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2},   // S_POSS_RUN1
@@ -3235,6 +3269,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		(statenum_t)MT_NULL // raisestate
 	},
 
+	{           // MT_TAILSOVERLAY
+		-1,             // doomednum
+		S_INVISIBLE,    // spawnstate
+		1000,           // spawnhealth
+		S_NULL,         // seestate
+		sfx_None,       // seesound
+		8,              // reactiontime
+		sfx_None,       // attacksound
+		S_NULL,         // painstate
+		0,              // painchance
+		sfx_None,       // painsound
+		S_NULL,         // meleestate
+		S_NULL,         // missilestate
+		S_NULL,         // deathstate
+		S_NULL,         // xdeathstate
+		sfx_None,       // deathsound
+		8,              // speed
+		16*FRACUNIT,    // radius
+		48*FRACUNIT,    // height
+		2,              // display offset
+		16,             // mass
+		0,              // damage
+		sfx_None,       // activesound
+		MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
+		S_NULL          // raisestate
+	},
+
 	{           // MT_BLUECRAWLA
 		100,            // doomednum
 		S_POSS_STND,    // spawnstate
@@ -11703,7 +11764,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_ELEMENTAL,   // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11730,7 +11791,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_ATTRACT,     // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11757,7 +11818,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_FORCE,       // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11784,7 +11845,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_ARMAGEDDON,  // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11811,7 +11872,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_WHIRLWIND,        // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11838,7 +11899,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_PITY,        // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11865,7 +11926,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_FLAMEAURA,   // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		-2,             // display offset
+		-4,             // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11892,7 +11953,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_BUBBLEWRAP,  // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		2,              // display offset
+		4,              // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -11919,7 +11980,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		SH_THUNDERCOIN, // speed
 		64*FRACUNIT,    // radius
 		64*FRACUNIT,    // height
-		-2,             // display offset
+		-4,             // display offset
 		16,             // mass
 		0,              // damage
 		sfx_None,       // activesound
@@ -14957,7 +15018,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		0,              // speed
 		16*FRACUNIT,    // radius
 		48*FRACUNIT,    // height
-		0,              // display offset
+		1,              // display offset
 		1000,           // mass
 		8,              // damage
 		sfx_None,       // activesound
diff --git a/src/info.h b/src/info.h
index 7bc7e673a6cf8e3b381dd20df5d18b1c4fe6639d..ea2103393f43ee082904078d87eea4f035ececbe 100644
--- a/src/info.h
+++ b/src/info.h
@@ -216,6 +216,7 @@ void A_FlickyCheck();
 void A_FlickyHeightCheck();
 void A_FlickyFlutter();
 void A_FlameParticle();
+void A_FadeOverlay();
 
 // ratio of states to sprites to mobj types is roughly 6 : 1 : 1
 #define NUMMOBJFREESLOTS 256
@@ -685,6 +686,20 @@ typedef enum playersprite
 	SPR2_DRLB,
 	SPR2_DRLC,
 
+	// c:
+	SPR2_TAL0,
+	SPR2_TAL1,
+	SPR2_TAL2,
+	SPR2_TAL3,
+	SPR2_TAL4,
+	SPR2_TAL5,
+	SPR2_TAL6,
+	SPR2_TAL7,
+	SPR2_TAL8,
+	SPR2_TAL9,
+	SPR2_TALA,
+	SPR2_TALB,
+
 	SPR2_SIGN, // end sign head
 	SPR2_LIFE, // life monitor icon
 
@@ -763,15 +778,12 @@ typedef enum state
 	S_PLAY_MELEE_LANDING,
 
 	// SF_SUPER
-	S_PLAY_SUPER_TRANS,
+	S_PLAY_SUPER_TRANS1,
 	S_PLAY_SUPER_TRANS2,
 	S_PLAY_SUPER_TRANS3,
 	S_PLAY_SUPER_TRANS4,
 	S_PLAY_SUPER_TRANS5,
 	S_PLAY_SUPER_TRANS6,
-	S_PLAY_SUPER_TRANS7,
-	S_PLAY_SUPER_TRANS8,
-	S_PLAY_SUPER_TRANS9,
 
 	// technically the player goes here but it's an infinite tic state
 	S_OBJPLACE_DUMMY,
@@ -787,15 +799,12 @@ typedef enum state
 	S_PLAY_SIGN,
 
 	// NiGHTS character (uses player sprite)
-	S_PLAY_NIGHTS_TRANS,
+	S_PLAY_NIGHTS_TRANS1,
 	S_PLAY_NIGHTS_TRANS2,
 	S_PLAY_NIGHTS_TRANS3,
 	S_PLAY_NIGHTS_TRANS4,
 	S_PLAY_NIGHTS_TRANS5,
 	S_PLAY_NIGHTS_TRANS6,
-	S_PLAY_NIGHTS_TRANS7,
-	S_PLAY_NIGHTS_TRANS8,
-	S_PLAY_NIGHTS_TRANS9,
 
 	S_PLAY_NIGHTS_STAND,
 	S_PLAY_NIGHTS_FLOAT,
@@ -830,6 +839,20 @@ typedef enum state
 	S_PLAY_NIGHTS_FLYC,
 	S_PLAY_NIGHTS_DRILLC,
 
+	// c:
+	S_TAILSOVERLAY_STAND,
+	S_TAILSOVERLAY_0DEGREES,
+	S_TAILSOVERLAY_PLUS30DEGREES,
+	S_TAILSOVERLAY_PLUS60DEGREES,
+	S_TAILSOVERLAY_MINUS30DEGREES,
+	S_TAILSOVERLAY_MINUS60DEGREES,
+	S_TAILSOVERLAY_RUN,
+	S_TAILSOVERLAY_FLY,
+	S_TAILSOVERLAY_TIRE,
+	S_TAILSOVERLAY_PAIN,
+	S_TAILSOVERLAY_GASP,
+	S_TAILSOVERLAY_EDGE,
+
 	// Blue Crawla
 	S_POSS_STND,
 	S_POSS_RUN1,
@@ -3206,6 +3229,7 @@ typedef enum mobj_type
 
 	MT_THOK, // Thok! mobj
 	MT_PLAYER,
+	MT_TAILSOVERLAY, // c:
 
 	// Enemies
 	MT_BLUECRAWLA,
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index b88a9712e1a0c06e137e98a2d7bcdbffa36db70f..4d845df52c715027b0b422a9b6ab3bb7b2f00baf 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -135,7 +135,7 @@ static const struct {
 };
 
 // goes through the above list and returns the utype string for the userdata type
-// returns "unknown" instead if we couldn't find the right userdata type 
+// returns "unknown" instead if we couldn't find the right userdata type
 static const char *GetUserdataUType(lua_State *L)
 {
 	UINT8 i;
diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c
index ccd90f99363aa2645f9220ef757c509ac1e3944b..ebfd6a2dfd31dabde12a50688ab39842e7e26749 100644
--- a/src/lua_blockmaplib.c
+++ b/src/lua_blockmaplib.c
@@ -254,7 +254,7 @@ static int lib_searchBlockmap(lua_State *L)
 			if (P_MobjWasRemoved(mobj)){ // ...unless the original object was removed
 				lua_pushboolean(L, false); // in which case we have to stop now regardless
 				return 1;
-			}	
+			}
 		}
 	lua_pushboolean(L, retval);
 	return 1;
diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c
index 559c576f0513a14ffa7273b59243b537bc4af971..c82c39b4606c4425e2b425d7deece121c568ed7c 100644
--- a/src/lua_consolelib.c
+++ b/src/lua_consolelib.c
@@ -89,7 +89,7 @@ deny:
 	CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]);
 	if (server)
 	{
-		XBOXSTATIC UINT8 bufn[2];
+		UINT8 bufn[2];
 
 		bufn[0] = (UINT8)playernum;
 		bufn[1] = KICK_MSG_CON_FAIL;
diff --git a/src/lua_hook.h b/src/lua_hook.h
index fe5706f56a6b3c90051ba2bf84f49d5da274b122..822edf79fe127224e50ee10a4f7330ce68ae63e4 100644
--- a/src/lua_hook.h
+++ b/src/lua_hook.h
@@ -47,6 +47,7 @@ enum hook {
 	hook_ShieldSpecial,
 	hook_MobjMoveBlocked,
 	hook_MapThingSpawn,
+	hook_FollowMobj,
 
 	hook_MAX // last hook
 };
@@ -85,5 +86,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8
 #define LUAh_ShieldSpecial(player) LUAh_PlayerHook(player, hook_ShieldSpecial) // Hook for shield abilities
 #define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
 boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
+boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following
 
 #endif
diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index 3dd3f932f81a41bb82c046a7eb4fe8a564de796f..0a7ef801e00ee1dcf008538745c2fdc6ea30c73d 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -58,6 +58,7 @@ const char *const hookNames[hook_MAX+1] = {
 	"ShieldSpecial",
 	"MobjMoveBlocked",
 	"MapThingSpawn",
+	"FollowMobj",
 	NULL
 };
 
@@ -197,6 +198,7 @@ static int lib_addHook(lua_State *L)
 	case hook_SpinSpecial:
 	case hook_JumpSpinSpecial:
 	case hook_PlayerSpawn:
+	case hook_FollowMobj:
 		lastp = &playerhooks;
 		break;
 	case hook_LinedefExecute:
@@ -1138,4 +1140,42 @@ boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing)
 	return hooked;
 }
 
+// Hook for P_PlayerAfterThink Smiles mobj-following
+boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
+{
+	hook_p hookp;
+	boolean hooked = false;
+	if (!gL || !(hooksAvailable[hook_FollowMobj/8] & (1<<(hook_FollowMobj%8))))
+		return 0;
+
+	lua_settop(gL, 0);
+
+	for (hookp = playerhooks; hookp; hookp = hookp->next)
+		if (hookp->type == hook_FollowMobj)
+		{
+			if (lua_gettop(gL) == 0)
+			{
+				LUA_PushUserdata(gL, player, META_PLAYER);
+				LUA_PushUserdata(gL, mobj, META_MOBJ);
+			}
+			lua_pushfstring(gL, FMT_HOOKID, hookp->id);
+			lua_gettable(gL, LUA_REGISTRYINDEX);
+			lua_pushvalue(gL, -3);
+			lua_pushvalue(gL, -3);
+			if (lua_pcall(gL, 2, 1, 0)) {
+				if (!hookp->error || cv_debug & DBG_LUA)
+					CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
+				lua_pop(gL, 1);
+				hookp->error = true;
+				continue;
+			}
+			if (lua_toboolean(gL, -1))
+				hooked = true;
+			lua_pop(gL, 1);
+		}
+
+	lua_settop(gL, 0);
+	return hooked;
+}
+
 #endif
diff --git a/src/lua_infolib.c b/src/lua_infolib.c
index c3803f7e246f395bd761d953b7a091b94aa28eae..48ac57c3252052379c3132998d265b79b5a9d488 100644
--- a/src/lua_infolib.c
+++ b/src/lua_infolib.c
@@ -165,10 +165,12 @@ static int lib_setSpr2default(lua_State *L)
 	{
 		const char *name = lua_tostring(L, 1);
 		for (i = 0; i < free_spr2; i++)
+		{
 			if (fastcmp(name, spr2names[i]))
 				break;
-			if (i == free_spr2)
-				return luaL_error(L, "spr2defaults[] invalid index");
+		}
+		if (i == free_spr2)
+			return luaL_error(L, "spr2defaults[] invalid index");
 	}
 	else
 		return luaL_error(L, "spr2defaults[] invalid index");
@@ -182,10 +184,12 @@ static int lib_setSpr2default(lua_State *L)
 	{
 		const char *name = lua_tostring(L, 2);
 		for (j = 0; j < free_spr2; j++)
+		{
 			if (fastcmp(name, spr2names[j]))
 				break;
-			if (j == free_spr2)
-				return luaL_error(L, "spr2defaults[] invalid index");
+		}
+		if (j == free_spr2)
+			return luaL_error(L, "spr2defaults[] invalid index");
 	}
 
 	if (j >= free_spr2)
diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index 7c55012d22c1e8bfe2472eb808482c39617906ef..12b2646d04df53fa69f3b0526435da84ca4df1ff 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -174,6 +174,10 @@ static int player_get(lua_State *L)
 		lua_pushinteger(L, plr->spinitem);
 	else if (fastcmp(field,"revitem"))
 		lua_pushinteger(L, plr->revitem);
+	else if (fastcmp(field,"followitem"))
+		lua_pushinteger(L, plr->followitem);
+	else if (fastcmp(field,"followmobj"))
+		LUA_PushUserdata(L, plr->followmobj, META_MOBJ);
 	else if (fastcmp(field,"actionspd"))
 		lua_pushfixed(L, plr->actionspd);
 	else if (fastcmp(field,"mindash"))
@@ -441,6 +445,10 @@ static int player_set(lua_State *L)
 		plr->spinitem = luaL_checkinteger(L, 3);
 	else if (fastcmp(field,"revitem"))
 		plr->revitem = luaL_checkinteger(L, 3);
+	else if (fastcmp(field,"followitem"))
+		plr->followitem = luaL_checkinteger(L, 3);
+	else if (fastcmp(field,"followmobj"))
+		plr->followmobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
 	else if (fastcmp(field,"actionspd"))
 		plr->actionspd = (INT32)luaL_checkinteger(L, 3);
 	else if (fastcmp(field,"mindash"))
diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c
index f93513c49c52677b585616968f1ce59c550bd9ff..1a70a82d9fc27539124d1fc7e4104e6714d8ee3e 100644
--- a/src/lua_skinlib.c
+++ b/src/lua_skinlib.c
@@ -35,6 +35,7 @@ enum skin {
 	skin_thokitem,
 	skin_spinitem,
 	skin_revitem,
+	skin_followitem,
 	skin_actionspd,
 	skin_mindash,
 	skin_maxdash,
@@ -73,6 +74,7 @@ static const char *const skin_opt[] = {
 	"thokitem",
 	"spinitem",
 	"revitem",
+	"followitem",
 	"actionspd",
 	"mindash",
 	"maxdash",
@@ -162,6 +164,9 @@ static int skin_get(lua_State *L)
 	case skin_revitem:
 		lua_pushinteger(L, skin->revitem);
 		break;
+	case skin_followitem:
+		lua_pushinteger(L, skin->followitem);
+		break;
 	case skin_actionspd:
 		lua_pushfixed(L, skin->actionspd);
 		break;
diff --git a/src/lzf.c b/src/lzf.c
index 272174f30a54a6c04b64c864dff2304f57cad6cc..f81c3ee0a36321356a4eafff073d3177dd19fbd7 100644
--- a/src/lzf.c
+++ b/src/lzf.c
@@ -119,9 +119,7 @@
 /*****************************************************************************/
 /* nothing should be changed below */
 
-#ifndef _NDS
 typedef unsigned char u8;
-#endif
 
 typedef const u8 *LZF_STATE[1 << (HLOG)];
 
@@ -159,7 +157,7 @@ typedef const u8 *LZF_STATE[1 << (HLOG)];
  * lzfP.h ends here. lzf_d.c follows.
  */
 
-#if AVOID_ERRNO || defined(_WIN32_WCE)
+#if AVOID_ERRNO
 # define SET_ERRNO(n)
 #else
 # include <errno.h>
diff --git a/src/m_argv.c b/src/m_argv.c
index 859fc902611e69f0249332d13b095a25778bf8e4..213577e766ddcc495d054391ea1802e4ceb3cfa3 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -123,12 +123,7 @@ void M_PushSpecialParameters(void)
 }
 
 /// \brief max args
-
-#if defined (_arch_dreamcast) || defined (_XBOX) || defined (_WII)
-#define MAXARGVS 1
-#else
 #define MAXARGVS 256
-#endif
 
 /**	\brief the M_FindResponseFile function
 	Find a response file
diff --git a/src/m_cheat.c b/src/m_cheat.c
index dd5b20dfce87ec3a42d04252770982018baf11cf..69ae77114b7ad6cc6be366de86162ae71bcfebd0 100644
--- a/src/m_cheat.c
+++ b/src/m_cheat.c
@@ -1261,7 +1261,7 @@ void Command_ObjectPlace_f(void)
 	{
 		objectplacing = true;
 
-		if ((players[0].powers[pw_carry] == CR_NIGHTSMODE))
+		if (players[0].powers[pw_carry] == CR_NIGHTSMODE)
 			return;
 
 		if (!COM_CheckParm("-silent"))
diff --git a/src/m_cond.c b/src/m_cond.c
index 9339c498991ccb9993fd044b42b984eb5b5e35c6..e9d6556942febe8b5c81916d35b243fc8654eccc 100644
--- a/src/m_cond.c
+++ b/src/m_cond.c
@@ -980,18 +980,18 @@ UINT8 M_CompletionEmblems(void) // Bah! Duplication sucks, but it's for a separa
 		levelnum = emblemlocations[i].level;
 		embtype = emblemlocations[i].var;
 		flags = MV_BEATEN;
-		
+
 		if (embtype & ME_ALLEMERALDS)
 			flags |= MV_ALLEMERALDS;
-		
+
 		if (embtype & ME_ULTIMATE)
 			flags |= MV_ULTIMATE;
-		
+
 		if (embtype & ME_PERFECT)
 			flags |= MV_PERFECT;
-		
+
 		res = ((mapvisited[levelnum - 1] & flags) == flags);
-		
+
 		emblemlocations[i].collected = res;
 		if (res)
 			++somethingUnlocked;
diff --git a/src/m_fixed.h b/src/m_fixed.h
index 1cf9abbae3c97e076e391bc41954eefaf0aa6b2c..8050324dbe1015bf5f3dc9036f97abd9c62f1a60 100644
--- a/src/m_fixed.h
+++ b/src/m_fixed.h
@@ -20,10 +20,6 @@
 #include <stdlib.h>
 #endif
 
-#ifdef _WIN32_WCE
-#include "sdl/SRB2CE/cehelp.h"
-#endif
-
 /*!
   \brief bits of the fraction
 */
diff --git a/src/m_menu.c b/src/m_menu.c
index 12bab3b0c0059ffb9aab779231f86b16cc76a431..ab005894de31dc7e0b36336850c9e8b5e9122f6b 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -149,7 +149,7 @@ description_t description[32] =
 	{false, "???", "", "", 0, 0},
 	{false, "???", "", "", 0, 0}
 };
-static INT16 char_on = 0;
+INT16 char_on = -1, startchar = 1;
 static char *char_notes = NULL;
 static fixed_t char_scroll = 0;
 
@@ -2409,7 +2409,6 @@ boolean M_Responder(event_t *ev)
 				itemOn = 0;
 				return true;
 
-#ifndef DC
 			case KEY_F5: // Video Mode
 				if (modeattacking)
 					return true;
@@ -2417,7 +2416,6 @@ boolean M_Responder(event_t *ev)
 				M_Options(0);
 				M_VideoModeMenu(0);
 				return true;
-#endif
 
 			case KEY_F6: // Empty
 				return true;
@@ -2795,9 +2793,8 @@ void M_ClearMenus(boolean callexitmenufunc)
 	if (currentMenu->quitroutine && callexitmenufunc && !currentMenu->quitroutine())
 		return; // we can't quit this menu (also used to set parameter from the menu)
 
-#ifndef DC // Save the config file. I'm sick of crashing the game later and losing all my changes!
+	// Save the config file. I'm sick of crashing the game later and losing all my changes!
 	COM_BufAddText(va("saveconfig \"%s\" -silent\n", configfile));
-#endif //Alam: But not on the Dreamcast's VMUs
 
 	if (currentMenu == &MessageDef) // Oh sod off!
 		currentMenu = &MainDef; // Not like it matters
@@ -3220,6 +3217,7 @@ static void M_DrawGenericMenu(void)
 							W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
 					}
 				}
+				/* FALLTHRU */
 			case IT_NOTHING:
 			case IT_DYBIGSPACE:
 				y += LINEHEIGHT;
@@ -3278,6 +3276,7 @@ static void M_DrawGenericMenu(void)
 					break;
 			case IT_STRING2:
 				V_DrawString(x, y, 0, currentMenu->menuitems[i].text);
+				/* FALLTHRU */
 			case IT_DYLITLSPACE:
 				y += SMALLLINEHEIGHT;
 				break;
@@ -3290,6 +3289,7 @@ static void M_DrawGenericMenu(void)
 			case IT_TRANSTEXT:
 				if (currentMenu->menuitems[i].alphaKey)
 					y = currentMenu->y+currentMenu->menuitems[i].alphaKey;
+				/* FALLTHRU */
 			case IT_TRANSTEXT2:
 				V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
 				y += SMALLLINEHEIGHT;
@@ -3639,6 +3639,7 @@ static void M_DrawCenteredMenu(void)
 							W_CachePatchName(currentMenu->menuitems[i].patch, PU_CACHE));
 					}
 				}
+				/* FALLTHRU */
 			case IT_NOTHING:
 			case IT_DYBIGSPACE:
 				y += LINEHEIGHT;
@@ -3696,6 +3697,7 @@ static void M_DrawCenteredMenu(void)
 					break;
 			case IT_STRING2:
 				V_DrawCenteredString(x, y, 0, currentMenu->menuitems[i].text);
+				/* FALLTHRU */
 			case IT_DYLITLSPACE:
 				y += SMALLLINEHEIGHT;
 				break;
@@ -4923,6 +4925,10 @@ static boolean M_AddonsRefresh(void)
 
 #define offs 1
 
+#ifdef __GNUC__
+#pragma GCC optimize ("0")
+#endif
+
 static void M_DrawAddons(void)
 {
 	INT32 x, y;
@@ -5044,6 +5050,10 @@ static void M_DrawAddons(void)
 #undef CANSAVE
 }
 
+#ifdef __GNUC__
+#pragma GCC reset_options
+#endif
+
 #undef offs
 
 static void M_AddonExec(INT32 ch)
@@ -6174,7 +6184,7 @@ static void M_DrawLoadGameData(void)
 				V_DrawFill(x+6, y+64, 72, 50, col);
 			}
 		}
-			
+
 		V_DrawSmallScaledPatch(x, y, 0, savselp[0]);
 		x += 2;
 		y += 1;
@@ -6206,7 +6216,7 @@ static void M_DrawLoadGameData(void)
 				else
 					patch = savselp[5];
 			}
-				
+
 			V_DrawSmallScaledPatch(x, y, flags, patch);
 
 			y += 41;
@@ -6787,7 +6797,15 @@ static void M_SetupChoosePlayer(INT32 choice)
 	SP_PlayerDef.prevMenu = currentMenu;
 	M_SetupNextMenu(&SP_PlayerDef);
 	if (!allowed)
+	{
 		char_on = firstvalid;
+		if (startchar > 0 && startchar < 32)
+		{
+			INT16 workchar = startchar;
+			while (workchar--)
+				char_on = description[char_on].next;
+		}
+	}
 	char_scroll = 0; // finish scrolling the menu
 	Z_Free(char_notes);
 	char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes);
@@ -8485,7 +8503,7 @@ static void M_HandleConnectIP(INT32 choice)
 			}
 			else if (choice >= 199 && choice <= 211 && choice != 202 && choice != 206) //numpad too!
 			{
-				XBOXSTATIC char keypad_translation[] = {'7','8','9','-','4','5','6','+','1','2','3','0','.'};
+				char keypad_translation[] = {'7','8','9','-','4','5','6','+','1','2','3','0','.'};
 				choice = keypad_translation[choice - 199];
 				S_StartSound(NULL,sfx_menu1); // Tails
 				setupm_ip[l] = (char)choice;
@@ -8751,6 +8769,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
 				COM_BufAddText (va("%s %s\n",setupm_cvdefaultname->name,setupm_name));
 				break;
 			}
+			/* FALLTHRU */
 		case KEY_RIGHTARROW:
 			if (itemOn == 1)       //player skin
 			{
@@ -9197,7 +9216,7 @@ static void M_DrawControl(void)
 
 		y += SMALLLINEHEIGHT;
 	}
-	
+
 	V_DrawScaledPatch(currentMenu->x - 20, cursory, 0,
 		W_CachePatchName("M_CURSOR", PU_CACHE));
 }
diff --git a/src/m_menu.h b/src/m_menu.h
index 813687a91744ab0af918234208ba4188fc7e47ef..9df56e897690f2044951fe85d16e96f4ee36f202 100644
--- a/src/m_menu.h
+++ b/src/m_menu.h
@@ -233,6 +233,7 @@ extern CV_PossibleValue_t gametype_cons_t[];
 
 extern INT16 startmap;
 extern INT32 ultimate_selectable;
+extern INT16 char_on, startchar;
 
 #define MAXSAVEGAMES 31 //note: last save game is "no save"
 #define NOSAVESLOT 0 //slot where Play Without Saving appears
diff --git a/src/m_misc.c b/src/m_misc.c
index d271558fb6c056c076873190b0aa824bfcc2330f..1cf244da02d96fbc86f8ec83a61a20a2a1137f70 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -58,7 +58,7 @@ typedef off_t off64_t;
 
 #if defined (_WIN32)
 #define PRIdS "Iu"
-#elif defined (_PSP) || defined (_arch_dreamcast) || defined (DJGPP) || defined (_WII) || defined (_NDS) || defined (_PS3)
+#elif defined (DJGPP)
 #define PRIdS "u"
 #else
 #define PRIdS "zu"
@@ -67,12 +67,10 @@ typedef off_t off64_t;
 #ifdef HAVE_PNG
 
 #ifndef _MSC_VER
-#ifndef _WII
 #ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #endif
-#endif
 
 #ifndef _LFS64_LARGEFILE
 #define _LFS64_LARGEFILE
@@ -191,7 +189,7 @@ INT32 M_MapNumber(char first, char second)
 // ==========================================================================
 
 // some libcs has no access function, make our own
-#if defined (_WIN32_WCE) || defined (_XBOX) || defined (_WII) || defined (_PS3)
+#if defined (_WIN32_WCE)
 int access(const char *path, int amode)
 {
 	int accesshandle = -1;
@@ -1086,7 +1084,7 @@ void M_StartMovie(void)
 				moviemode = M_StartMovieGIF(pathname);
 				break;
 			}
-			// fall thru
+			/* FALLTHRU */
 		case MM_APNG:
 			moviemode = M_StartMovieAPNG(pathname);
 			break;
diff --git a/src/m_misc.h b/src/m_misc.h
index 85d819a3cf703ed697b9941c69a53575210b3579..14f590516e3555092b1f482f64ea112001449e1e 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -40,13 +40,7 @@ void M_SaveFrame(void);
 void M_StopMovie(void);
 
 // the file where game vars and settings are saved
-#ifdef DC
-#define CONFIGFILENAME "srb2dc.cfg"
-#elif defined (PSP)
-#define CONFIGFILENAME "srb2psp.cfg"
-#else
 #define CONFIGFILENAME "config.cfg"
-#endif
 
 INT32 M_MapNumber(char first, char second);
 
diff --git a/src/md5.c b/src/md5.c
index 8031650e60666109fb8562af0ff25b94f4304ec4..66d563666059a292cc836771d793fcbc529a49c4 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -19,9 +19,7 @@
 #endif
 
 #include <string.h>
-#ifndef _WIN32_WCE
 #include <sys/types.h>
-#endif
 #ifdef _MSC_VER
 #pragma warning(disable :  4127)
 #endif
@@ -30,7 +28,7 @@
  #include <stdlib.h>
 #else
  #ifndef HAVE_MEMCPY
-  #if !((defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__)) && !defined (__APPLE__)
+  #if !(defined (_WIN32) && !defined (__CYGWIN__)) && !defined (__APPLE__)
    #define memcpy(d, s, n) bcopy ((s), (d), (n))
   #endif
  #endif
diff --git a/src/mserv.c b/src/mserv.c
index a8e43bbf8428aa5413c6c3bde6119148f7b3e5b2..e354329ed2cc016af434a70fdb7c8ece290287a3 100644
--- a/src/mserv.c
+++ b/src/mserv.c
@@ -16,9 +16,7 @@
 #include <errno.h>
 #endif
 
-#if !defined (UNDER_CE)
 #include <time.h>
-#endif
 
 #if (defined (NOMD5) || defined (NOMSERV)) && !defined (NONET)
 #define NONET
@@ -30,7 +28,7 @@
 #define HAVE_IPV6
 #endif
 
-#if (defined (_WIN32) || defined (_WIN32_WCE)) && !defined (_XBOX)
+#ifdef _WIN32
 #define RPC_NO_WINDOWS_H
 #ifdef HAVE_IPV6
 #include <ws2tcpip.h>
@@ -38,16 +36,6 @@
 #include <winsock.h>     // socket(),...
 #endif //!HAVE_IPV6
 #else
-#ifdef __OS2__
-#include <sys/types.h>
-#endif // __OS2__
-
-#ifdef HAVE_LWIP
-#include <lwip/inet.h>
-#include <kos/net.h>
-#include <lwip/lwip.h>
-#define ioctl lwip_ioctl
-#else
 #include <arpa/inet.h>
 #ifdef __APPLE_CC__
 #ifndef _BSD_SOCKLEN_T_
@@ -56,25 +44,12 @@
 #endif
 #include <sys/socket.h> // socket(),...
 #include <netinet/in.h> // sockaddr_in
-#ifdef _PS3
-#include <net/select.h>
-#elif !defined(_arch_dreamcast)
 #include <netdb.h> // getaddrinfo(),...
 #include <sys/ioctl.h>
-#endif
-#endif
-
-#ifdef _arch_dreamcast
-#include "sdl/SRB2DC/dchelp.h"
-#endif
 
 #include <sys/time.h> // timeval,... (TIMEOUT)
 #include <errno.h>
-#endif // _WIN32/_WIN32_WCE
-
-#ifdef __OS2__
-#include <errno.h>
-#endif // __OS2__
+#endif // _WIN32
 #endif // !NONET
 
 #include "doomstat.h"
@@ -91,10 +66,6 @@
 #include "m_argv.h" // Alam is going to kill me <3
 #include "m_misc.h" //  GetRevisionString()
 
-#ifdef _WIN32_WCE
-#include "sdl/SRB2CE/cehelp.h"
-#endif
-
 #include "i_addrinfo.h"
 
 // ================================ DEFINITIONS ===============================
@@ -183,13 +154,13 @@ typedef struct
 #endif
 
 // win32 or djgpp
-#if defined (_WIN32) || defined (_WIN32_WCE) || defined (__DJGPP__)
+#if defined (_WIN32) || defined (__DJGPP__)
 #define ioctl ioctlsocket
 #define close closesocket
 #ifdef WATTCP
 #define strerror strerror_s
 #endif
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
 #undef errno
 #define errno h_errno // some very strange things happen when not using h_error
 #endif
@@ -215,12 +186,12 @@ static enum { MSCS_NONE, MSCS_WAITING, MSCS_REGISTERED, MSCS_FAILED } con_state
 static INT32 msnode = -1;
 UINT16 current_port = 0;
 
-#if (defined (_WIN32) || defined (_WIN32_WCE) || defined (_WIN32)) && !defined (NONET)
+#if defined (_WIN32) && !defined (NONET)
 typedef SOCKET SOCKET_TYPE;
 #define BADSOCKET INVALID_SOCKET
 #define ERRSOCKET (SOCKET_ERROR)
 #else
-#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) || defined (_PS3)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__)
 typedef int SOCKET_TYPE;
 #else
 typedef unsigned long SOCKET_TYPE;
diff --git a/src/nds/Makefile.cfg b/src/nds/Makefile.cfg
deleted file mode 100644
index c2d915924ab55692039d67eaed070578a815f0eb..0000000000000000000000000000000000000000
--- a/src/nds/Makefile.cfg
+++ /dev/null
@@ -1,31 +0,0 @@
-# Adapted in part from devkitPRO makefiles.
-
-NOMD5=1
-
-# Check if DEVKITARM is set in the environment. If so, continue with compilation.
-.SUFFIXES:
-
-ifeq ($(strip $(DEVKITARM)),)
-$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
-endif
-
-# use absolute paths because changing PATH variable breaks distcc
-PREFIX	:= $(DEVKITARM)/bin/arm-eabi
-NDSTOOL	:= $(DEVKITARM)/bin/ndstool
-
-# Disable same warning flags
-WFLAGS+=-Wno-inline -Wno-cast-align
-WFLAGS+=-Wno-shadow -Wno-char-subscripts
-WFLAGS+=-Wno-declaration-after-statement
-WFLAGS+=-Wno-old-style-definition
-WFLAGS+=-Wno-undef
-WFLAGS+=-Wno-unsuffixed-float-constants
-
-ifndef NOHW
-	OBJS+=$(OBJDIR)/r_nds3d.o
-endif
-
-ARCH = -mthumb -mthumb-interwork
-LDFLAGS += -L$(DEVKITPRO)/libnds/lib -specs=ds_arm9.specs -g $(ARCH) -mno-fpu
-LIBS += -lfat -lnds9
-CFLAGS += -D_NDS -DARM9 -I$(DEVKITPRO)/libnds/include $(ARCH) -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math
diff --git a/src/nds/i_cdmus.c b/src/nds/i_cdmus.c
deleted file mode 100644
index f3f7036677dfb1092dc23170e64bd60cd7287619..0000000000000000000000000000000000000000
--- a/src/nds/i_cdmus.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "../command.h"
-#include "../s_sound.h"
-#include "../i_sound.h"
-
-//
-// CD MUSIC I/O
-//
-
-UINT8 cdaudio_started = 0;
-
-consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cdUpdate  = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-
-void I_InitCD(void){}
-
-void I_StopCD(void){}
-
-void I_PauseCD(void){}
-
-void I_ResumeCD(void){}
-
-void I_ShutdownCD(void){}
-
-void I_UpdateCD(void){}
-
-void I_PlayCD(UINT8 track, UINT8 looping)
-{
-	(void)track;
-	(void)looping;
-}
-
-boolean I_SetVolumeCD(int volume)
-{
-	(void)volume;
-	return false;
-}
diff --git a/src/nds/i_main.c b/src/nds/i_main.c
deleted file mode 100644
index 292a5f91dfc1ce77a52597ee5458d6548d831e92..0000000000000000000000000000000000000000
--- a/src/nds/i_main.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "../doomdef.h"
-#include "../d_main.h"
-#include "../m_argv.h"
-#include "../i_system.h"
-
-int main(int argc, char **argv)
-{
-	myargc = argc;
-	myargv = argv; /// \todo pull out path to exe from this string
-
-	CONS_Printf("I_StartupSystem...");
-	I_StartupSystem();
-
-	// startup SRB2
-	CONS_Printf("Setting up SRB2...\n");
-	D_SRB2Main();
-	CONS_Printf("Entering main game loop...\n");
-	// never return
-	D_SRB2Loop();
-
-	// return to OS
-#ifndef __GNUC__
-	return 0;
-#endif
-}
diff --git a/src/nds/i_net.c b/src/nds/i_net.c
deleted file mode 100644
index f6e642022e4a54360d68004f69d61eaa5e3acb19..0000000000000000000000000000000000000000
--- a/src/nds/i_net.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "../i_net.h"
-
-boolean I_InitNetwork(void)
-{
-	return false;
-}
diff --git a/src/nds/i_sound.c b/src/nds/i_sound.c
deleted file mode 100644
index 8dea4ad7d494ae78eba6eeefd9a6e0a3e5109184..0000000000000000000000000000000000000000
--- a/src/nds/i_sound.c
+++ /dev/null
@@ -1,150 +0,0 @@
-#include "../i_sound.h"
-
-UINT8 sound_started = 0;
-
-void *I_GetSfx(sfxinfo_t *sfx)
-{
-	(void)sfx;
-	return NULL;
-}
-
-void I_FreeSfx(sfxinfo_t *sfx)
-{
-	(void)sfx;
-}
-
-void I_StartupSound(void){}
-
-void I_ShutdownSound(void){}
-
-//
-//  SFX I/O
-//
-
-INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority)
-{
-	(void)id;
-	(void)vol;
-	(void)sep;
-	(void)pitch;
-	(void)priority;
-	return -1;
-}
-
-void I_StopSound(INT32 handle)
-{
-	(void)handle;
-}
-
-INT32 I_SoundIsPlaying(INT32 handle)
-{
-	(void)handle;
-	return false;
-}
-
-void I_UpdateSoundParams(INT32 handle, INT32 vol, INT32 sep, INT32 pitch)
-{
-	(void)handle;
-	(void)vol;
-	(void)sep;
-	(void)pitch;
-}
-
-void I_SetSfxVolume(INT32 volume)
-{
-	(void)volume;
-}
-
-//
-//  MUSIC I/O
-//
-UINT8 music_started = 0;
-
-void I_InitMusic(void){}
-
-void I_ShutdownMusic(void){}
-
-void I_PauseSong(INT32 handle)
-{
-	(void)handle;
-}
-
-void I_ResumeSong(INT32 handle)
-{
-	(void)handle;
-}
-
-//
-//  MIDI I/O
-//
-
-UINT8 midimusic_started = 0;
-
-void I_InitMIDIMusic(void){}
-
-void I_ShutdownMIDIMusic(void){}
-
-void I_SetMIDIMusicVolume(INT32 volume)
-{
-	(void)volume;
-}
-
-INT32 I_RegisterSong(void *data, size_t len)
-{
-	(void)data;
-	(void)len;
-	return -1;
-}
-
-boolean I_PlaySong(INT32 handle, INT32 looping)
-{
-	(void)handle;
-	(void)looping;
-	return false;
-}
-
-void I_StopSong(INT32 handle)
-{
-	(void)handle;
-}
-
-void I_UnRegisterSong(INT32 handle)
-{
-	(void)handle;
-}
-
-//
-//  DIGMUSIC I/O
-//
-
-UINT8 digmusic_started = 0;
-
-void I_InitDigMusic(void){}
-
-void I_ShutdownDigMusic(void){}
-
-boolean I_StartDigSong(const char *musicname, INT32 looping)
-{
-	(void)musicname;
-	(void)looping;
-	return false;
-}
-
-void I_StopDigSong(void){}
-
-void I_SetDigMusicVolume(INT32 volume)
-{
-	(void)volume;
-}
-
-boolean I_SetSongSpeed(float speed)
-{
-	(void)speed;
-	return false;
-}
-
-boolean I_SetSongTrack(int track)
-{
-	(void)track;
-	return false;
-}
diff --git a/src/nds/i_system.c b/src/nds/i_system.c
deleted file mode 100644
index 3e5c4b8c6d33fb6d266d12aad24e3d50748a9769..0000000000000000000000000000000000000000
--- a/src/nds/i_system.c
+++ /dev/null
@@ -1,286 +0,0 @@
-#include <nds.h>
-#include <fat.h>
-
-#include "../doomdef.h"
-#include "../d_main.h"
-#include "../i_system.h"
-#include "../i_joy.h"
-
-UINT8 graphics_started = 0;
-
-UINT8 keyboard_started = 0;
-
-static volatile tic_t ticcount;
-
-
-UINT32 I_GetFreeMem(UINT32 *total)
-{
-	*total = 0;
-	return 0;
-}
-
-tic_t I_GetTime(void)
-{
-	return ticcount;
-}
-
-void I_Sleep(void){}
-
-void I_GetEvent(void)
-{
-	// Mappings of DS keys to SRB2 keys
-	UINT32 dskeys[] =
-	{
-		KEY_A,
-		KEY_B,
-		KEY_X,
-		KEY_Y,
-		KEY_L,
-		KEY_R,
-		KEY_START,
-		KEY_SELECT
-	};
-
-	event_t event;
-	UINT32 held, up, down;
-	UINT32 i;
-
-	// Check how the state has changed since last time
-	scanKeys();
-
-	// For the d-pad, we only care about the current state
-	held = keysHeld();
-	event.type = ev_joystick;
-	event.data1 = 0;	// First (and only) axis set
-
-	if (held & KEY_LEFT) event.data2 = -1;
-	else if (held & KEY_RIGHT) event.data2 = 1;
-	else event.data2 = 0;
-
-	if (held & KEY_UP) event.data3 = -1;
-	else if (held & KEY_DOWN) event.data3 = 1;
-	else event.data3 = 0;
-
-	D_PostEvent(&event);
-
-	// For the buttons, we need to report changes in state
-	up = keysUp();
-	down = keysDown();
-	for (i = 0; i < sizeof(dskeys)/sizeof(dskeys[0]); i++)
-	{
-		// Has this button's state changed?
-		if ((up | down) & dskeys[i])
-		{
-			event.type = (up & dskeys[i]) ? ev_keyup : ev_keydown;
-			event.data1 = KEY_JOY1 + i;
-			D_PostEvent(&event);
-		}
-	}
-}
-
-void I_OsPolling(void)
-{
-	I_GetEvent();
-}
-
-ticcmd_t *I_BaseTiccmd(void)
-{
-	static ticcmd_t emptyticcmd;
-	return &emptyticcmd;
-}
-
-ticcmd_t *I_BaseTiccmd2(void)
-{
-	static ticcmd_t emptyticcmd2;
-	return &emptyticcmd2;
-}
-
-void I_Quit(void)
-{
-	exit(0);
-}
-
-void I_Error(const char *error, ...)
-{
-	va_list argptr;
-
-        va_start(argptr, error);
-        viprintf(error, argptr);
-        va_end(argptr);
-
-	for(;;);
-}
-
-void I_Tactile(FFType Type, const JoyFF_t *Effect)
-{
-	(void)Type;
-	(void)Effect;
-}
-
-void I_Tactile2(FFType Type, const JoyFF_t *Effect)
-{
-	(void)Type;
-	(void)Effect;
-}
-
-void I_JoyScale(void){}
-
-void I_JoyScale2(void){}
-
-void I_InitJoystick(void)
-{
-	Joystick.bGamepadStyle = true;
-}
-
-void I_InitJoystick2(void){}
-
-INT32 I_NumJoys(void)
-{
-	return 0;
-}
-
-const char *I_GetJoyName(INT32 joyindex)
-{
-	(void)joyindex;
-	return NULL;
-}
-
-void I_SetupMumble(void)
-{
-}
-
-#ifndef NOMUMBLE
-void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
-{
-	(void)mobj;
-	(void)listener;
-}
-#endif
-
-void I_OutputMsg(const char *error, ...)
-{
-	va_list argptr;
-
-	va_start(argptr, error);
-	viprintf(error, argptr);
-	va_end(argptr);
-}
-
-void I_StartupMouse(void){}
-
-void I_StartupMouse2(void){}
-
-void I_StartupKeyboard(void){}
-
-INT32 I_GetKey(void)
-{
-	return 0;
-}
-
-static void NDS_VBlankHandler(void)
-{
-	ticcount++;
-}
-
-void I_StartupTimer(void)
-{
-	irqSet(IRQ_VBLANK, NDS_VBlankHandler);
-}
-
-void I_AddExitFunc(void (*func)())
-{
-	(void)func;
-}
-
-void I_RemoveExitFunc(void (*func)())
-{
-	(void)func;
-}
-
-// Adapted in part from the devkitPro examples.
-INT32 I_StartupSystem(void)
-{
-	lcdMainOnTop();
-
-	videoSetModeSub(MODE_0_2D);
-	vramSetBankC(VRAM_C_MAIN_BG);	// Get this mapped *out* of the sub BG
-	vramSetBankI(VRAM_I_SUB_BG_0x06208000);
-
-	// The background VRAM that's mapped starts at 0x06208000.
-	// The map base is specified in an offset of multiples of 2 KB
-	// from 0x06200000, and the tile base in multiples of 16 KB.
-	// We put the tiles at the start and the map 2 KB from the end
-	// (i.e. 14 KB from the start).
-	// The map base is then at 0x0620B800 = 0x06200000 + 16 * 0x800 + 7 * 0x800,
-	// and the tile base is at 0x06208000 = 0x06200000 + 2 * 0x4000.
-	consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 16+7, 2, false, true);
-
-	// start FAT filesystem code, required for reading SD card
-	if(!fatInitDefault())
-		I_Error("Couldn't init FAT.");
-
-	return 0;
-}
-
-void I_ShutdownSystem(void){}
-
-void I_GetDiskFreeSpace(INT64* freespace)
-{
-	*freespace = 0;
-}
-
-char *I_GetUserName(void)
-{
-	return NULL;
-}
-
-INT32 I_mkdir(const char *dirname, INT32 unixright)
-{
-	(void)dirname;
-	(void)unixright;
-	return -1;
-}
-
-const CPUInfoFlags *I_CPUInfo(void)
-{
-	return NULL;
-}
-
-const char *I_LocateWad(void)
-{
-	return NULL;
-}
-
-void I_GetJoystickEvents(void){}
-
-void I_GetJoystick2Events(void){}
-
-void I_GetMouseEvents(void){}
-
-char *I_GetEnv(const char *name)
-{
-	(void)name;
-	return NULL;
-}
-
-INT32 I_PutEnv(char *variable)
-{
-	(void)variable;
-	return -1;
-}
-
-INT32 I_ClipboardCopy(const char *data, size_t size)
-{
-	(void)data;
-	(void)size;
-	return -1;
-}
-
-char *I_ClipboardPaste(void)
-{
-	return NULL;
-}
-
-void I_RegisterSysCommands(void) {}
-
-#include "../sdl/dosstr.c"
diff --git a/src/nds/i_video.c b/src/nds/i_video.c
deleted file mode 100644
index 3dfb995574b1804ff0be222f8d771e888b3d1047..0000000000000000000000000000000000000000
--- a/src/nds/i_video.c
+++ /dev/null
@@ -1,148 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SRB2 graphics stuff for NDS
-
-
-#include "../doomdef.h"
-#include "../command.h"
-#include "../i_video.h"
-
-#include "../hardware/hw_drv.h"
-#include "../hardware/hw_main.h"
-#include "r_nds3d.h"
-
-rendermode_t rendermode = render_opengl;
-
-boolean highcolor = false;
-
-boolean allow_fullscreen = false;
-
-consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-void I_StartupGraphics(void)
-{
-	vid.width = 256;
-	vid.height = 192;
-	vid.bpp = 1;
-	vid.rowbytes = vid.width * vid.bpp;
-	vid.recalc = true;
-
-	HWD.pfnInit             = NDS3D_Init;
-	HWD.pfnShutdown         = NDS3D_Shutdown;
-	HWD.pfnFinishUpdate     = NDS3D_FinishUpdate;
-	HWD.pfnDraw2DLine       = NDS3D_Draw2DLine;
-	HWD.pfnDrawPolygon      = NDS3D_DrawPolygon;
-	HWD.pfnSetBlend         = NDS3D_SetBlend;
-	HWD.pfnClearBuffer      = NDS3D_ClearBuffer;
-	HWD.pfnSetTexture       = NDS3D_SetTexture;
-	HWD.pfnReadRect         = NDS3D_ReadRect;
-	HWD.pfnGClipRect        = NDS3D_GClipRect;
-	HWD.pfnClearMipMapCache = NDS3D_ClearMipMapCache;
-	HWD.pfnSetSpecialState  = NDS3D_SetSpecialState;
-	HWD.pfnSetPalette       = NDS3D_SetPalette;
-	HWD.pfnGetTextureUsed   = NDS3D_GetTextureUsed;
-	HWD.pfnDrawMD2          = NDS3D_DrawMD2;
-	HWD.pfnDrawMD2i         = NDS3D_DrawMD2i;
-	HWD.pfnSetTransform     = NDS3D_SetTransform;
-	HWD.pfnGetRenderVersion = NDS3D_GetRenderVersion;
-
-	videoSetMode(MODE_0_3D);
-	vramSetBankA(VRAM_A_TEXTURE);
-	vramSetBankB(VRAM_B_TEXTURE);
-	vramSetBankC(VRAM_C_TEXTURE);
-	vramSetBankD(VRAM_D_TEXTURE);
-	vramSetBankE(VRAM_E_TEX_PALETTE);
-
-	glInit();
-
-	glEnable(GL_TEXTURE_2D);
-
-	glClearColor(16,16,16,31);
-	glClearPolyID(63);
-	glClearDepth(0x7FFF);
-
-	glViewport(0, 0, vid.width - 1, vid.height - 1);
-
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	gluPerspective(fov, ASPECT_RATIO, NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();
-	glScalef(1.0f, 1.0f, -1.0f);
-
-	HWD.pfnInit(I_Error);
-	HWR_Startup();
-}
-
-void I_ShutdownGraphics(void){}
-
-void I_SetPalette(RGBA_t *palette)
-{
-	(void)palette;
-}
-
-INT32 VID_NumModes(void)
-{
-	return 0;
-}
-
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
-{
-	(void)w;
-	(void)h;
-	return 0;
-}
-
-void VID_PrepareModeList(void){}
-
-INT32 VID_SetMode(INT32 modenum)
-{
-	(void)modenum;
-	return 0;
-}
-
-const char *VID_GetModeName(INT32 modenum)
-{
-	(void)modenum;
-	return NULL;
-}
-
-void I_UpdateNoBlit(void){}
-
-void I_FinishUpdate(void)
-{
-	HWD.pfnFinishUpdate(true);
-}
-
-void I_UpdateNoVsync(void) {}
-
-void I_WaitVBL(INT32 count)
-{
-	(void)count;
-}
-
-void I_ReadScreen(UINT8 *scr)
-{
-	(void)scr;
-}
-
-void I_BeginRead(void){}
-
-void I_EndRead(void){}
diff --git a/src/nds/r_nds3d.c b/src/nds/r_nds3d.c
deleted file mode 100644
index dbdcec158c1d64ac2da05b4a4b52fb0535d4d40a..0000000000000000000000000000000000000000
--- a/src/nds/r_nds3d.c
+++ /dev/null
@@ -1,389 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief NDS 3D API for SRB2.
-//
-// In an ideal world, we would share as much code as possible with r_opengl.c,
-// but this will do for now.
-
-#include "../doomtype.h"
-#include "../hardware/hw_defs.h"
-#include "../hardware/hw_dll.h"
-#include "../hardware/hw_md2.h"
-#include "r_nds3d.h"
-
-static I_Error_t I_Error_GL = NULL;
-
-#define NOTEXTURE_NUM     0     // small white texture
-#define FIRST_TEX_AVAIL   (NOTEXTURE_NUM + 1)
-#define MAX_SRB2_TEXTURES      256
-
-FCOORD NEAR_CLIPPING_PLANE = 0.9f;
-float fov = 90.0f;
-
-static FBITFIELD CurrentPolyFlags = 0xFFFFFFFF;
-static UINT32 CurrentGLPolyFmt = POLY_CULL_NONE;
-static UINT8 CurrentPolyAlpha = 31;
-static UINT16 myPaletteData[256];
-static FTextureInfo* gr_cachetail = NULL;
-static FTextureInfo* gr_cachehead = NULL;
-static INT32 NextTexAvail = FIRST_TEX_AVAIL;
-static UINT32 tex_downloaded = 0;
-static INT32 texids[MAX_SRB2_TEXTURES];
-static boolean scalehack = false;
-
-
-static void GenerateTextureNames(void)
-{
-	glGenTextures(MAX_SRB2_TEXTURES - 1, texids + 1);
-	texids[NOTEXTURE_NUM] = 0;
-}
-
-static void Flush(void)
-{
-	// Delete all textures at once, since libnds's glDeleteTextures seems to be buggy.
-	glResetTextures();
-	GenerateTextureNames();
-	while (gr_cachehead)
-	{
-		gr_cachehead->downloaded = 0;
-		gr_cachehead = gr_cachehead->nextmipmap;
-	}
-	gr_cachetail = gr_cachehead = NULL;
-	NextTexAvail = FIRST_TEX_AVAIL;
-	tex_downloaded = 0;
-}
-
-static void SetNoTexture(void)
-{
-	// Set small white texture.
-	if (tex_downloaded != NOTEXTURE_NUM)
-	{
-		glBindTexture(GL_TEXTURE_2D, texids[NOTEXTURE_NUM]);
-		tex_downloaded = NOTEXTURE_NUM;
-	}
-}
-
-
-static void SetAlpha(UINT8 alpha)
-{
-	CurrentPolyAlpha = alpha >> 3;
-	glPolyFmt(CurrentGLPolyFmt | POLY_ALPHA(CurrentPolyAlpha));
-}
-
-
-
-boolean NDS3D_Init(I_Error_t ErrorFunction)
-{
-	I_Error_GL = ErrorFunction;
-	glPolyFmt(CurrentGLPolyFmt | POLY_ALPHA(CurrentPolyAlpha));
-	GenerateTextureNames();
-	return true;
-}
-
-void NDS3D_Shutdown(void) {}
-
-void NDS3D_SetPalette(RGBA_t *ppal, RGBA_t *pgamma)
-{
-	INT32 i;
-
-	for (i = 0; i < 256; i++)
-	{
-		UINT8 red   = (UINT8)min((ppal[i].s.red*pgamma->s.red)/127,     255) >> 3;
-		UINT8 green = (UINT8)min((ppal[i].s.green*pgamma->s.green)/127, 255) >> 3;
-		UINT8 blue  = (UINT8)min((ppal[i].s.blue*pgamma->s.blue)/127,   255) >> 3;
-
-		myPaletteData[i] = ARGB16(ppal[i].s.alpha ? 1 : 0, red, green, blue);
-	}
-
-	Flush();
-}
-
-void NDS3D_FinishUpdate(INT32 waitvbl)
-{
-	(void)waitvbl;
-
-	glFlush(0);
-}
-
-void NDS3D_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color)
-{
-	(void)v1;
-	(void)v2;
-	(void)Color;
-}
-
-void NDS3D_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
-{
-	FUINT i;
-
-	NDS3D_SetBlend(PolyFlags);
-
-	// If Modulated, mix the surface colour to the texture
-	if ((CurrentPolyFlags & PF_Modulated) && pSurf)
-	{
-		glColor3b(pSurf->FlatColor.s.red, pSurf->FlatColor.s.green, pSurf->FlatColor.s.blue);
-		SetAlpha(pSurf->FlatColor.s.alpha);
-	}
-
-	// libnds doesn't have GL_TRIANGLE_FAN, so use GL_TRIANGLE_STRIP instead
-	glBegin(GL_TRIANGLE_STRIP);
-	for (i = 0; i < iNumPts; i++)
-	{
-		FUINT index = (i & 1) ? (i >> 1) : (iNumPts - 1 - (i >> 1));
-		FLOAT x, y, z;
-
-		if (scalehack)
-		{
-			x = pOutVerts[index].x/4096.0f;
-			y = pOutVerts[index].y/4096.0f;
-			z = pOutVerts[index].z/4096.0f;
-		}
-		else
-		{
-			x = pOutVerts[index].x;
-			y = pOutVerts[index].y;
-			z = pOutVerts[index].z;
-		}
-
-		glTexCoord2f(pOutVerts[index].sow, pOutVerts[index].tow);
-		glVertex3f(x,y,z);
-	}
-	glEnd();
-}
-
-void NDS3D_SetBlend(FBITFIELD PolyFlags)
-{
-	FBITFIELD Xor = PolyFlags ^ CurrentPolyFlags;
-
-	if (Xor & (PF_NoTexture|PF_Modulated))
-	{
-		if (Xor&PF_Modulated)
-		{
-			if(!(PolyFlags & PF_Modulated))
-			{
-				glColor3b(255, 255, 255);
-				CurrentPolyAlpha = 31;
-			}
-		}
-
-		if (PolyFlags & PF_NoTexture)
-		{
-			SetNoTexture();
-		}
-	}
-
-	CurrentPolyFlags = PolyFlags;
-	glPolyFmt(CurrentGLPolyFmt | POLY_ALPHA(CurrentPolyAlpha));
-}
-
-void NDS3D_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor)
-{
-	(void)ClearColor;
-
-	if (ColorMask && ClearColor)
-	{
-		// TODO: Fixed-ify
-		glClearColor((uint8)(ClearColor->red*31),
-			(uint8)(ClearColor->green*31),
-			(uint8)(ClearColor->blue*31),
-			(uint8)(ClearColor->alpha*31));
-	}
-
-	if (DepthMask)
-		glClearDepth(GL_MAX_DEPTH);
-
-	NDS3D_SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
-}
-
-void NDS3D_SetTexture(FTextureInfo *TexInfo)
-{
-	if (!TexInfo)
-	{
-		SetNoTexture();
-		return;
-	}
-	else if (TexInfo->downloaded)
-	{
-		if (TexInfo->downloaded != tex_downloaded)
-		{
-			glBindTexture(GL_TEXTURE_2D, texids[TexInfo->downloaded]);
-			tex_downloaded = TexInfo->downloaded;
-		}
-	}
-	else if (TexInfo->grInfo.data)
-	{
-		UINT8 wtype, htype;
-		INT32 texparam = GL_TEXTURE_COLOR0_TRANSPARENT;
-
-		// We rely on the numerical values of GL_TEXTURE_SIZE_ENUM here.
-		wtype = TEXTURE_SIZE_8;
-		while(TexInfo->width > 1 << (wtype + 3)) wtype++;
-
-		htype = TEXTURE_SIZE_8;
-		while(TexInfo->height > 1 << (htype + 3)) htype++;
-
-		TexInfo->downloaded = NextTexAvail++;
-		tex_downloaded = TexInfo->downloaded;
-		glBindTexture(GL_TEXTURE_2D, texids[TexInfo->downloaded]);
-
-		if(!glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB256, wtype, htype, 0, TEXGEN_TEXCOORD, TexInfo->grInfo.data))
-		{
-			// HACK: If we're out of memory, flush and try again.
-			// This will result in artefacts for one frame.
-			Flush();
-			TexInfo->downloaded = 0;
-			NDS3D_SetTexture(TexInfo);
-			return;
-		}
-
-		if (TexInfo->downloaded > FIRST_TEX_AVAIL)
-		{
-			// We already have a texture using the palette, so it's already in VRAM
-			glAssignColorTable(GL_TEXTURE_2D, texids[FIRST_TEX_AVAIL]);
-		}
-		else
-		{
-			// Generate the palette in hardware
-			glColorTableEXT(0, 0, 256, 0, 0, myPaletteData);
-		}
-
-		if (TexInfo->flags & TF_WRAPX)
-			texparam |= GL_TEXTURE_WRAP_S;
-
-		if (TexInfo->flags & TF_WRAPY)
-			texparam |= GL_TEXTURE_WRAP_T;
-
-		glTexParameter(0, texparam);
-
-		TexInfo->nextmipmap = NULL;
-		if (gr_cachetail)
-		{
-			gr_cachetail->nextmipmap = TexInfo;
-			gr_cachetail = TexInfo;
-		}
-		else
-			gr_cachetail = gr_cachehead = TexInfo;
-	}
-}
-
-void NDS3D_ReadRect(INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data)
-{
-	(void)x;
-	(void)y;
-	(void)width;
-	(void)height;
-	(void)dst_stride;
-	(void)dst_data;
-}
-
-void NDS3D_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip)
-{
-	(void)minx;
-	(void)miny;
-	(void)maxx;
-	(void)maxy;
-	//glViewport(minx, vid.height-maxy, maxx-minx, maxy-miny);
-	NEAR_CLIPPING_PLANE = nearclip;
-
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-	gluPerspective(fov, ASPECT_RATIO, NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-	glMatrixMode(GL_MODELVIEW);
-}
-
-void NDS3D_ClearMipMapCache(void) {}
-
-void NDS3D_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
-{
-	(void)IdState;
-	(void)Value;
-}
-
-void NDS3D_DrawMD2(INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale)
-{
-	(void)gl_cmd_buffer;
-	(void)frame;
-	(void)pos;
-	(void)scale;
-}
-
-void NDS3D_DrawMD2i(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color)
-{
-	(void)gl_cmd_buffer;
-	(void)frame;
-	(void)duration;
-	(void)tics;
-	(void)nextframe;
-	(void)pos;
-	(void)scale;
-	(void)flipped;
-	(void)color;
-}
-
-void NDS3D_SetTransform(FTransform *ptransform)
-{
-	static INT32 special_splitscreen;
-	glLoadIdentity();
-	if (ptransform)
-	{
-		scalehack = true;
-
-		glScalef(ptransform->scalex*4096.0f, ptransform->scaley*4096.0f, -ptransform->scalez*4096.0f);
-		glRotatef(ptransform->anglex       , 1.0f, 0.0f, 0.0f);
-		glRotatef(ptransform->angley+270.0f, 0.0f, 1.0f, 0.0f);
-		glTranslatef(-ptransform->x/4096.0f, -ptransform->z/4096.0f, -ptransform->y/4096.0f);
-
-		glMatrixMode(GL_PROJECTION);
-		glLoadIdentity();
-		special_splitscreen = (ptransform->splitscreen && ptransform->fovxangle == 90.0f);
-		if (special_splitscreen)
-			gluPerspective(53.13l, 2*ASPECT_RATIO,  // 53.13 = 2*atan(0.5)
-			                NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-		else
-			gluPerspective(ptransform->fovxangle, ASPECT_RATIO, NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-
-		glMatrixMode(GL_MODELVIEW);
-	}
-	else
-	{
-		scalehack = false;
-
-		glScalef(1.0f, 1.0f, -1.0f);
-
-		glMatrixMode(GL_PROJECTION);
-		glLoadIdentity();
-		if (special_splitscreen)
-			gluPerspective(53.13l, 2*ASPECT_RATIO,  // 53.13 = 2*atan(0.5)
-			                NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-		else
-			//Hurdler: is "fov" correct?
-			gluPerspective(fov, ASPECT_RATIO, NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);
-
-		glMatrixMode(GL_MODELVIEW);
-	}
-}
-
-INT32 NDS3D_GetTextureUsed(void)
-{
-	return 0;
-}
-
-INT32 NDS3D_GetRenderVersion(void)
-{
-	return 0;
-}
diff --git a/src/nds/r_nds3d.h b/src/nds/r_nds3d.h
deleted file mode 100644
index 3a7075bcded94fe550a12f54c2fe952d61a5bb7d..0000000000000000000000000000000000000000
--- a/src/nds/r_nds3d.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief NDS 3D API for SRB2.
-
-#ifndef __R_NDS3D__
-#define __R_NDS3D__
-
-#include "../doomtype.h"
-#include "../hardware/hw_defs.h"
-#include "../hardware/hw_dll.h"
-#include "../hardware/hw_md2.h"
-
-#define FAR_CLIPPING_PLANE 150000.0f
-#define ASPECT_RATIO 1.0f
-
-typedef float FCOORD;
-
-extern FCOORD NEAR_CLIPPING_PLANE;
-extern float fov;
-
-boolean NDS3D_Init(I_Error_t ErrorFunction);
-void NDS3D_Shutdown(void);
-void NDS3D_SetPalette(RGBA_t *ppal, RGBA_t *pgamma);
-void NDS3D_FinishUpdate(INT32 waitvbl);
-void NDS3D_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
-void NDS3D_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
-void NDS3D_SetBlend(FBITFIELD PolyFlags);
-void NDS3D_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
-void NDS3D_SetTexture(FTextureInfo *TexInfo);
-void NDS3D_ReadRect(INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data);
-void NDS3D_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
-void NDS3D_ClearMipMapCache(void);
-void NDS3D_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
-void NDS3D_DrawMD2(INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransform *pos, float scale);
-void NDS3D_DrawMD2i(INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 duration, UINT32 tics, md2_frame_t *nextframe, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
-void NDS3D_SetTransform(FTransform *ptransform);
-INT32 NDS3D_GetTextureUsed(void);
-INT32 NDS3D_GetRenderVersion(void);
-
-#endif
diff --git a/src/p_ceilng.c b/src/p_ceilng.c
index db30b5cac4701cf1faae7a66f52c050145c6c0d7..27d7394147c553ce7bf82fe2cd910dbbb80a3757 100644
--- a/src/p_ceilng.c
+++ b/src/p_ceilng.c
@@ -79,7 +79,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
 							P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL);
 						if (ceiling->texture > -1) // flat changing
 							ceiling->sector->ceilingpic = ceiling->texture;
-						// don't break
+						/* FALLTHRU */
 					case raiseToHighest:
 //					case raiseCeilingByLine:
 					case moveCeilingByFrontTexture:
@@ -182,6 +182,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
 					// except generalized ones, reset speed, start back up
 					case crushAndRaise:
 						ceiling->speed = CEILSPEED;
+						/* FALLTHRU */
 					case fastCrushAndRaise:
 						ceiling->direction = 1;
 						break;
@@ -200,6 +201,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
 						if (ceiling->texture > -1) // flat changing
 							ceiling->sector->ceilingpic = ceiling->texture;
 						// don't break
+						/* FALLTHRU */
 
 					// in all other cases, just remove the active ceiling
 					case lowerAndCrush:
@@ -427,6 +429,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
 			case crushAndRaise:
 				ceiling->crush = true;
 				ceiling->topheight = sec->ceilingheight;
+				/* FALLTHRU */
 			case lowerAndCrush:
 				ceiling->bottomheight = sec->floorheight;
 				ceiling->bottomheight += 4*FRACUNIT;
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 1f5b902d42796827cc5160a8b8fadfe7f2ff8fd4..c8bb0cfec48eb307a16e3bbe324891b84bf82924 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -244,6 +244,7 @@ void A_FlickyCheck(mobj_t *actor);
 void A_FlickyHeightCheck(mobj_t *actor);
 void A_FlickyFlutter(mobj_t *actor);
 void A_FlameParticle(mobj_t *actor);
+void A_FadeOverlay(mobj_t *actor);
 
 //
 // ENEMY THINKING
@@ -4824,9 +4825,11 @@ void A_UnidusBall(mobj_t *actor)
 		case 0: // at least one frame where not dashing
 			if (!skull) ++actor->extravalue2;
 			else break;
+			/* FALLTHRU */
 		case 1: // at least one frame where ARE dashing
 			if (skull) ++actor->extravalue2;
 			else break;
+			/* FALLTHRU */
 		case 2: // not dashing again?
 			if (skull) break;
 			// launch.
@@ -6065,7 +6068,7 @@ void A_Boss7Chase(mobj_t *actor)
 					break;
 				}
 				actor->threshold++;
-				// fall into...
+				/* FALLTHRU */
 			case 1: // Chaingun Goop
 				A_FaceTarget(actor);
 				P_SetMobjState(actor, S_BLACKEGG_SHOOT1);
@@ -10187,7 +10190,7 @@ void A_FlickyAim(mobj_t *actor)
 	{
 		angle_t posvar;
 		fixed_t chasevar, chasex, chasey;
-		
+
 		if (flickyhitwall)
 			actor->movedir *= -1;
 
@@ -10490,3 +10493,39 @@ void A_FlameParticle(mobj_t *actor)
 		type);
 	P_SetObjectMomZ(particle, locvar1<<FRACBITS, false);
 }
+
+// Function: A_FadeOverlay
+//
+// Description: Makes a pretty overlay (primarily for super/NiGHTS transformation).
+//
+// var1 = bit 1 = don't halt momentum, bit 2 = don't make fast, bit 3 = don't set tracer
+// var2 = unused
+//
+void A_FadeOverlay(mobj_t *actor)
+{
+	mobj_t *fade;
+	INT32 locvar1 = var1;
+	//INT32 locvar2 = var2;
+
+#ifdef HAVE_BLUA
+	if (LUA_CallAction("A_FadeOverlay", actor))
+		return;
+#endif
+
+	if (!(locvar1 & 1))
+		actor->momx = actor->momy = actor->momz = 0;
+
+	fade = P_SpawnGhostMobj(actor);
+	fade->frame = actor->frame;
+
+	if (!(locvar1 & 2))
+	{
+		fade->fuse = 15;
+		fade->flags2 |= MF2_BOSSNOTRAP;
+	}
+	else
+		fade->fuse = 20;
+
+	if (!(locvar1 & 4))
+		P_SetTarget(&actor->tracer, fade);
+}
diff --git a/src/p_floor.c b/src/p_floor.c
index ef94bb95d8a648480a4ab47176a1f7c03fba41ff..c72de6b7030ba0dbb1922188431f524230e9b5f9 100644
--- a/src/p_floor.c
+++ b/src/p_floor.c
@@ -316,6 +316,7 @@ void T_MoveFloor(floormove_t *movefloor)
 				case moveFloorByFrontSector:
 					if (movefloor->texture < -1) // chained linedef executing
 						P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL);
+					/* FALLTHRU */
 				case instantMoveFloorByFrontSector:
 					if (movefloor->texture > -1) // flat changing
 						movefloor->sector->floorpic = movefloor->texture;
@@ -364,6 +365,7 @@ void T_MoveFloor(floormove_t *movefloor)
 				case moveFloorByFrontSector:
 					if (movefloor->texture < -1) // chained linedef executing
 						P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL);
+					/* FALLTHRU */
 				case instantMoveFloorByFrontSector:
 					if (movefloor->texture > -1) // flat changing
 						movefloor->sector->floorpic = movefloor->texture;
@@ -1749,6 +1751,7 @@ static mobj_t *SearchMarioNode(msecnode_t *node)
 		{
 		case MT_NULL:
 		case MT_UNKNOWN:
+		case MT_TAILSOVERLAY:
 		case MT_THOK:
 		case MT_GHOST:
 		case MT_OVERLAY:
diff --git a/src/p_inter.c b/src/p_inter.c
index 380483009c414f47ab16f3c3a1fa7c0f77129742..ba27dab633b7db7170b64ea9500d9fdd0993d188 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -483,9 +483,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
 		case MT_REDTEAMRING:
 			if (player->ctfteam != 1)
 				return;
+			/* FALLTHRU */
 		case MT_BLUETEAMRING: // Yes, I'm lazy. Oh well, deal with it.
 			if (special->type == MT_BLUETEAMRING && player->ctfteam != 2)
 				return;
+			/* FALLTHRU */
 		case MT_RING:
 		case MT_FLINGRING:
 			if (!(P_CanPickupItem(player, false)))
@@ -3390,7 +3392,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
 				P_SetMobjState(target, target->info->meleestate); // go to pinch pain state
 				break;
 			}
-			// fallthrough
+			/* FALLTHRU */
 		default:
 			P_SetMobjState(target, target->info->painstate);
 			break;
diff --git a/src/p_mobj.c b/src/p_mobj.c
index be7ce53f2c69af9b1fdb51c7c60504466148a84f..42e0778a64da1fc1281961413bad44fd739b3a7b 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -322,7 +322,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
 		mobj->tics = st->tics;
 
 		// Adjust the player's animation speed to match their velocity.
-		if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE))
+		if (state == S_PLAY_STND && player->powers[pw_super] && skins[player->skin].sprites[SPR2_WAIT|FF_SPR2SUPER].numframes == 0) // if no super wait, don't wait at all
+			mobj->tics = -1;
+		else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE))
 			mobj->tics = 2;
 		else if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST))
 		{
@@ -6646,10 +6648,21 @@ void P_MobjThinker(mobj_t *mobj)
 			}
 	}
 
-	if ((mobj->type == MT_GHOST || mobj->type == MT_THOK) && mobj->fuse > 0 // Not guaranteed to be MF_SCENERY or not MF_SCENERY!
-	&& (signed)(mobj->frame >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - mobj->fuse / 2)
-		// fade out when nearing the end of fuse...
-		mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
+	if ((mobj->type == MT_GHOST || mobj->type == MT_THOK) && mobj->fuse > 0) // Not guaranteed to be MF_SCENERY or not MF_SCENERY!
+	{
+		if (mobj->flags2 & MF2_BOSSNOTRAP) // "fast" flag
+		{
+			if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - (2*mobj->fuse)/3)
+				// fade out when nearing the end of fuse...
+				mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - (2*mobj->fuse)/3) << FF_TRANSSHIFT);
+		}
+		else
+		{
+			if ((signed)((mobj->frame & FF_TRANSMASK) >> FF_TRANSSHIFT) < (NUMTRANSMAPS-1) - mobj->fuse / 2)
+				// fade out when nearing the end of fuse...
+				mobj->frame = (mobj->frame & ~FF_TRANSMASK) | (((NUMTRANSMAPS-1) - mobj->fuse / 2) << FF_TRANSSHIFT);
+		}
+	}
 
 	if (mobj->flags2 & MF2_MACEROTATE)
 	{
@@ -6781,6 +6794,7 @@ void P_MobjThinker(mobj_t *mobj)
 					whoosh->momz = mobj->target->momz; // Stay reasonably centered for a few frames
 					mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh
 				}
+				/* FALLTHRU */
 			case MT_FLAMEAURA_ORB:
 				if (!(mobj->flags2 & MF2_SHIELD))
 					return;
@@ -6889,9 +6903,9 @@ void P_MobjThinker(mobj_t *mobj)
 				P_SetScale(mobj, mobj->target->scale);
 
 				if (!(mobj->eflags & MFE_VERTICALFLIP))
-					mobj->z = mobj->target->z + mobj->target->height + FixedMul((16 + abs((leveltime % TICRATE) - TICRATE/2))*FRACUNIT, mobj->target->scale);
+					mobj->z = mobj->target->z + mobj->target->height + FixedMul((16 + abs((signed)(leveltime % TICRATE) - TICRATE/2))*FRACUNIT, mobj->target->scale);
 				else
-					mobj->z = mobj->target->z - FixedMul((16 + abs((leveltime % TICRATE) - TICRATE/2))*FRACUNIT, mobj->target->scale) - mobj->height;
+					mobj->z = mobj->target->z - FixedMul((16 + abs((signed)(leveltime % TICRATE) - TICRATE/2))*FRACUNIT, mobj->target->scale) - mobj->height;
 				break;
 			case MT_DROWNNUMBERS:
 				if (!mobj->target)
@@ -7268,7 +7282,7 @@ void P_MobjThinker(mobj_t *mobj)
 			break;
 		case MT_AQUABUZZ:
 			P_MobjCheckWater(mobj); // solely for MFE_UNDERWATER for A_FlickySpawn
-			// no break here on purpose
+			/* FALLTHRU */
 		case MT_BIGAIRMINE:
 			{
 				if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0
@@ -7752,7 +7766,7 @@ void P_MobjThinker(mobj_t *mobj)
 				else
 					mobj->z = mobj->floorz;
 			}
-			// THERE IS NO BREAK HERE ON PURPOSE
+			/* FALLTHRU */
 		default:
 			// check mobj against possible water content, before movement code
 			P_MobjCheckWater(mobj);
@@ -8789,6 +8803,7 @@ void P_PrecipitationEffects(void)
 	{
 		case PRECIP_RAIN: // no lightning or thunder whatsoever
 			sounds_thunder = false;
+			/* FALLTHRU */
 		case PRECIP_STORM_NOSTRIKES: // no lightning strikes specifically
 			effects_lightning = false;
 			break;
@@ -9829,7 +9844,7 @@ ML_EFFECT4 : Don't clip inside the ground
 			mmin = mnumspokes;
 
 		// Make the links the same type as the end - repeated below
-		if ((mobj->type != MT_CHAINPOINT) && (!(lines[line].flags & ML_EFFECT2) == (mobj->type == MT_FIREBARPOINT))) // exclusive or
+		if ((mobj->type != MT_CHAINPOINT) && ((lines[line].flags & ML_EFFECT2) != (mobj->type == MT_FIREBARPOINT))) // exclusive or
 		{
 			linktype = macetype;
 			radiusfactor = 2; // Double the radius.
@@ -11311,4 +11326,4 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
 	newmobj->destscale = mobj->destscale;
 	P_SetScale(newmobj, mobj->scale);
 	return newmobj;
-}
\ No newline at end of file
+}
diff --git a/src/p_saveg.c b/src/p_saveg.c
index 497017f10108185cd4e0f8ba101339449cf30606..bb89b643aec32c7596d9321836202ed09193fd20 100644
--- a/src/p_saveg.c
+++ b/src/p_saveg.c
@@ -56,6 +56,7 @@ typedef enum
 	AWAYVIEW   = 0x08,
 	FIRSTAXIS  = 0x10,
 	SECONDAXIS = 0x20,
+	FOLLOW     = 0x40,
 } player_saveflags;
 
 //
@@ -220,6 +221,9 @@ static void P_NetArchivePlayers(void)
 		if (players[i].axis2)
 			flags |= SECONDAXIS;
 
+		if (players[i].followmobj)
+			flags |= FOLLOW;
+
 		WRITEINT16(save_p, players[i].lastsidehit);
 		WRITEINT16(save_p, players[i].lastlinehit);
 
@@ -245,6 +249,9 @@ static void P_NetArchivePlayers(void)
 		if (flags & AWAYVIEW)
 			WRITEUINT32(save_p, players[i].awayviewmobj->mobjnum);
 
+		if (flags & FOLLOW)
+			WRITEUINT32(save_p, players[i].followmobj->mobjnum);
+
 		WRITEFIXED(save_p, players[i].camerascale);
 		WRITEFIXED(save_p, players[i].shieldscale);
 
@@ -254,6 +261,7 @@ static void P_NetArchivePlayers(void)
 		WRITEUINT32(save_p, (UINT32)players[i].thokitem);
 		WRITEUINT32(save_p, (UINT32)players[i].spinitem);
 		WRITEUINT32(save_p, (UINT32)players[i].revitem);
+		WRITEUINT32(save_p, (UINT32)players[i].followitem);
 		WRITEFIXED(save_p, players[i].actionspd);
 		WRITEFIXED(save_p, players[i].mindash);
 		WRITEFIXED(save_p, players[i].maxdash);
@@ -413,6 +421,9 @@ static void P_NetUnArchivePlayers(void)
 		if (flags & AWAYVIEW)
 			players[i].awayviewmobj = (mobj_t *)(size_t)READUINT32(save_p);
 
+		if (flags & FOLLOW)
+			players[i].followmobj = (mobj_t *)(size_t)READUINT32(save_p);
+
 		players[i].viewheight = cv_viewheight.value<<FRACBITS;
 
 		players[i].camerascale = READFIXED(save_p);
@@ -425,6 +436,7 @@ static void P_NetUnArchivePlayers(void)
 		players[i].thokitem = (mobjtype_t)READUINT32(save_p);
 		players[i].spinitem = (mobjtype_t)READUINT32(save_p);
 		players[i].revitem = (mobjtype_t)READUINT32(save_p);
+		players[i].followitem = (mobjtype_t)READUINT32(save_p);
 		players[i].actionspd = READFIXED(save_p);
 		players[i].mindash = READFIXED(save_p);
 		players[i].maxdash = READFIXED(save_p);
@@ -1670,12 +1682,18 @@ static inline void SaveWhatThinker(const thinker_t *th, const UINT8 type)
 static void P_NetArchiveThinkers(void)
 {
 	const thinker_t *th;
+	UINT32 numsaved = 0;
 
 	WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS);
 
 	// save off the current thinkers
 	for (th = thinkercap.next; th != &thinkercap; th = th->next)
 	{
+		if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed
+		 || th->function.acp1 == (actionf_p1)P_RainThinker
+		 || th->function.acp1 == (actionf_p1)P_SnowThinker))
+			numsaved++;
+
 		if (th->function.acp1 == (actionf_p1)P_MobjThinker)
 		{
 			SaveMobjThinker(th, tc_mobj);
@@ -1869,6 +1887,8 @@ static void P_NetArchiveThinkers(void)
 #endif
 	}
 
+	CONS_Debug(DBG_NETPLAY, "%u thinkers saved\n", numsaved);
+
 	WRITEUINT8(save_p, tc_end);
 }
 
@@ -2656,6 +2676,7 @@ static void P_NetUnArchiveThinkers(void)
 	UINT8 tclass;
 	UINT8 restoreNum = false;
 	UINT32 i;
+	UINT32 numloaded = 0;
 
 	if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS)
 		I_Error("Bad $$$.sav at archive block Thinkers");
@@ -2689,6 +2710,7 @@ static void P_NetUnArchiveThinkers(void)
 
 		if (tclass == tc_end)
 			break; // leave the saved thinker reading loop
+		numloaded++;
 
 		switch (tclass)
 		{
@@ -2844,6 +2866,8 @@ static void P_NetUnArchiveThinkers(void)
 		}
 	}
 
+	CONS_Debug(DBG_NETPLAY, "%u thinkers loaded\n", numloaded);
+
 	if (restoreNum)
 	{
 		executor_t *delay = NULL;
@@ -3048,6 +3072,13 @@ static void P_RelinkPointers(void)
 				if (!P_SetTarget(&mobj->player->awayviewmobj, P_FindNewPosition(temp)))
 					CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type);
 			}
+			if (mobj->player && mobj->player->followmobj)
+			{
+				temp = (UINT32)(size_t)mobj->player->followmobj;
+				mobj->player->followmobj = NULL;
+				if (!P_SetTarget(&mobj->player->followmobj, P_FindNewPosition(temp)))
+					CONS_Debug(DBG_GAMELOGIC, "followmobj not found on %d\n", mobj->type);
+			}
 		}
 	}
 }
diff --git a/src/p_setup.c b/src/p_setup.c
index 6f52ed6004a0ef919991d3710de7c42183696bdf..4f337dba49f88e66425715438ba76e887f821b8b 100644
--- a/src/p_setup.c
+++ b/src/p_setup.c
@@ -65,7 +65,7 @@
 #include "lua_script.h"
 #include "lua_hook.h"
 
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
 #include <malloc.h>
 #include <math.h>
 #endif
@@ -2549,7 +2549,7 @@ static boolean CanSaveLevel(INT32 mapnum)
 	if (G_IsSpecialStage(mapnum) // don't save in special stages
 		|| mapnum == lastmaploaded) // don't save if the last map loaded was this one
 		return false;
-	
+
 	// Any levels that have the savegame flag can save normally.
 	// If the game is complete for this save slot, then any level can save!
 	// On the other side of the spectrum, if lastmaploaded is 0, then the save file has only just been created and needs to save ASAP!
@@ -2942,7 +2942,7 @@ boolean P_SetupLevel(boolean skipprecip)
 				camera.angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
 			}
 		}
-		
+
 		// Salt: CV_ClearChangedFlags() messes with your settings :(
 		/*if (!cv_cam_height.changed)
 			CV_Set(&cv_cam_height, cv_cam_height.defaultvalue);
diff --git a/src/p_spec.c b/src/p_spec.c
index b0aa27fbd4e3f6a55348ccd5754851bd07ee3e0c..03643a7082cd3b51a45d590a8554d9d970aae6e9 100644
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -40,11 +40,7 @@
 #endif
 
 // Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog
-#ifdef _WIN32_WCE
-#define AVOID_ERRNO
-#else
 #include <errno.h>
-#endif
 
 mobj_t *skyboxmo[2]; // current skybox mobjs: 0 = viewpoint, 1 = centerpoint
 mobj_t *skyboxviewpnts[16]; // array of MT_SKYBOX viewpoint mobjs
@@ -3608,6 +3604,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
 							goto DoneSection2;
 					}
 				}
+			/* FALLTHRU */
 		case 4: // Linedef executor that doesn't require touching floor
 		case 5: // Linedef executor
 		case 6: // Linedef executor (7 Emeralds)
@@ -4650,6 +4647,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector)
 				// requires touching floor.
 				break;
 			}
+			/* FALLTHRU */
+
 		case 1: // Starpost activator
 		case 5: // Fan sector
 		case 6: // Super Sonic Transform
@@ -5806,6 +5805,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
 					EV_DoFloor(&lines[i], bounceFloor);
 				if (lines[i].special == 54)
 					break;
+				/* FALLTHRU */
+
 			case 55: // New super cool and awesome moving ceiling type
 				if (lines[i].backsector)
 					EV_DoCeiling(&lines[i], bounceCeiling);
@@ -5817,7 +5818,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
 					EV_DoFloor(&lines[i], bounceFloorCrush);
 
 				if (lines[i].special == 57)
-						break; //only move the floor
+					break; //only move the floor
+				/* FALLTHRU */
 
 			case 58: // New super cool and awesome moving ceiling crush type
 				if (lines[i].backsector)
@@ -6905,6 +6907,7 @@ static void P_SpawnScrollers(void)
 					Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
 				if (special != 533)
 					break;
+				/* FALLTHRU */
 
 			case 523:	// carry objects on ceiling
 				dx = FixedMul(dx, CARRYFACTOR);
@@ -6919,6 +6922,7 @@ static void P_SpawnScrollers(void)
 					Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
 				if (special != 530)
 					break;
+				/* FALLTHRU */
 
 			case 520:	// carry objects on floor
 				dx = FixedMul(dx, CARRYFACTOR);
diff --git a/src/p_user.c b/src/p_user.c
index dad0520a624ab98774b16943bac8ceca86710198..c5326b7302efd1e977ca8d14147ab96b34b8dd1d 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -591,6 +591,7 @@ static void P_DeNightserizePlayer(player_t *player)
 	player->mo->flags &= ~MF_NOGRAVITY;
 
 	player->mo->skin = &skins[player->skin];
+	player->followitem = skins[player->skin].followitem;
 	player->mo->color = player->skincolor;
 
 	// Restore aiming angle
@@ -665,14 +666,16 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
 	if (skins[player->skin].sprites[SPR2_NGT0].numframes == 0) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
 	{
 		player->mo->skin = &skins[DEFAULTNIGHTSSKIN];
-		player->mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor;
+		if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
+			player->mo->color = skins[DEFAULTNIGHTSSKIN].prefcolor;
+		player->followitem = skins[DEFAULTNIGHTSSKIN].followitem;
 	}
 
 	player->nightstime = player->startedtime = nighttime*TICRATE;
 	player->bonustime = false;
 
 	P_RestoreMusic(player);
-	P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_TRANS);
+	P_SetPlayerMobjState(player->mo, S_PLAY_NIGHTS_TRANS1);
 
 	if (gametype == GT_RACE || gametype == GT_COMPETITION)
 	{
@@ -999,10 +1002,10 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
 	S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi
 
 	// Transformation animation
-	P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS);
+	P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1);
 
 	player->mo->momx = player->mo->momy = player->mo->momz = 0;
-	player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
+	player->pflags |= PF_NOJUMPDAMAGE; // just to avoid recurling but still allow thok
 
 	if (giverings)
 		player->rings = 50;
@@ -1550,9 +1553,7 @@ void P_SwitchShield(player_t *player, UINT16 shieldtype)
 //
 mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
 {
-	mobj_t *ghost;
-
-	ghost = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_GHOST);
+	mobj_t *ghost = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_GHOST);
 
 	P_SetScale(ghost, mobj->scale);
 	ghost->destscale = mobj->scale;
@@ -1578,6 +1579,14 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
 	if (mobj->flags2 & MF2_OBJECTFLIP)
 		ghost->flags |= MF2_OBJECTFLIP;
 
+	if (mobj->player && mobj->player->followmobj)
+	{
+		mobj_t *ghost2 = P_SpawnGhostMobj(mobj->player->followmobj);
+		P_SetTarget(&ghost2->tracer, ghost);
+		P_SetTarget(&ghost->tracer, ghost2);
+		ghost2->flags2 |= MF2_LINKDRAW;
+	}
+
 	return ghost;
 }
 
@@ -3647,9 +3656,8 @@ static void P_DoSuperStuff(player_t *player)
 {
 	mobj_t *spark;
 	ticcmd_t *cmd = &player->cmd;
-	if (player->mo->state >= &states[S_PLAY_SUPER_TRANS]
-	&& (player->mo->state < &states[S_PLAY_SUPER_TRANS9]
-	|| (player->mo->state == &states[S_PLAY_SUPER_TRANS9] && player->mo->tics > 1))) // needed to prevent one-frame old colour...
+	if (player->mo->state >= &states[S_PLAY_SUPER_TRANS1]
+	&& player->mo->state < &states[S_PLAY_SUPER_TRANS6])
 		return; // don't do anything right now, we're in the middle of transforming!
 
 	if (player->powers[pw_carry] == CR_NIGHTSMODE)
@@ -3666,7 +3674,7 @@ static void P_DoSuperStuff(player_t *player)
 			P_SpawnShieldOrb(player);
 
 			// Restore color
-			if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER)
+			if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER)
 			{
 				player->mo->color = SKINCOLOR_WHITE;
 				G_GhostAddColor(GHC_FIREFLOWER);
@@ -3686,14 +3694,19 @@ static void P_DoSuperStuff(player_t *player)
 			return;
 		}
 
+		player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0)
+		? (SKINCOLOR_SUPERSILVER1 + 5*(((signed)leveltime >> 1) % 7)) // A wholesome easter egg.
+		: skins[player->skin].supercolor + abs( ( (player->powers[pw_super] >> 1) % 9) - 4); // This is where super flashing is handled.
+
+		G_GhostAddColor(GHC_SUPER);
+
+		if (player->mo->state == &states[S_PLAY_SUPER_TRANS6]) // stop here for now
+			return;
+
 		// Deplete one ring every second while super
 		if ((leveltime % TICRATE == 0) && !(player->exiting))
 			player->rings--;
 
-		player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0)
-		? (SKINCOLOR_SUPERSILVER1 + 5*((leveltime >> 1) % 7)) // A wholesome easter egg.
-		: skins[player->skin].supercolor + (unsigned)abs( ( (signed)(leveltime >> 1) % 9) - 4); // This is where super flashing is handled.
-
 		if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->powers[pw_carry])
 		&& !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy))
 		{
@@ -3702,8 +3715,6 @@ static void P_DoSuperStuff(player_t *player)
 			P_SetScale(spark, player->mo->scale);
 		}
 
-		G_GhostAddColor(GHC_SUPER);
-
 		// Ran out of rings while super!
 		if (player->rings <= 0 || player->exiting)
 		{
@@ -3713,7 +3724,7 @@ static void P_DoSuperStuff(player_t *player)
 			player->powers[pw_super] = 0;
 
 			// Restore color
-			if ((player->powers[pw_shield] & SH_NOSTACK) == SH_FIREFLOWER)
+			if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER)
 			{
 				player->mo->color = SKINCOLOR_WHITE;
 				G_GhostAddColor(GHC_FIREFLOWER);
@@ -6080,14 +6091,14 @@ static void P_NiGHTSMovement(player_t *player)
 			&& (players[i].capsule && players[i].capsule->reactiontime))
 				capsule = true;
 		if (!capsule
-		&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS]
-			&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS9])
+		&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
+			&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
 		&& !player->exiting)
 			player->nightstime--;
 	}
 	else if (gametype != GT_RACE && gametype != GT_COMPETITION
-	&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS]
-			&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS9])
+	&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
+			&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
 	&& !(player->capsule && player->capsule->reactiontime)
 	&& !player->exiting)
 		player->nightstime--;
@@ -6226,8 +6237,8 @@ static void P_NiGHTSMovement(player_t *player)
 		return;
 	}
 
-	if (player->mo->state >= &states[S_PLAY_NIGHTS_TRANS]
-		&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS9])
+	if (player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
+		&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
 	{
 		player->mo->momx = player->mo->momy = player->mo->momz = 0;
 		return;
@@ -6831,7 +6842,7 @@ static void P_MovePlayer(player_t *player)
 
 	fixed_t runspd;
 
-	if (player->mo->state >= &states[S_PLAY_SUPER_TRANS] && player->mo->state <= &states[S_PLAY_SUPER_TRANS9])
+	if (player->mo->state >= &states[S_PLAY_SUPER_TRANS1] && player->mo->state <= &states[S_PLAY_SUPER_TRANS6])
 	{
 		player->mo->momx = player->mo->momy = player->mo->momz = 0;
 		return;
@@ -6900,12 +6911,12 @@ static void P_MovePlayer(player_t *player)
 	else if (maptol & TOL_NIGHTS)
 	{
 		if ((player->powers[pw_carry] == CR_NIGHTSMODE)
-		&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS]
-		&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6] // NOT 9 - it's 6 when the player turns their supercolor.
-		&& !(player->exiting)))
+		&& (player->exiting
+		|| !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
+			&& player->mo->state < &states[S_PLAY_NIGHTS_TRANS6])))
 		{
 			skin_t *skin = ((skin_t *)(player->mo->skin));
-			player->mo->color = (skin->flags & SF_SUPER) ? skin->supercolor + (unsigned)abs(((signed)(leveltime >> 1) % 9) - 4) : player->mo->color; // This is where super flashing is handled.
+			player->mo->color = (skin->flags & SF_SUPER) ? skin->supercolor + abs((((signed)(player->startedtime - player->nightstime) >> 1) % 9) - 4) : player->mo->color; // This is where super flashing is handled.
 		}
 
 		if (!player->capsule && !player->bonustime)
@@ -8818,7 +8829,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
 		// x1.2 dist for analog
 		if (P_AnalogMove(player))
 			dist = FixedMul(dist, 6*FRACUNIT/5);
-		
+
 		if (player->climbing || player->exiting || player->playerstate == PST_DEAD || (player->powers[pw_carry] == CR_ROPEHANG || player->powers[pw_carry] == CR_GENERIC || player->powers[pw_carry] == CR_MACESPIN))
 			dist <<= 1;
 	}
@@ -9724,7 +9735,8 @@ void P_PlayerThink(player_t *player)
 				ticmiss++;
 
 			P_DoRopeHang(player);
-			P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
+			if (player->mo->state-states != S_PLAY_RIDE)
+				P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
 			P_DoJumpStuff(player, &player->cmd);
 		}
 		else //if (player->powers[pw_carry] == CR_ZOOMTUBE)
@@ -9772,6 +9784,7 @@ void P_PlayerThink(player_t *player)
 						player->drawangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
 						break;
 					}
+					/* FALLTHRU */
 				default:
 					player->drawangle = player->mo->angle;
 					break;
@@ -9894,10 +9907,17 @@ void P_PlayerThink(player_t *player)
 	{
 		mobj_t *gmobj = P_SpawnGhostMobj(player->mo);
 		gmobj->fuse = 2;
+		if (gmobj->tracer)
+			gmobj->tracer->fuse = 2;
 		if (leveltime & 1)
 		{
 			gmobj->frame &= ~FF_TRANSMASK;
 			gmobj->frame |= tr_trans70<<FF_TRANSSHIFT;
+			if (gmobj->tracer)
+			{
+				gmobj->tracer->frame &= ~FF_TRANSMASK;
+				gmobj->tracer->frame |= tr_trans70<<FF_TRANSSHIFT;
+			}
 		}
 
 		// Hide the mobj from our sights if we're the displayplayer and chasecam is off,
@@ -9971,7 +9991,9 @@ void P_PlayerThink(player_t *player)
 		player->powers[pw_nocontrol] = 0;
 
 	//pw_super acts as a timer now
-	if (player->powers[pw_super])
+	if (player->powers[pw_super]
+	&& (player->mo->state < &states[S_PLAY_SUPER_TRANS1]
+	|| player->mo->state > &states[S_PLAY_SUPER_TRANS6]))
 		player->powers[pw_super]++;
 
 	if (player->powers[pw_carry] == CR_BRAKGOOP)
@@ -10163,6 +10185,11 @@ void P_PlayerAfterThink(player_t *player)
 			if (thiscam && thiscam->chase)
 				P_MoveChaseCamera(player, thiscam, false);
 		}
+		if (player->followmobj)
+		{
+			P_RemoveMobj(player->followmobj);
+			player->followmobj = NULL;
+		}
 		return;
 	}
 
@@ -10341,7 +10368,10 @@ void P_PlayerAfterThink(player_t *player)
 			player->powers[pw_carry] = CR_NONE;
 
 		if (player->powers[pw_carry] != CR_NONE)
-			P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
+		{
+			if (player->mo->state-states != S_PLAY_RIDE)
+				P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
+		}
 		else
 			P_SetTarget(&player->mo->tracer, NULL);
 
@@ -10360,7 +10390,8 @@ void P_PlayerAfterThink(player_t *player)
 			player->mo->z = player->mo->tracer->z - FixedDiv(player->mo->height, 3*FRACUNIT/2);
 		player->mo->momx = player->mo->momy = player->mo->momz = 0;
 		P_SetThingPosition(player->mo);
-		P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
+		if (player->mo->state-states != S_PLAY_RIDE)
+			P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
 
 		// Controllable missile
 		if (player->mo->tracer->type == MT_BLACKEGGMAN_MISSILE)
@@ -10454,4 +10485,224 @@ void P_PlayerAfterThink(player_t *player)
 
 	if (P_IsObjectOnGround(player->mo))
 		player->mo->pmomz = 0;
+
+	if (player->followmobj && (player->spectator || player->mo->health <= 0 || player->followmobj->type != player->followitem))
+	{
+		P_RemoveMobj(player->followmobj);
+		player->followmobj = NULL;
+	}
+
+	if (!player->spectator && player->mo->health && player->followitem)
+	{
+		if (!player->followmobj || P_MobjWasRemoved(player->followmobj))
+		{
+			player->followmobj = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, player->followitem);
+			P_SetTarget(&player->followmobj->tracer, player->mo);
+			player->followmobj->flags2 |= MF2_LINKDRAW;
+		}
+
+		if (player->followmobj)
+		{
+#ifdef HAVE_BLUA
+			if (LUAh_FollowMobj(player, player->followmobj) || P_MobjWasRemoved(player->followmobj))
+				{;}
+			else
+#endif
+			{
+				switch (player->followmobj->type)
+				{
+					case MT_TAILSOVERLAY: // c:
+						{
+							// init...
+							boolean smilesonground = P_IsObjectOnGround(player->mo);
+							angle_t horizangle = player->drawangle;
+							fixed_t zoffs = 0;
+							fixed_t backwards = -1*FRACUNIT;
+							boolean doroll = (player->panim == PA_ROLL || player->panim == PA_JUMP);
+							angle_t rollangle;
+							boolean panimchange;
+							INT32 ticnum = 0;
+							statenum_t chosenstate;
+
+							if (!player->followmobj->skin)
+							{
+								player->followmobj->skin = player->mo->skin;
+								P_SetMobjState(player->followmobj, S_TAILSOVERLAY_STAND);
+								player->followmobj->movecount = -1;
+							}
+
+							panimchange = (player->followmobj->movecount != (INT32)player->panim);
+
+							// initial position...
+							if (doroll)
+							{
+								fixed_t testval, zdist;
+								if (player->speed < FRACUNIT)
+									testval = FRACUNIT;
+								else
+								{
+									testval = (FixedMul(player->speed, FINECOSINE((horizangle - R_PointToAngle2(0, 0, player->rmomx, player->rmomy)) >> ANGLETOFINESHIFT)));
+									if (testval < FRACUNIT)
+										testval = FRACUNIT;
+								}
+								if (smilesonground && !player->mo->reactiontime)
+									zdist = (player->mo->z - player->followmobj->threshold);
+								else
+									zdist = player->mo->momz;
+								rollangle = R_PointToAngle2(0, 0, testval, -P_MobjFlip(player->mo)*zdist);
+								zoffs = 3*FRACUNIT + 12*FINESINE(rollangle >> ANGLETOFINESHIFT);
+								backwards = -12*FINECOSINE(rollangle >> ANGLETOFINESHIFT);
+							}
+							else if (player->panim == PA_RUN)
+								backwards = -5*FRACUNIT;
+							else if (player->panim == PA_SPRING)
+							{
+								zoffs += 4*FRACUNIT;
+								backwards /= 2;
+							}
+							else if (player->panim == PA_PAIN)
+								backwards /= 16;
+							else if (player->mo->state-states == S_PLAY_GASP)
+							{
+								backwards /= 16;
+								zoffs += 12*FRACUNIT;
+							}
+							else if (player->mo->state-states == S_PLAY_EDGE)
+							{
+								backwards /= 16;
+								zoffs = 3*FRACUNIT;
+							}
+							else if (player->panim == PA_ABILITY2)
+							{
+								zoffs = -7*FRACUNIT;
+								backwards = -9*FRACUNIT;
+							}
+							else if (player->mo->sprite2 == SPR2_FLY || player->mo->sprite2 == SPR2_TIRE)
+								backwards = -5*FRACUNIT;
+
+							// sprite...
+							if (doroll)
+							{
+								statenum_t add = ((rollangle > ANGLE_180) ? 2 : 0);
+								if (add)
+									rollangle = InvAngle(rollangle);
+								rollangle += ANG15; // modify the thresholds to be nice clean numbers
+								if (rollangle > ANG60)
+									chosenstate = S_TAILSOVERLAY_PLUS60DEGREES + add;
+								else if (rollangle > ANG30)
+									chosenstate = S_TAILSOVERLAY_PLUS30DEGREES + add;
+								else
+									chosenstate = S_TAILSOVERLAY_0DEGREES;
+							}
+							else if (player->panim == PA_SPRING)
+								chosenstate = S_TAILSOVERLAY_MINUS60DEGREES;
+							else if (player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
+								chosenstate = S_TAILSOVERLAY_PLUS60DEGREES;
+							else if (player->panim == PA_PAIN)
+								chosenstate = S_TAILSOVERLAY_PAIN;
+							else if (player->mo->state-states == S_PLAY_GASP)
+								chosenstate = S_TAILSOVERLAY_GASP;
+							else if (player->mo->state-states == S_PLAY_EDGE)
+								chosenstate = S_TAILSOVERLAY_EDGE;
+							else if (player->panim == PA_RUN)
+								chosenstate = S_TAILSOVERLAY_RUN;
+							else if (player->panim == PA_WALK)
+							{
+								if (!smilesonground)
+									chosenstate = S_TAILSOVERLAY_PLUS30DEGREES;
+								else if (player->speed >= FixedMul(player->runspeed/2, player->mo->scale))
+									chosenstate = S_TAILSOVERLAY_0DEGREES;
+								else
+									chosenstate = S_TAILSOVERLAY_MINUS30DEGREES;
+							}
+							else if (player->mo->sprite2 == SPR2_FLY)
+								chosenstate = S_TAILSOVERLAY_FLY;
+							else if (player->mo->sprite2 == SPR2_TIRE)
+								chosenstate = S_TAILSOVERLAY_TIRE;
+							else if (player->panim == PA_ABILITY2)
+								chosenstate = S_TAILSOVERLAY_PLUS30DEGREES;
+							else if (player->panim == PA_IDLE)
+								chosenstate = S_TAILSOVERLAY_STAND;
+							else
+								chosenstate = S_INVISIBLE;
+
+							// state...
+							if (panimchange)
+							{
+								player->followmobj->sprite2 = -1;
+								P_SetMobjState(player->followmobj, chosenstate);
+							}
+							else
+							{
+								if (player->followmobj->state != states+chosenstate)
+								{
+									if (states[chosenstate].sprite == SPR_PLAY)
+										player->followmobj->sprite2 = P_GetSkinSprite2(((skin_t *)player->followmobj->skin), (states[chosenstate].frame & FF_FRAMEMASK), player);
+									P_SetMobjState(player->followmobj, chosenstate);
+								}
+							}
+
+							if (player->fly1 != 0 && player->powers[pw_tailsfly] != 0 && !smilesonground)
+								P_SetMobjState(player->followmobj, chosenstate);
+
+							// animation...
+							if (player->panim == PA_SPRING || player->panim == PA_FALL || player->mo->state-states == S_PLAY_RIDE)
+							{
+								if (FixedDiv(abs(player->mo->momz), player->mo->scale) < 20<<FRACBITS)
+									ticnum = 2;
+								else
+									ticnum = 1;
+							}
+							else if (player->panim == PA_PAIN)
+								ticnum = 2;
+							else if (player->mo->state-states == S_PLAY_GASP)
+								player->followmobj->tics = -1;
+							else if (player->mo->sprite2 == SPR2_TIRE)
+								ticnum = 4;
+							else if (player->panim != PA_IDLE)
+								ticnum = player->mo->tics;
+
+							if (ticnum && player->followmobj->tics > ticnum)
+								player->followmobj->tics = ticnum;
+
+							// final handling...
+							player->followmobj->color = player->mo->color;
+							player->followmobj->threshold = player->mo->z;
+							player->followmobj->movecount = player->panim;
+							player->followmobj->angle = horizangle;
+							player->followmobj->scale = player->mo->scale;
+							P_SetScale(player->followmobj, player->mo->scale);
+							player->followmobj->destscale = player->mo->destscale;
+							player->followmobj->radius = player->mo->radius;
+							player->followmobj->height = player->mo->height;
+							zoffs = FixedMul(zoffs, player->followmobj->scale);
+
+							if (player->mo->eflags & MFE_VERTICALFLIP)
+							{
+								player->followmobj->eflags |= MFE_VERTICALFLIP;
+								player->followmobj->flags2 |= MF2_OBJECTFLIP;
+								zoffs = player->mo->height - player->followmobj->height - zoffs;
+							}
+							else
+							{
+								player->followmobj->eflags &= ~MFE_VERTICALFLIP;
+								player->followmobj->flags2 &= ~MF2_OBJECTFLIP;
+							}
+
+							P_UnsetThingPosition(player->followmobj);
+							player->followmobj->x = player->mo->x + P_ReturnThrustX(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale));
+							player->followmobj->y = player->mo->y + P_ReturnThrustY(player->followmobj, player->followmobj->angle, FixedMul(backwards, player->followmobj->scale));
+							player->followmobj->z = player->mo->z + zoffs;
+							P_SetThingPosition(player->followmobj);
+						}
+						break;
+					default:
+						var1 = 1;
+						var2 = 0;
+						A_CapeChase(player->followmobj);
+						break;
+				}
+			}
+		}
+	}
 }
diff --git a/src/r_data.c b/src/r_data.c
index 791d90d9411446f256bb43475b1a7fbdc9ecbb00..c578012d110e93edba6392a9762d22113608ef14 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -25,7 +25,7 @@
 #include "v_video.h" // pMasterPalette
 #include "dehacked.h"
 
-#if defined (_WIN32) || defined (_WIN32_WCE)
+#ifdef _WIN32
 #include <malloc.h> // alloca(sizeof)
 #endif
 
diff --git a/src/r_draw.c b/src/r_draw.c
index 4479cf02ca5565b3e561420223202237be6b51e6..e06d43f676117f013feb9dfc93b4b080fef7902c 100644
--- a/src/r_draw.c
+++ b/src/r_draw.c
@@ -431,10 +431,6 @@ CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];
 */
 void R_InitTranslationTables(void)
 {
-#ifdef _NDS
-	// Ugly temporary NDS hack.
-	transtables = (UINT8*)0x2000000;
-#else
 	// Load here the transparency lookup tables 'TINTTAB'
 	// NOTE: the TINTTAB resource MUST BE aligned on 64k for the asm
 	// optimised code (in other words, transtables pointer low word is 0)
@@ -450,7 +446,6 @@ void R_InitTranslationTables(void)
 	W_ReadLump(W_GetNumForName("TRANS70"), transtables+0x60000);
 	W_ReadLump(W_GetNumForName("TRANS80"), transtables+0x70000);
 	W_ReadLump(W_GetNumForName("TRANS90"), transtables+0x80000);
-#endif
 }
 
 
diff --git a/src/r_things.c b/src/r_things.c
index 116782c3c9c5b5c0b3336cf62eaac25ca89c4276..9ab7b5d1eba97bec45127e066dc6169597a6f8a5 100644
--- a/src/r_things.c
+++ b/src/r_things.c
@@ -1385,12 +1385,12 @@ static void R_ProjectSprite(mobj_t *thing)
 	// specific translucency
 	if (!cv_translucency.value)
 		; // no translucency
-	else if (oldthing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
+	else if (oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
 		vis->transmap = transtables + ((tr_trans80-1)<<FF_TRANSSHIFT); // because now the translucency is set through FF_TRANSMASK
 	else if (oldthing->frame & FF_TRANSMASK)
 		vis->transmap = transtables + (oldthing->frame & FF_TRANSMASK) - 0x10000;
 
-	if ((oldthing->frame & FF_FULLBRIGHT) || (oldthing->flags2 & MF2_SHADOW))
+	if (oldthing->frame & FF_FULLBRIGHT || oldthing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW)
 		vis->cut |= SC_FULLBRIGHT;
 
 	if (vis->cut & SC_FULLBRIGHT
@@ -2438,7 +2438,7 @@ UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
 
 	while (!(skin->sprites[spr2].numframes)
 		&& spr2 != SPR2_STND
-		&& ++i != 32) // recursion limiter
+		&& ++i < 32) // recursion limiter
 	{
 		if (spr2 & FF_SPR2SUPER)
 		{
@@ -2525,6 +2525,7 @@ static void Sk_SetDefaultValue(skin_t *skin)
 	skin->thokitem = -1;
 	skin->spinitem = -1;
 	skin->revitem = -1;
+	skin->followitem = 0;
 
 	skin->highresscale = FRACUNIT;
 
@@ -2638,6 +2639,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
 		player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem;
 		player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem;
 		player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem;
+		player->followitem = skin->followitem;
 
 		player->actionspd = skin->actionspd;
 		player->mindash = skin->mindash;
@@ -2663,13 +2665,21 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
 			player->skincolor = newcolor = skin->prefcolor;
 		}
 
+		if (player->followmobj)
+		{
+			P_RemoveMobj(player->followmobj);
+			player->followmobj = NULL;
+		}
+
 		if (player->mo)
 		{
 			fixed_t radius = FixedMul(skin->radius, player->mo->scale);
 			if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NGT0].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
 			{
 				skin = &skins[DEFAULTNIGHTSSKIN];
-				newcolor = skin->prefcolor; // will be updated in thinker to flashing
+				player->followitem = skin->followitem;
+				if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
+					newcolor = skin->prefcolor; // will be updated in thinker to flashing
 			}
 			player->mo->skin = skin;
 			if (newcolor)
@@ -2803,6 +2813,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
 	FULLPROCESS(thokitem)
 	FULLPROCESS(spinitem)
 	FULLPROCESS(revitem)
+	FULLPROCESS(followitem)
 #undef FULLPROCESS
 
 #define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
diff --git a/src/r_things.h b/src/r_things.h
index 18cc701ab72b0090293d0a6303716458683852c9..e1a171c1ffb869170e13a5db40755f58a76b1b33 100644
--- a/src/r_things.h
+++ b/src/r_things.h
@@ -82,6 +82,7 @@ typedef struct
 	INT32 thokitem;
 	INT32 spinitem;
 	INT32 revitem;
+	INT32 followitem;
 	fixed_t actionspd;
 	fixed_t mindash;
 	fixed_t maxdash;
diff --git a/src/s_sound.c b/src/s_sound.c
index f6fef915af20da27ffe6105ca6a2fe54bcdcf67b..0ac3a2c76a3516eb4eb45c1fab50e6a12632816b 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -62,12 +62,8 @@ consvar_t sndserver_arg = {"sndserver_arg", "-quiet", CV_SAVE, NULL, 0, NULL, NU
 #define SURROUND
 #endif
 
-#if defined (_WIN32_WCE) || defined (DC) || defined(GP2X)
-consvar_t cv_samplerate = {"samplerate", "11025", 0, CV_Unsigned, NULL, 11025, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
-#elif defined(_PSP) || defined(_WINDOWS)
+#ifdef _WINDOWS
 consvar_t cv_samplerate = {"samplerate", "44100", 0, CV_Unsigned, NULL, 44100, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
-#elif defined(_WII)
-consvar_t cv_samplerate = {"samplerate", "32000", 0, CV_Unsigned, NULL, 32000, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
 #else
 consvar_t cv_samplerate = {"samplerate", "22050", 0, CV_Unsigned, NULL, 22050, NULL, NULL, 0, 0, NULL}; //Alam: For easy hacking?
 #endif
@@ -93,11 +89,7 @@ static void Captioning_OnChange(void)
 consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_OnOff, Captioning_OnChange, 0, NULL, NULL, 0, 0, NULL};
 
 // number of channels available
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
-consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
-#endif
 
 static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
 
@@ -1385,10 +1377,6 @@ static boolean S_DigMusic(const char *mname, boolean looping)
 
 void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping)
 {
-#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X)
-	S_ClearSfx();
-#endif
-
 	if ((nomidimusic || music_disabled) && (nodigimusic || digital_disabled))
 		return;
 
diff --git a/src/screen.c b/src/screen.c
index a9b85d1a10779c3a77a71fb3979d913b80377cf4..28765785bda30f2071c14e7176f022371a20ddad 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -64,15 +64,9 @@ INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set +
 static CV_PossibleValue_t scr_depth_cons_t[] = {{8, "8 bits"}, {16, "16 bits"}, {24, "24 bits"}, {32, "32 bits"}, {0, NULL}};
 
 //added : 03-02-98: default screen mode, as loaded/saved in config
-#ifdef WII
-consvar_t cv_scr_width = {"scr_width", "640", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_scr_height = {"scr_height", "480", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
 consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
 consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
 consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
 
 #ifdef DIRECTFULLSCREEN
@@ -170,10 +164,10 @@ void SCR_SetMode(void)
 	}*/
 	else
 		I_Error("unknown bytes per pixel mode %d\n", vid.bpp);
-/*#if !defined (DC) && !defined (WII)
+/*
 	if (SCR_IsAspectCorrect(vid.width, vid.height))
 		CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
-#endif*/
+*/
 
 	wallcolfunc = walldrawerfunc;
 
diff --git a/src/screen.h b/src/screen.h
index d2d0e87ab6662d6c4ed31eda034d0c2d9c7fe6d3..4d4fbb88b8cc62ccf4363e41a5b8a639af0b4e68 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -15,20 +15,16 @@
 
 #include "command.h"
 
-#if (defined (_WIN32) || defined (_WIN32_WCE)) && !defined (__CYGWIN__) && !defined (_XBOX)
-#if defined (_WIN32_WCE) && defined (__GNUC__)
-#include <sys/wcetypes.h>
-#else
+#if defined (_WIN32) && !defined (__CYGWIN__)
 #define RPC_NO_WINDOWS_H
 #include <windows.h>
-#endif
 #define DNWH HWND
 #else
 #define DNWH void * // unused in DOS version
 #endif
 
 // quickhack for V_Init()... to be cleaned up
-#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined (NOPOSTPROCESSING)
+#ifdef NOPOSTPROCESSING
 #define NUMSCREENS 2
 #else
 #define NUMSCREENS 5
@@ -43,15 +39,9 @@
 // we try to re-allocate a minimum of buffers for stability of the memory,
 // so all the small-enough tables based on screen size, are allocated once
 // and for all at the maximum size.
-#if defined (_WIN32_WCE) || defined (DC) || defined (_PSP) || defined (_NDS)
+#if defined (_WIN32_WCE)
 #define MAXVIDWIDTH 320
 #define MAXVIDHEIGHT 200
-#elif defined (GP2X)
-#define MAXVIDWIDTH 320 //720
-#define MAXVIDHEIGHT 240 //576
-#elif defined (WII) // Wii, VGA/640x480
-#define MAXVIDWIDTH 640
-#define MAXVIDHEIGHT 480
 #else
 #define MAXVIDWIDTH 1920 // don't set this too high because actually
 #define MAXVIDHEIGHT 1200 // lots of tables are allocated with the MAX size.
@@ -110,7 +100,7 @@ typedef struct vmode_s
 	INT32 windowed; // if true this is a windowed mode
 	INT32 numpages;
 	vesa_extra_t *pextradata; // vesa mode extra data
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
 	INT32 (WINAPI *setmode)(viddef_t *lvid, struct vmode_s *pcurrentmode);
 #else
 	INT32 (*setmode)(viddef_t *lvid, struct vmode_s *pcurrentmode);
diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg
index 1a0b5421048ac134924e8b47e7d606e0abcf37e3..47c944eb5f21e8451c55374b212220fa09072360 100644
--- a/src/sdl/MakeNIX.cfg
+++ b/src/sdl/MakeNIX.cfg
@@ -65,37 +65,6 @@ ifdef MACOSX
 	LIBS+=-framework CoreFoundation
 endif
 
-#
-#here is GP2x (arm-gp2x-linux)
-#
-ifdef GP2X
-	PNG_CONFIG?=$(PREFIX)-libpng12-config
-ifdef STATIC #need a better setting name
-	CFLAGS+=-I$(OPEN2X)/include
-ifndef NOMIXER
-	LIBS+=-lvorbisidec
-ifdef MIKMOD
-	LIBS+=-lmikmod
-endif
-ifdef SMPEGLIB
-	LIBS+=-lsmpeg
-	LD=$(CXX)
-endif
-endif
-	NONET=1
-endif
-ifndef ARCHNAME
-"error"
-endif
-	NONX86=1
-	NOHW=1
-	NOHS=1
-	NOMD5=1
-	WFLAGS+=-O0
-	OPTS+=-DGP2X -ffast-math -mcpu=arm920t
-	EXENAME?=SRB2GP2X.gpe
-endif
-
 ifndef NOHW
 	OPTS+=-I/usr/X11R6/include
 	LDFLAGS+=-L/usr/X11R6/lib
diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg
index b54f7057c9a0e750bb99ef2fe0417fc0f7d532bf..58c4d0861f048c1b5f50e9c55aacaf26cb6557e1 100644
--- a/src/sdl/Makefile.cfg
+++ b/src/sdl/Makefile.cfg
@@ -14,26 +14,6 @@ ifdef PANDORA
 include sdl/SRB2Pandora/Makefile.cfg
 endif #ifdef PANDORA
 
-ifdef DC
-include sdl/SRB2DC/Makefile.cfg
-endif #ifdef DC
-
-ifdef PS3N
-include sdl/SRB2PS3/Makefile.cfg
-endif #ifdef PS3N
-
-ifdef PSP
-include sdl/SRB2PSP/Makefile.cfg
-endif #ifdef PSP
-
-ifdef XBOX
-include sdl/SRB2XBOX/Makefile.cfg
-endif #ifdef XBOX
-
-ifdef WINCE
-include sdl/SRB2CE/Makefile.cfg
-endif #ifef WINCE
-
 ifdef CYGWIN32
 include sdl/MakeCYG.cfg
 endif #ifdef CYGWIN32
@@ -150,15 +130,8 @@ endif
 endif
 endif
 
-# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
-ifdef WII
-include sdl/SRB2WII/Makefile.cfg
-endif #ifdef WII
-
 CFLAGS+=$(SDL_CFLAGS)
 LIBS:=$(SDL_LDFLAGS) $(LIBS)
-ifndef WII
 ifdef STATIC
 	LIBS+=$(shell $(SDL_CONFIG) --static-libs)
 endif
-endif
diff --git a/src/sdl/endtxt.c b/src/sdl/endtxt.c
index 1d7756b4de067a25e044adf1a47e3c8955510212..1e72ca9a89abcca1f071fa16592694fc36f30a2d 100644
--- a/src/sdl/endtxt.c
+++ b/src/sdl/endtxt.c
@@ -33,7 +33,6 @@
 
 void ShowEndTxt(void)
 {
-#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
 	INT32 i;
 	UINT16 j, att = 0;
 	INT32 nlflag = 1;
@@ -232,5 +231,4 @@ void ShowEndTxt(void)
 		printf("\n");
 
 	Z_Free(data);
-#endif
 }
diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c
index 54f5da3a083da6d9b3b9159b059389cbc7bc8271..f4686d2bf4f3e95626ba6a69322ce44b379ce8ec 100644
--- a/src/sdl/hwsym_sdl.c
+++ b/src/sdl/hwsym_sdl.c
@@ -37,14 +37,8 @@
 #pragma warning(default : 4214 4244)
 #endif
 
-#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X)
-#define NOLOADSO
-#endif
-
-#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO)
-#include "SDL_loadso.h" // 1.2.6+
-#elif !defined (NOLOADSO)
-#define NOLOADSO
+#ifndef NOLOADSO
+#include "SDL_loadso.h"
 #endif
 
 #define  _CREATE_DLL_  // necessary for Unix AND Windows
diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c
index 25fccb9f921a7fc4087e58769c7903e74eaaaaf8..f1cecad4d82654829600bd215ba1a7881c1e4d05 100644
--- a/src/sdl/i_main.c
+++ b/src/sdl/i_main.c
@@ -26,28 +26,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef _WII
-#include <limits.h>
-#include <network.h>
-#include <fat.h>
-#ifdef REMOTE_DEBUGGING
-#include <debug.h>
-#endif
-static char wiicwd[PATH_MAX] = "sd:/";
-static char localip[16] = {0};
-static char gateway[16] = {0};
-static char netmask[16] = {0};
-#endif
-
-#ifdef _PSP
-#include <pspmoduleinfo.h>
-#include <pspthreadman.h>
-PSP_HEAP_SIZE_KB(24*1024);
-PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
-PSP_MAIN_THREAD_NAME("SRB2");
-PSP_MAIN_THREAD_STACK_SIZE_KB(256);
-#endif
-
 #ifdef HAVE_SDL
 
 #ifdef HAVE_TTF
@@ -79,23 +57,12 @@ FILE *logstream = NULL;
 #endif
 #endif
 
-#if defined (_WIN32) && !defined (_XBOX)
+#if defined (_WIN32)
 #include "../win32/win_dbg.h"
 typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
 #endif
 
-#ifdef _arch_dreamcast
-#include <arch/arch.h>
-KOS_INIT_FLAGS(INIT_DEFAULT
-//| INIT_NET
-//| INIT_MALLOCSTATS
-//| INIT_QUIET
-//| INIT_OCRAM
-//| INIT_NO_DCLOAD
-);
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE)
+#if defined (_WIN32)
 static inline VOID MakeCodeWritable(VOID)
 {
 #ifdef USEASM // Disable write-protection of code segment
@@ -136,13 +103,6 @@ static inline VOID MakeCodeWritable(VOID)
 
 	\return	int
 */
-#if defined (_XBOX) && defined (__GNUC__)
-void XBoxStartup()
-{
-	const char *logdir = NULL;
-	myargc = -1;
-	myargv = NULL;
-#else
 #ifdef FORCESDLMAIN
 int SDL_main(int argc, char **argv)
 #else
@@ -152,56 +112,19 @@ int main(int argc, char **argv)
 	const char *logdir = NULL;
 	myargc = argc;
 	myargv = argv; /// \todo pull out path to exe from this string
-#endif
 
 #ifdef HAVE_TTF
-#ifdef _PS3
-	// apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around
-	SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1);
-	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF);
-#elif defined(_WIN32)
+#ifdef _WIN32
 	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
 #else
 	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
 #endif
 #endif
 
-#ifdef _PS3
-	// initialise controllers.
-	//ioPadInit(7);
-#endif
-
-// init Wii-specific stuff
-#ifdef _WII
-	// Start network
-	if_config(localip, netmask, gateway, TRUE);
-
-#ifdef REMOTE_DEBUGGING
-#if REMOTE_DEBUGGING == 0
-	DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828
-#elif REMOTE_DEBUGGING > 2
-	DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port
-#elif REMOTE_DEBUGGING < 0
-	DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1
-#else
-	DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot
-#endif
-#endif
-	// Start FAT filesystem
-	fatInitDefault();
-
-	if (getcwd(wiicwd, PATH_MAX))
-		I_PutEnv(va("HOME=%ssrb2wii", wiicwd));
-#endif
-
 	logdir = D_Home();
 
 #ifdef LOGMESSAGES
-#if defined(_WIN32_WCE) || defined(GP2X)
-	logstream = fopen(va("%s.log",argv[0]), "wt");
-#elif defined (_WII)
-	logstream = fopen(va("%s/log.txt",logdir), "wt");
-#elif defined (DEFAULTDIR)
+#ifdef DEFAULTDIR
 	if (logdir)
 		logstream = fopen(va("%s/"DEFAULTDIR"/log.txt",logdir), "wt");
 	else
@@ -211,8 +134,7 @@ int main(int argc, char **argv)
 
 	//I_OutputMsg("I_StartupSystem() ...\n");
 	I_StartupSystem();
-#if defined (_WIN32) && !defined (_XBOX)
-#ifndef _WIN32_WCE
+#if defined (_WIN32)
 	{
 #if 0 // just load the DLL
 		p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
@@ -226,11 +148,8 @@ int main(int argc, char **argv)
 			LoadLibraryA("exchndl.dll");
 		}
 	}
-#endif
 	prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
-#ifndef _WIN32_WCE
 	MakeCodeWritable();
-#endif
 #endif
 	// startup SRB2
 	CONS_Printf("Setting up SRB2...\n");
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index f72a9857d694d82c3f3d40c3ae3f06ee741cfcd8..3e46a9b6abf59566f2af829b39727b4e571e2a9d 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -26,19 +26,12 @@
 #include "../config.h.in"
 #endif
 
-#ifndef _WIN32_WCE
 #include <signal.h>
-#endif
-
-#ifdef _XBOX
-#include "SRB2XBOX/xboxhelp.h"
-#endif
 
-#if defined (_WIN32) && !defined (_XBOX)
+#ifdef _WIN32
 #define RPC_NO_WINDOWS_H
 #include <windows.h>
 #include "../doomtype.h"
-#ifndef _WIN32_WCE
 typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
 typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD);
 typedef DWORD (WINAPI *p_timeGetTime) (void);
@@ -46,7 +39,6 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
 typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
 typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 #endif
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -59,18 +51,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
 #include <fcntl.h>
 #endif
 
-#ifdef _arch_dreamcast
-#include <arch/gdb.h>
-#include <arch/timer.h>
-#include <conio/conio.h>
-#include <dc/pvr.h>
-void __set_fpscr(long); // in libgcc / kernel's startup.s?
-#else
 #include <stdio.h>
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
+#ifdef _WIN32
 #include <conio.h>
 #endif
-#endif
 
 #ifdef _MSC_VER
 #pragma warning(disable : 4214 4244)
@@ -88,15 +72,10 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #pragma warning(default : 4214 4244)
 #endif
 
-#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC)
-#include "SDL_cpuinfo.h" // 1.2.7 or greater
+#include "SDL_cpuinfo.h"
 #define HAVE_SDLCPUINFO
-#endif
 
-#ifdef _PSP
-//#include <pspiofilemgr.h>
-#elif !defined(_PS3)
-#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII))
+#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
 #if defined (__linux__)
 #include <sys/vfs.h>
 #else
@@ -111,20 +90,17 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #include <sys/vmmeter.h>
 #endif
 #endif
-#endif
 
-#ifndef _PS3
-#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
+#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
 #ifndef NOTERMIOS
 #include <termios.h>
 #include <sys/ioctl.h> // ioctl
 #define HAVE_TERMIOS
 #endif
 #endif
-#endif
 
 #ifndef NOMUMBLE
-#if defined (__linux__) && !defined(_PS3) // need -lrt
+#ifdef __linux__ // need -lrt
 #include <sys/mman.h>
 #ifdef MAP_FAILED
 #define HAVE_SHM
@@ -132,7 +108,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #include <wchar.h>
 #endif
 
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
+#ifdef _WIN32
 #define HAVE_MUMBLE
 #define WINMUMBLE
 #elif defined (HAVE_SHM)
@@ -140,10 +116,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #endif
 #endif // NOMUMBLE
 
-#ifdef _WIN32_WCE
-#include "SRB2CE/cehelp.h"
-#endif
-
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
@@ -153,44 +125,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #endif
 
 // Locations for searching the srb2.srb
-#ifdef _arch_dreamcast
-#define DEFAULTWADLOCATION1 "/cd"
-#define DEFAULTWADLOCATION2 "/pc"
-#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data"
-#define DEFAULTSEARCHPATH1 "/cd"
-#define DEFAULTSEARCHPATH2 "/pc"
-//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data"
-#elif defined (GP2X)
-#define DEFAULTWADLOCATION1 "/mnt/sd"
-#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
-#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
-#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2"
-#define DEFAULTSEARCHPATH1 "/mnt/sd"
-#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd"
-#elif defined (_WII)
-#define NOCWD
-#define NOHOME
-#define NEED_SDL_GETENV
-#define DEFAULTWADLOCATION1 "sd:/srb2wii"
-#define DEFAULTWADLOCATION2 "usb:/srb2wii"
-#define DEFAULTSEARCHPATH1 "sd:/srb2wii"
-#define DEFAULTSEARCHPATH2 "usb:/srb2wii"
-// PS3: TODO: this will need modification most likely
-#elif defined (_PS3)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3"
-#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3"
-#elif defined (_PSP)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "host0:/bin/Resources"
-#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP"
-#define DEFAULTSEARCHPATH1 "host0:/"
-#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP"
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
+#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
 #define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
 #define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
@@ -198,23 +133,6 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #define DEFAULTSEARCHPATH1 "/usr/local/games"
 #define DEFAULTSEARCHPATH2 "/usr/games"
 #define DEFAULTSEARCHPATH3 "/usr/local"
-#elif defined (_XBOX)
-#define NOCWD
-#ifdef __GNUC__
-#include <openxdk/debug.h>
-#endif
-#define DEFAULTWADLOCATION1 "c:\\srb2"
-#define DEFAULTWADLOCATION2 "d:\\srb2"
-#define DEFAULTWADLOCATION3 "e:\\srb2"
-#define DEFAULTWADLOCATION4 "f:\\srb2"
-#define DEFAULTWADLOCATION5 "g:\\srb2"
-#define DEFAULTWADLOCATION6 "h:\\srb2"
-#define DEFAULTWADLOCATION7 "i:\\srb2"
-#elif defined (_WIN32_WCE)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO"
-#define DEFAULTSEARCHPATH1 "\\Storage Card"
 #elif defined (_WIN32)
 #define DEFAULTWADLOCATION1 "c:\\games\\srb2"
 #define DEFAULTWADLOCATION2 "\\games\\srb2"
@@ -270,9 +188,6 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
 {
 	if (JoySet->dev)
 	{
-#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick...
-		if (SDL_JoystickIndex(JoySet->dev) != 0)
-#endif
 		SDL_JoystickClose(JoySet->dev);
 	}
 	JoySet->dev = NULL;
@@ -308,7 +223,6 @@ SDL_bool framebuffer = SDL_FALSE;
 
 UINT8 keyboard_started = false;
 
-#if !defined (DC)
 FUNCNORETURN static ATTRNORETURN void signal_handler(INT32 num)
 {
 	//static char msg[] = "oh no! back to reality!\r\n";
@@ -362,7 +276,6 @@ FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
 	raise(num);
 	I_Quit();
 }
-#endif
 
 #ifdef HAVE_TERMIOS
 // TERMIOS console code from Quake3: thank you!
@@ -487,9 +400,7 @@ static void I_StartupConsole(void)
 	signal(SIGTTIN, SIG_IGN);
 	signal(SIGTTOU, SIG_IGN);
 
-#if !defined(GP2X) //read is bad on GP2X
 	consolevent = !M_CheckParm("-noconsole");
-#endif
 	framebuffer = M_CheckParm("-framebuffer");
 
 	if (framebuffer)
@@ -577,7 +488,7 @@ void I_GetConsoleEvents(void)
 	(void)d;
 }
 
-#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE))
+#elif defined (_WIN32)
 static BOOL I_ReadyConsole(HANDLE ci)
 {
 	DWORD gotinput;
@@ -716,17 +627,6 @@ static inline void I_ShutdownConsole(void){}
 void I_GetConsoleEvents(void){}
 static inline void I_StartupConsole(void)
 {
-#ifdef _arch_dreamcast
-	char title[] = "SRB2 for Dreamcast!\n";
-	__set_fpscr(0x00040000); /* ignore FPU underflow */
-	//printf("\nHello world!\n\n");
-	pvr_init_defaults();
-	conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE);
-	conio_set_theme(CONIO_THEME_MATRIX);
-	conio_clear();
-	conio_putstr(title);
-	//printf("\nHello world!\n\n");
-#endif
 #ifdef _DEBUG
 	consolevent = !M_CheckParm("-noconsole");
 #else
@@ -746,7 +646,6 @@ static inline void I_ShutdownConsole(void){}
 //
 void I_StartupKeyboard (void)
 {
-#if !defined (DC)
 #ifdef SIGINT
 	signal(SIGINT , quit_handler);
 #endif
@@ -763,7 +662,6 @@ void I_StartupKeyboard (void)
 	signal(SIGSEGV , signal_handler);
 	signal(SIGABRT , signal_handler);
 	signal(SIGFPE , signal_handler);
-#endif
 }
 
 //
@@ -772,13 +670,9 @@ void I_StartupKeyboard (void)
 void I_OutputMsg(const char *fmt, ...)
 {
 	size_t len;
-	XBOXSTATIC char txt[8192];
+	char txt[8192];
 	va_list  argptr;
 
-#ifdef _arch_dreamcast
-	if (!keyboard_started) conio_printf(fmt);
-#endif
-
 	va_start(argptr,fmt);
 	vsprintf(txt, fmt, argptr);
 	va_end(argptr);
@@ -788,7 +682,7 @@ void I_OutputMsg(const char *fmt, ...)
 	DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt);
 #endif
 
-#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER)
+#if defined (_WIN32) && defined (_MSC_VER)
 	OutputDebugStringA(txt);
 #endif
 
@@ -803,7 +697,7 @@ void I_OutputMsg(const char *fmt, ...)
 	}
 #endif
 
-#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE)
+#if defined (_WIN32)
 #ifdef DEBUGFILE
 	if (debugfile != stderr)
 #endif
@@ -917,22 +811,12 @@ INT32 I_GetKey (void)
 //
 void I_JoyScale(void)
 {
-#ifdef GP2X
-	if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0)
-		Joystick.bGamepadStyle = true;
-	else
-#endif
 	Joystick.bGamepadStyle = cv_joyscale.value==0;
 	JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value;
 }
 
 void I_JoyScale2(void)
 {
-#ifdef GP2X
-	if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0)
-		Joystick.bGamepadStyle = true;
-	else
-#endif
 	Joystick2.bGamepadStyle = cv_joyscale2.value==0;
 	JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value;
 }
@@ -1035,11 +919,6 @@ void I_GetJoystickEvents(void)
 					event.type = ev_keydown;
 				else
 					event.type = ev_keyup;
-#ifdef _PSP
-				if (i == 12)
-					event.data1 = KEY_ESCAPE;
-				else
-#endif
 				event.data1 = KEY_JOY1 + i;
 				D_PostEvent(&event);
 			}
@@ -1090,13 +969,11 @@ void I_GetJoystickEvents(void)
 			axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1);
 		else axisy = 0;
 
-#ifdef _arch_dreamcast // -128 to 127
-		axisx = axisx*8;
-		axisy = axisy*8;
-#else // -32768 to 32767
+
+		// -32768 to 32767
 		axisx = axisx/32;
 		axisy = axisy/32;
-#endif
+
 
 		if (Joystick.bGamepadStyle)
 		{
@@ -1214,15 +1091,11 @@ static int joy_open(const char *fname)
 		if (JoyInfo.buttons > JOYBUTTONS)
 			JoyInfo.buttons = JOYBUTTONS;
 
-#ifdef DC
-		JoyInfo.hats = 0;
-#else
 		JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev);
 		if (JoyInfo.hats > JOYHATS)
 			JoyInfo.hats = JOYHATS;
 
 		JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
-#endif
 
 		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
 
@@ -1379,13 +1252,9 @@ void I_GetJoystick2Events(void)
 			axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1);
 		else axisy = 0;
 
-#ifdef _arch_dreamcast // -128 to 127
-		axisx = axisx*8;
-		axisy = axisy*8;
-#else // -32768 to 32767
+		// -32768 to 32767
 		axisx = axisx/32;
 		axisy = axisy/32;
-#endif
 
 		if (Joystick2.bGamepadStyle)
 		{
@@ -1504,15 +1373,11 @@ static int joy_open2(const char *fname)
 		if (JoyInfo2.buttons > JOYBUTTONS)
 			JoyInfo2.buttons = JOYBUTTONS;
 
-#ifdef DC
-		JoyInfo2.hats = 0;
-#else
 		JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev);
 		if (JoyInfo2.hats > JOYHATS)
 			JoyInfo2.hats = JOYHATS;
 
 		JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
-#endif
 
 		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
 
@@ -1796,7 +1661,7 @@ static void I_ShutdownMouse2(void)
 	if (fdmouse2 != -1) close(fdmouse2);
 	mouse2_started = 0;
 }
-#elif defined (_WIN32) && !defined (_XBOX)
+#elif defined (_WIN32)
 
 static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
 
@@ -1994,7 +1859,7 @@ void I_StartupMouse2(void)
 	}
 	mouse2_started = 1;
 	I_AddExitFunc(I_ShutdownMouse2);
-#elif defined (_WIN32) && !defined (_XBOX)
+#elif defined (_WIN32)
 	DCB dcb;
 
 	if (mouse2filehandle != INVALID_HANDLE_VALUE)
@@ -2089,7 +1954,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
 	return &emptycmd2;
 }
 
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#if defined (_WIN32)
 static HMODULE winmm = NULL;
 static DWORD starttickcount = 0; // hack for win2k time bug
 static p_timeGetTime pfntimeGetTime = NULL;
@@ -2159,13 +2024,8 @@ static void I_ShutdownTimer(void)
 //
 tic_t I_GetTime (void)
 {
-#ifdef _arch_dreamcast
-	static Uint64 basetime = 0;
-	       Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast
-#else
 	static Uint32 basetime = 0;
 	       Uint32 ticks = SDL_GetTicks();
-#endif
 
 	if (!basetime)
 		basetime = ticks;
@@ -2174,11 +2034,7 @@ tic_t I_GetTime (void)
 
 	ticks = (ticks*TICRATE);
 
-#if 0 //#ifdef _WIN32_WCE
-	ticks = (ticks/10);
-#else
 	ticks = (ticks/1000);
-#endif
 
 	return (tic_t)ticks;
 }
@@ -2189,7 +2045,7 @@ tic_t I_GetTime (void)
 //
 FUNCMATH void I_StartupTimer(void)
 {
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#ifdef _WIN32
 	// for win2k time bug
 	if (M_CheckParm("-gettickcount"))
 	{
@@ -2205,9 +2061,6 @@ FUNCMATH void I_StartupTimer(void)
 		pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
 	}
 	I_AddExitFunc(I_ShutdownTimer);
-#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads?
-	if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
-		I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError());
 #endif
 }
 
@@ -2215,35 +2068,14 @@ FUNCMATH void I_StartupTimer(void)
 
 void I_Sleep(void)
 {
-#if !(defined (_arch_dreamcast) || defined (_XBOX))
 	if (cv_sleep.value != -1)
 		SDL_Delay(cv_sleep.value);
-#endif
 }
 
 INT32 I_StartupSystem(void)
 {
 	SDL_version SDLcompiled;
 	SDL_version SDLlinked;
-#ifdef _XBOX
-#ifdef __GNUC__
-	char DP[] ="      Sonic Robo Blast 2!\n";
-	debugPrint(DP);
-#endif
-	unlink("e:/Games/SRB2/stdout.txt");
-	freopen("e:/Games/SRB2/stdout.txt", "w+", stdout);
-	unlink("e:/Games/SRB2/stderr.txt");
-	freopen("e:/Games/SRB2/stderr.txt", "w+", stderr);
-#endif
-#ifdef _arch_dreamcast
-#ifdef _DEBUG
-	//gdb_init();
-#endif
-	printf(__FILE__":%i\n",__LINE__);
-#ifdef _DEBUG
-	//gdb_breakpoint();
-#endif
-#endif
 	SDL_VERSION(&SDLcompiled)
 	SDL_GetVersion(&SDLlinked);
 	I_StartupConsole();
@@ -2251,11 +2083,7 @@ INT32 I_StartupSystem(void)
 	 SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
 	I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
 	 SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
-#if 0 //#ifdef GP2X //start up everything
-	if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
-#else
-	if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0)
-#endif
+	if (SDL_Init(0) < 0)
 		I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
 #ifndef NOMUMBLE
 	I_SetupMumble();
@@ -2297,9 +2125,7 @@ void I_Quit(void)
 	I_ShutdownGraphics();
 	I_ShutdownInput();
 	I_ShutdownSystem();
-#ifndef _arch_dreamcast
 	SDL_Quit();
-#endif
 	/* if option -noendtxt is set, don't print the text */
 	if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR)
 	{
@@ -2308,10 +2134,6 @@ void I_Quit(void)
 	}
 death:
 	W_Shutdown();
-#ifdef GP2X
-	chdir("/usr/gp2x");
-	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
 	exit(0);
 }
 
@@ -2364,10 +2186,8 @@ void I_Error(const char *error, ...)
 			I_ShutdownInput();
 		if (errorcount == 7)
 			I_ShutdownSystem();
-#ifndef _arch_dreamcast
 		if (errorcount == 8)
 			SDL_Quit();
-#endif
 		if (errorcount == 9)
 		{
 			M_SaveConfig(NULL);
@@ -2386,12 +2206,6 @@ void I_Error(const char *error, ...)
 				buffer, NULL);
 
 			W_Shutdown();
-
-#ifdef GP2X
-			chdir("/usr/gp2x");
-			execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-
 			exit(-1); // recursive errors detected
 		}
 	}
@@ -2427,9 +2241,7 @@ void I_Error(const char *error, ...)
 	I_ShutdownGraphics();
 	I_ShutdownInput();
 	I_ShutdownSystem();
-#ifndef _arch_dreamcast
 	SDL_Quit();
-#endif
 
 	// Implement message box with SDL_ShowSimpleMessageBox,
 	// which should fail gracefully if it can't put a message box up
@@ -2449,11 +2261,6 @@ void I_Error(const char *error, ...)
 	*(INT32 *)2 = 4; //Alam: Debug!
 #endif
 
-#ifdef GP2X
-	chdir("/usr/gp2x");
-	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-
 	exit(-1);
 }
 
@@ -2516,7 +2323,7 @@ void I_ShutdownSystem(void)
 	for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
 		if (quit_funcs[c])
 			(*quit_funcs[c])();
-#ifdef  LOGMESSAGES
+#ifdef LOGMESSAGES
 	if (logstream)
 	{
 		I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
@@ -2529,10 +2336,8 @@ void I_ShutdownSystem(void)
 
 void I_GetDiskFreeSpace(INT64 *freespace)
 {
-#if defined (_arch_dreamcast) || defined (_PSP)
-	*freespace = 0;
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3)
+#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
+#if defined (SOLARIS) || defined (__HAIKU__)
 	*freespace = INT32_MAX;
 	return;
 #else // Both Linux and BSD have this, apparently.
@@ -2544,7 +2349,7 @@ void I_GetDiskFreeSpace(INT64 *freespace)
 	}
 	*freespace = stfs.f_bavail * stfs.f_bsize;
 #endif
-#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#elif defined (_WIN32)
 	static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
 	static boolean testwin95 = false;
 	ULARGE_INTEGER usedbytes, lfreespace;
@@ -2575,13 +2380,6 @@ void I_GetDiskFreeSpace(INT64 *freespace)
 
 char *I_GetUserName(void)
 {
-#ifdef GP2X
-	static char username[MAXPLAYERNAME] = "GP2XUSER";
-	return username;
-#elif defined (PSP)
-	static char username[MAXPLAYERNAME] = "PSPUSER";
-	return username;
-#elif !(defined (_WIN32_WCE) || defined (_XBOX))
 	static char username[MAXPLAYERNAME];
 	char *p;
 #ifdef _WIN32
@@ -2613,16 +2411,15 @@ char *I_GetUserName(void)
 
 	if (strcmp(username, "") != 0)
 		return username;
-#endif
 	return NULL; // dummy for platform independent version
 }
 
 INT32 I_mkdir(const char *dirname, INT32 unixright)
 {
 //[segabor]
-#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__)
+#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__)
 	return mkdir(dirname, unixright);
-#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
+#elif defined (_WIN32)
 	UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt...
 	return CreateDirectoryA(dirname, NULL);
 #else
@@ -2636,9 +2433,6 @@ char *I_GetEnv(const char *name)
 {
 #ifdef NEED_SDL_GETENV
 	return SDL_getenv(name);
-#elif defined(_WIN32_WCE)
-	(void)name;
-	return NULL;
 #else
 	return getenv(name);
 #endif
@@ -2648,8 +2442,6 @@ INT32 I_PutEnv(char *variable)
 {
 #ifdef NEED_SDL_GETENV
 	return SDL_putenv(variable);
-#elif defined(_WIN32_WCE)
-	return ((variable)?-1:0);
 #else
 	return putenv(variable);
 #endif
@@ -2789,15 +2581,6 @@ static const char *locateWad(void)
 	if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr))
 		return envstr;
 
-#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP)
-	// examine argv[0]
-	strcpy(returnWadPath, myargv[0]);
-	pathonly(returnWadPath);
-	I_PutEnv(va("HOME=%s",returnWadPath));
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-
 #ifndef NOCWD
 	I_OutputMsg(",.");
 	// examine current dir
@@ -2916,9 +2699,9 @@ const char *I_LocateWad(void)
 	if (waddir)
 	{
 		// change to the directory where we found srb2.srb
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#if defined (_WIN32)
 		SetCurrentDirectoryA(waddir);
-#elif !defined (_WIN32_WCE) && !defined (_PS3)
+#else
 		if (chdir(waddir) == -1)
 			I_OutputMsg("Couldn't change working directory\n");
 #endif
@@ -2935,17 +2718,7 @@ const char *I_LocateWad(void)
 // quick fix for compil
 UINT32 I_GetFreeMem(UINT32 *total)
 {
-#if defined (_arch_dreamcast)
-	//Dreamcast!
-	if (total)
-		*total = 16<<20;
-	return 8<<20;
-#elif defined (_PSP)
-	// PSP
-	if (total)
-		*total = 32<<20;
-	return 16<<20;
-#elif defined (FREEBSD)
+#ifdef FREEBSD
 	struct vmmeter sum;
 	kvm_t *kd;
 	struct nlist namelist[] =
@@ -2982,7 +2755,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
 	if (total)
 		*total = 32 << 20;
 	return 32 << 20;
-#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
+#elif defined (_WIN32)
 	MEMORYSTATUS info;
 
 	info.dwLength = sizeof (MEMORYSTATUS);
@@ -2990,16 +2763,6 @@ UINT32 I_GetFreeMem(UINT32 *total)
 	if (total)
 		*total = (UINT32)info.dwTotalPhys;
 	return (UINT32)info.dwAvailPhys;
-#elif defined (__OS2__)
-	UINT32 pr_arena;
-
-	if (total)
-		DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
-							(PVOID) total, sizeof (UINT32));
-	DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
-				(PVOID) &pr_arena, sizeof (UINT32));
-
-	return pr_arena;
 #elif defined (LINUX) || defined (LINUX64)
 	/* Linux */
 	char buf[1024];
@@ -3054,7 +2817,7 @@ UINT32 I_GetFreeMem(UINT32 *total)
 
 const CPUInfoFlags *I_CPUInfo(void)
 {
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
+#if defined (_WIN32)
 	static CPUInfoFlags WIN_CPUInfo;
 	SYSTEM_INFO SI;
 	p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
diff --git a/src/sdl/i_ttf.c b/src/sdl/i_ttf.c
index 4a41f120e81d88d4234b840afb8eeec35970ee2b..f2cd497eec03f24a6e3088e7e4f64e0925e16cc1 100644
--- a/src/sdl/i_ttf.c
+++ b/src/sdl/i_ttf.c
@@ -26,10 +26,7 @@
 #include "i_ttf.h"
 
 // Search directories to find aforementioned TTF file.
-#ifdef _PS3
-#include <sysutil/video.h>
-#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
+#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 #define FONTSEARCHPATH1 "/usr/share/fonts"
 #define FONTSEARCHPATH2 "/usr/local/share/fonts"
 #define FONTSEARCHPATH3 "/usr/games/SRB2"
@@ -233,16 +230,9 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
 {
 	char *fontpath = NULL;
 	INT32 fontstatus = -1;
-#ifdef _PS3
-	videoState state;
-	videoGetState(0, 0, &state);
-	videoGetResolution(state.displayMode.resolution, &res);
-	bitsperpixel = 24;
-#else
 	res.width = 320;
 	res.height = 200;
 	bitsperpixel = 8;
-#endif
 
 	// what's the point of trying to display an error?
 	// SDL_ttf is not started, can't display anything to screen (presumably)...
diff --git a/src/sdl/i_ttf.h b/src/sdl/i_ttf.h
index 929c8021ccfae374c30415afca9a09e68ccc1c50..5fae9ed1632000e8d015dfce0f3f83e7ce7c1162 100644
--- a/src/sdl/i_ttf.h
+++ b/src/sdl/i_ttf.h
@@ -57,13 +57,12 @@ int currentfonthinting;
 int currentfontoutline;
 #endif
 
-#ifndef _PS3
 typedef struct
 {
 	UINT16 width;
 	UINT16 height;
 } VideoResolution;
-#endif
+
 UINT8 bitsperpixel;
 
 typedef enum
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 752c443f5b4e01d76c0daf77d98590450bfb729e..893827a7bd4ace23bdc391ad760606772172091d 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -47,7 +47,7 @@
 
 #include "../doomdef.h"
 
-#if defined (_WIN32)
+#ifdef _WIN32
 #include "SDL_syswm.h"
 #endif
 
@@ -941,6 +941,7 @@ static inline boolean I_SkipFrame(void)
 		case GS_LEVEL:
 			if (!paused)
 				return false;
+			/* FALLTHRU */
 		//case GS_TIMEATTACK: -- sorry optimisation but now we have a cool level platter and that being laggardly looks terrible
 		case GS_WAITINGPLAYERS:
 			return skip; // Skip odd frames
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index 88bbadd20ad91ecd1aa7a41230700539bd7b7fca..71832459182305a2bed1cf1e9e94446508fb8dd0 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -43,12 +43,10 @@
 #define HAVE_ZLIB
 
 #ifndef _MSC_VER
-#ifndef _WII
 #ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #endif
-#endif
 
 #ifndef _LFS64_LARGEFILE
 #define _LFS64_LARGEFILE
diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index 0face92e25c03749c6e1ca5a0c7a431cadf63e3d..6ca11c9ef46b9c6e30c6935d1b7d633c2e7c1147 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -49,7 +49,7 @@
 #define MIX_CHANNELS 8
 #endif
 
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
+#ifdef _WIN32
 #include <direct.h>
 #elif defined (__GNUC__)
 #include <unistd.h>
@@ -85,21 +85,11 @@
 //  mixing buffer, and the samplerate of the raw data.
 
 // Needed for calling the actual sound output.
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
-#define NUM_CHANNELS            MIX_CHANNELS
-#else
 #define NUM_CHANNELS            MIX_CHANNELS*4
-#endif
 
 #define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx)
 
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP)
-static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer
-#elif defined(GP2X)
-static Uint16 samplecount = 128;
-#else
 static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer
-#endif
 
 typedef struct chan_struct
 {
@@ -151,17 +141,10 @@ static SDL_bool musicStarted = SDL_FALSE;
 #ifdef HAVE_MIXER
 static SDL_mutex *Msc_Mutex = NULL;
 /* FIXME: Make this file instance-specific */
-#ifdef _arch_dreamcast
-#define MIDI_PATH     "/ram"
-#elif defined(GP2X)
-#define MIDI_PATH     "/mnt/sd/srb2"
-#define MIDI_PATH2    "/tmp/mnt/sd/srb2"
-#else
 #define MIDI_PATH     srb2home
 #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
 #define MIDI_PATH2    "/tmp"
 #endif
-#endif
 #define MIDI_TMPFILE  "srb2music"
 #define MIDI_TMPFILE2 "srb2wav"
 static INT32 musicvol = 62;
@@ -176,7 +159,7 @@ static SDL_bool canlooping = SDL_TRUE;
 
 #if SDL_MIXER_VERSION_ATLEAST(1,2,7)
 #define USE_RWOPS // ok, USE_RWOPS is in here
-#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X)
+#if 0 // defined(_WIN32)
 #undef USE_RWOPS
 #endif
 #endif
@@ -1188,13 +1171,6 @@ void I_StartupSound(void)
 #endif
 #ifndef HAVE_MIXER
 	nomidimusic = nodigimusic = true;
-#endif
-#ifdef DC
-	//nosound = true;
-#ifdef HAVE_MIXER
-	nomidimusic = true;
-	nodigimusic = true;
-#endif
 #endif
 
 	memset(channels, 0, sizeof (channels)); //Alam: Clean it
@@ -1243,13 +1219,7 @@ void I_StartupSound(void)
 		audio.samples /= 2;
 	}
 
-#if defined (_PSP)  && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice
-	I_SetChannels();
-	sound_started = true;
-	Snd_Mutex = SDL_CreateMutex();
-#else
 	if (nosound)
-#endif
 		return;
 
 #ifdef HW3SOUND
@@ -1302,7 +1272,7 @@ void I_StartupSound(void)
 			snddev.bps = 16;
 			snddev.sample_rate = audio.freq;
 			snddev.numsfxs = NUMSFX;
-#if defined (_WIN32) && !defined (_XBOX)
+#if defined (_WIN32)
 			snddev.cooplevel = 0x00000002;
 			snddev.hWnd = vid.WndParent;
 #endif
@@ -1520,9 +1490,7 @@ void I_InitMusic(void)
 	I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
 	            MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch);
 #ifdef MIXER_POS
-#ifndef _WII
 	if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7)
-#endif
 		canlooping = SDL_FALSE;
 #endif
 #ifdef USE_RWOPS
@@ -1531,13 +1499,11 @@ void I_InitMusic(void)
 #endif
 	I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
 	            MIXlinked->major, MIXlinked->minor, MIXlinked->patch);
-#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII))
 	if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz
 	{
 		audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq));
 		audio.freq = 44100; //Alam: to keep it around the same XX ms
 	}
-#endif
 
 	if (sound_started
 #ifdef HW3SOUND
@@ -1757,7 +1723,7 @@ static void I_CleanupGME(void *userdata)
 static boolean I_StartGMESong(const char *musicname, boolean looping)
 {
 #ifdef HAVE_LIBGME
-	XBOXSTATIC char filename[9];
+	char filename[9];
 	void *data;
 	lumpnum_t lumpnum;
 	size_t lumplength;
@@ -1812,7 +1778,7 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
 boolean I_StartDigSong(const char *musicname, boolean looping)
 {
 #ifdef HAVE_MIXER
-	XBOXSTATIC char filename[9];
+	char filename[9];
 	void *data;
 	lumpnum_t lumpnum;
 	size_t lumplength;
@@ -1854,7 +1820,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 	{
 		size_t scan;
 		const char *dataum = data;
-		XBOXSTATIC char looplength[64];
+		char looplength[64];
 		UINT32 loopstart = 0;
 		UINT8 newcount = 0;
 
@@ -1929,7 +1895,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 		if (loopstart > 0)
 		{
 			loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs
-//#ifdef GP2X//#ifdef PARANOIA
+//#ifdef PARANOIA
 			//I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig);
 //#endif
 		}
diff --git a/src/sdl12/IMG_xpm.c b/src/sdl12/IMG_xpm.c
deleted file mode 100644
index e08736d66515b89367f29022afd4ed663e570497..0000000000000000000000000000000000000000
--- a/src/sdl12/IMG_xpm.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
-    SDL_image:  An example image loading library for use with SDL
-    Copyright (C) 1999-2004 Sam Lantinga
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Sam Lantinga
-    slouken@libsdl.org
-*/
-
-/* $Id: IMG_xpm.c,v 1.10 2004/01/04 22:04:38 slouken Exp $ */
-
-/*
- * XPM (X PixMap) image loader:
- *
- * Supports the XPMv3 format, EXCEPT:
- * - hotspot coordinates are ignored
- * - only colour ('c') colour symbols are used
- * - rgb.txt is not used (for portability), so only RGB colours
- *   are recognized (#rrggbb etc) - only a few basic colour names are
- *   handled
- *
- * The result is an 8bpp indexed surface if possible, otherwise 32bpp.
- * The colourkey is correctly set if transparency is used.
- *
- * Besides the standard API, also provides
- *
- *     SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
- *
- * that reads the image data from an XPM file included in the C source.
- *
- * TODO: include rgb.txt here. The full table (from solaris 2.6) only
- * requires about 13K in binary form.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-//#include "SDL_image.h"
-
-
-#ifdef LOAD_XPM
-
-/* See if an image is contained in a data source */
-#if 0
-int IMG_isXPM(SDL_RWops *src)
-{
-        char magic[9];
-
-        return (SDL_RWread(src, magic, sizeof (magic), 1)
-                && memcmp(magic, "/* XPM */", 9) == 0);
-}
-#endif
-
-/* Hash table to look up colors from pixel strings */
-#define STARTING_HASH_SIZE 256
-
-struct hash_entry {
-        char *key;
-        Uint32 color;
-        struct hash_entry *next;
-};
-
-struct color_hash {
-        struct hash_entry **table;
-        struct hash_entry *entries; /* array of all entries */
-        struct hash_entry *next_free;
-        size_t size;
-        int maxnum;
-};
-
-static int hash_key(const char *key, int cpp, size_t size)
-{
-        int hash;
-
-        hash = 0;
-        while ( cpp-- > 0 ) {
-                hash = hash * 33 + *key++;
-        }
-        return (int)(hash & (size - 1));
-}
-
-static struct color_hash *create_colorhash(int maxnum)
-{
-        size_t bytes;
-		int s;
-        struct color_hash *hash;
-
-        /* we know how many entries we need, so we can allocate
-           everything here */
-        hash = malloc(sizeof *hash);
-        if (!hash)
-                return NULL;
-
-        /* use power-of-2 sized hash table for decoding speed */
-        for (s = STARTING_HASH_SIZE; s < maxnum; s <<= 1)
-                ;
-        hash->size = s;
-        hash->maxnum = maxnum;
-        bytes = hash->size * sizeof (struct hash_entry **);
-        hash->entries = NULL;        /* in case malloc fails */
-        hash->table = malloc(bytes);
-        if (!hash->table)
-                return NULL;
-        memset(hash->table, 0, bytes);
-        hash->entries = malloc(maxnum * sizeof (struct hash_entry));
-        if (!hash->entries)
-        {
-                free(hash->table);
-                return NULL;
-        }
-        hash->next_free = hash->entries;
-        return hash;
-}
-
-static int add_colorhash(struct color_hash *hash,
-                         char *key, int cpp, Uint32 color)
-{
-        const int indexkey = hash_key(key, cpp, hash->size);
-        struct hash_entry *e = hash->next_free++;
-        e->color = color;
-        e->key = key;
-        e->next = hash->table[indexkey];
-        hash->table[indexkey] = e;
-        return 1;
-}
-
-/* fast lookup that works if cpp == 1 */
-#define QUICK_COLORHASH(hash, key) ((hash)->table[*(const Uint8 *)(key)]->color)
-
-static Uint32 get_colorhash(struct color_hash *hash, const char *key, int cpp)
-{
-        struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
-        while (entry) {
-                if (memcmp(key, entry->key, cpp) == 0)
-                        return entry->color;
-                entry = entry->next;
-        }
-        return 0;                /* garbage in - garbage out */
-}
-
-static void free_colorhash(struct color_hash *hash)
-{
-        if (hash && hash->table) {
-                free(hash->table);
-                free(hash->entries);
-                free(hash);
-        }
-}
-
-/* portable case-insensitive string comparison */
-static int string_equal(const char *a, const char *b, size_t n)
-{
-        while (*a && *b && n) {
-                if (toupper((unsigned char)*a) != toupper((unsigned char)*b))
-                        return 0;
-                a++;
-                b++;
-                n--;
-        }
-        return *a == *b;
-}
-
-#undef ARRAYSIZE
-#define ARRAYSIZE(a) (int)(sizeof (a) / sizeof ((a)[0]))
-
-/*
- * convert colour spec to RGB (in 0xrrggbb format).
- * return 1 if successful.
- */
-static int color_to_rgb(const char *spec, size_t speclen, Uint32 *rgb)
-{
-        /* poor man's rgb.txt */
-        static struct { const char *name; Uint32 rgb; } known[] = {
-                {"none",  0xffffffff},
-                {"black", 0x00000000},
-                {"white", 0x00ffffff},
-                {"red",   0x00ff0000},
-                {"green", 0x0000ff00},
-                {"blue",  0x000000ff}
-        };
-
-        if (spec[0] == '#') {
-                char buf[7];
-                switch (speclen) {
-                case 4:
-                        buf[0] = buf[1] = spec[1];
-                        buf[2] = buf[3] = spec[2];
-                        buf[4] = buf[5] = spec[3];
-                        break;
-                case 7:
-                        memcpy(buf, spec + 1, 6);
-                        break;
-                case 13:
-                        buf[0] = spec[1];
-                        buf[1] = spec[2];
-                        buf[2] = spec[5];
-                        buf[3] = spec[6];
-                        buf[4] = spec[9];
-                        buf[5] = spec[10];
-                        break;
-                }
-                buf[6] = '\0';
-                *rgb = (Uint32)strtol(buf, NULL, 16);
-                return 1;
-        } else {
-                int i;
-                for (i = 0; i < ARRAYSIZE(known); i++)
-                        if (string_equal(known[i].name, spec, speclen)) {
-                                *rgb = known[i].rgb;
-                                return 1;
-                        }
-                return 0;
-        }
-}
-
-#ifndef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
-static char *linebuf;
-static int buflen;
-static const char *error;
-
-/*
- * Read next line from the source.
- * If len > 0, it's assumed to be at least len chars (for efficiency).
- * Return NULL and set error upon EOF or parse error.
- */
-static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
-{
-        char *linebufnew;
-        if (lines) {
-                return *(*lines)++;
-        } else {
-                char c;
-                int n;
-                do {
-                        if (SDL_RWread(src, &c, 1, 1) <= 0) {
-                                error = "Premature end of data";
-                                return NULL;
-                        }
-                } while (c != '"');
-                if (len) {
-                        len += 4;        /* "\",\n\0" */
-                        if (len > buflen){
-                                buflen = len;
-                                linebufnew = realloc(linebuf, buflen);
-                                if(!linebufnew) {
-                                        free(linebuf);
-                                        error = "Out of memory";
-                                        return NULL;
-                                }
-                                linebuf = linebufnew;
-                        }
-                        if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
-                                error = "Premature end of data";
-                                return NULL;
-                        }
-                        n = len - 2;
-                } else {
-                        n = 0;
-                        do {
-                                if (n >= buflen - 1) {
-                                        if (buflen == 0)
-                                                buflen = 16;
-                                        buflen *= 2;
-                                        linebufnew = realloc(linebuf, buflen);
-                                        if(!linebufnew) {
-                                                free(linebuf);
-                                                error = "Out of memory";
-                                                return NULL;
-                                        }
-                                        linebuf = linebufnew;
-                                }
-                                if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
-                                        error = "Premature end of data";
-                                        return NULL;
-                                }
-                        } while (linebuf[n++] != '"');
-                        n--;
-                }
-                linebuf[n] = '\0';
-                return linebuf;
-        }
-}
-
-#define SKIPSPACE(p)                            \
-do {                                            \
-        while (isspace((unsigned char)*(p)))        \
-              ++(p);                                \
-} while (0)
-
-#define SKIPNONSPACE(p)                                 \
-do {                                                    \
-        while (!isspace((unsigned char)*(p)) && *p)        \
-              ++(p);                                        \
-} while (0)
-
-/* read XPM from either array or RWops */
-static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
-{
-        SDL_Surface *image = NULL;
-        int indexc;
-        int x, y;
-        int w, h, ncolors, cpp;
-        int indexed;
-        Uint8 *dst;
-        struct color_hash *colors = NULL;
-        SDL_Color *im_colors = NULL;
-        char *keystrings = NULL, *nextkey;
-        const char *line;
-        const char ***xpmlines = NULL;
-        int pixels_len;
-
-        error = NULL;
-        linebuf = NULL;
-        buflen = 0;
-
-        if (xpm)
-                xpmlines = &xpm;
-
-        line = get_next_line(xpmlines, src, 0);
-        if (!line)
-                goto done;
-        /*
-         * The header string of an XPMv3 image has the format
-         *
-         * <width> <height> <ncolors> <cpp> [ <hotspot_x> <hotspot_y> ]
-         *
-         * where the hotspot coords are intended for mouse cursors.
-         * Right now we don't use the hotspots but it should be handled
-         * one day.
-         */
-        if (sscanf(line, "%d %d %d %d", &w, &h, &ncolors, &cpp) != 4
-           || w <= 0 || h <= 0 || ncolors <= 0 || cpp <= 0) {
-                error = "Invalid format description";
-                goto done;
-        }
-
-        keystrings = malloc(ncolors * cpp);
-        if (!keystrings) {
-                error = "Out of memory";
-                goto done;
-        }
-        nextkey = keystrings;
-
-        /* Create the new surface */
-        if (ncolors <= 256) {
-                indexed = 1;
-                image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
-                                             0, 0, 0, 0);
-                im_colors = image->format->palette->colors;
-                image->format->palette->ncolors = ncolors;
-        } else {
-                indexed = 0;
-                image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
-                                             0xff0000, 0x00ff00, 0x0000ff, 0);
-        }
-        if (!image) {
-                /* Hmm, some SDL error (out of memory?) */
-                goto done;
-        }
-
-        /* Read the colors */
-        colors = create_colorhash(ncolors);
-        if (!colors) {
-                error = "Out of memory";
-                goto done;
-        }
-        for (indexc = 0; indexc < ncolors; ++indexc ) {
-                const char *p;
-                line = get_next_line(xpmlines, src, 0);
-                if (!line)
-                        goto done;
-
-                p = line + cpp + 1;
-
-                /* parse a colour definition */
-                for (;;) {
-                        char nametype;
-                        const char *colname;
-                        Uint32 rgb, pixel;
-
-                        SKIPSPACE(p);
-                        if (!*p) {
-                                error = "colour parse error";
-                                goto done;
-                        }
-                        nametype = *p;
-                        SKIPNONSPACE(p);
-                        SKIPSPACE(p);
-                        colname = p;
-                        SKIPNONSPACE(p);
-                        if (nametype == 's')
-                                continue;      /* skip symbolic colour names */
-
-                        if (!color_to_rgb(colname, p - colname, &rgb))
-                                continue;
-
-                        memcpy(nextkey, line, cpp);
-                        if (indexed) {
-                                SDL_Color *c = im_colors + indexc;
-                                c->r = (Uint8)(rgb >> 16);
-                                c->g = (Uint8)(rgb >> 8);
-                                c->b = (Uint8)(rgb);
-                                pixel = indexc;
-                        } else
-                                pixel = rgb;
-                        add_colorhash(colors, nextkey, cpp, pixel);
-                        nextkey += cpp;
-                        if (rgb == 0xffffffff)
-                                SDL_SetColorKey(image, SDL_SRCCOLORKEY, pixel);
-                        break;
-                }
-        }
-
-        /* Read the pixels */
-        pixels_len = w * cpp;
-        dst = image->pixels;
-        for (y = 0; y < h; y++) {
-                line = get_next_line(xpmlines, src, pixels_len);
-                if (indexed) {
-                        /* optimization for some common cases */
-                        if (cpp == 1)
-                                for (x = 0; x < w; x++)
-                                        dst[x] = (Uint8)QUICK_COLORHASH(colors,
-                                                                 line + x);
-                        else
-                                for (x = 0; x < w; x++)
-                                        dst[x] = (Uint8)get_colorhash(colors,
-                                                               line + x * cpp,
-                                                               cpp);
-                } else {
-                        for (x = 0; x < w; x++)
-                                ((Uint32*)dst)[x] = get_colorhash(colors,
-                                                                line + x * cpp,
-                                                                  cpp);
-                }
-                dst += image->pitch;
-        }
-
-done:
-        if (error) {
-                SDL_FreeSurface(image);
-                image = NULL;
-                SDL_SetError(error);
-        }
-        free(keystrings);
-        free_colorhash(colors);
-        free(linebuf);
-        return(image);
-}
-
-/* Load a XPM type image from an RWops datasource */
-#if 0
-SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
-{
-        if ( !src ) {
-                /* The error message has been set in SDL_RWFromFile */
-                return NULL;
-        }
-        return load_xpm(NULL, src);
-}
-#endif
-
-static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
-{
-        return load_xpm(xpm, NULL);
-}
-
-#else  /* not LOAD_XPM */
-
-/* See if an image is contained in a data source */
-#if 0
-int IMG_isXPM(SDL_RWops *src)
-{
-        return(0);
-}
-
-/* Load a XPM type image from an SDL datasource */
-SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
-{
-        return(NULL);
-}
-#endif
-
-static inline SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
-{
-    return NULL;
-}
-#endif /* not LOAD_XPM */
diff --git a/src/sdl12/MakeCYG.cfg b/src/sdl12/MakeCYG.cfg
deleted file mode 100644
index 5907579c1bc9d16abb0e338cb709566fd75b6c61..0000000000000000000000000000000000000000
--- a/src/sdl12/MakeCYG.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# sdl/makeCYG.cfg for SRB2/Cygwin
-#
-
-#
-#Cygwin, for debugging
-
-	NOHW=1
-	NOHS=1
-	NOASM=1
-
-	OPTS+=-DLINUX
-
-	i_system_o+=$(OBJDIR)/SRB2.res
-
-	# name of the exefile
-	EXENAME?=lsdlsrb2.exe
diff --git a/src/sdl12/MakeNIX.cfg b/src/sdl12/MakeNIX.cfg
deleted file mode 100644
index 457f52301f69d458486abb6320f55dec40d0e3c2..0000000000000000000000000000000000000000
--- a/src/sdl12/MakeNIX.cfg
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# sdl/makeNIX.cfg for SRB2/?nix
-#
-
-#Valgrind support
-ifdef VALGRIND
-VALGRIND_PKGCONFIG?=valgrind
-VALGRIND_CFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --cflags)
-VALGRIND_LDFLAGS?=$(shell $(PKG_CONFIG) $(VALGRIND_PKGCONFIG) --libs)
-ZDEBUG=1
-LIBS+=$(VALGRIND_LDFLAGS)
-ifdef GCC46
-WFLAGS+=-Wno-error=unused-but-set-variable
-WFLAGS+=-Wno-unused-but-set-variable
-endif
-endif
-
-#
-#here is GNU/Linux and other
-#
-
-	OPTS=-DUNIXCOMMON
-
-	#LDFLAGS = -L/usr/local/lib
-	LIBS=-lm
-ifdef LINUX
-	LIBS+=-lrt
-ifdef NOTERMIOS
-	OPTS+=-DNOTERMIOS
-endif
-endif
-
-#
-#here is Solaris
-#
-ifdef SOLARIS
-	NOIPX=1
-	NOASM=1
-	OPTS+=-DSOLARIS -DINADDR_NONE=INADDR_ANY -DBSD_COMP
-	OPTS+=-I/usr/local/include -I/opt/sfw/include
-	LDFLAGS+=-L/opt/sfw/lib
-	LIBS+=-lsocket -lnsl
-endif
-
-#
-#here is FreeBSD
-#
-ifdef FREEBSD
-	OPTS+=-DLINUX -DFREEBSD -I/usr/X11R6/include
-	SDL_CONFIG?=sdl11-config
-	LDFLAGS+=-L/usr/X11R6/lib
-	LIBS+=-lipx -lkvm
-endif
-
-#
-#here is GP2x (arm-gp2x-linux)
-#
-ifdef GP2X
-	PNG_CONFIG?=$(PREFIX)-libpng12-config
-ifdef STATIC #need a better setting name
-	CFLAGS+=-I$(OPEN2X)/include
-ifndef NOMIXER
-	LIBS+=-lvorbisidec
-ifdef MIKMOD
-	LIBS+=-lmikmod
-endif
-ifdef SMPEGLIB
-	LIBS+=-lsmpeg
-	LD=$(CXX)
-endif
-endif
-	NONET=1
-endif
-ifndef ARCHNAME
-"error"
-endif
-	NONX86=1
-	NOHW=1
-	NOHS=1
-	NOMD5=1
-	WFLAGS+=-O0
-	OPTS+=-DGP2X -ffast-math -mcpu=arm920t
-	EXENAME?=SRB2GP2X.gpe
-endif
-
-ifndef NOHW
-	OPTS+=-I/usr/X11R6/include
-	LDFLAGS+=-L/usr/X11R6/lib
-endif
-
-	# name of the exefile
-	EXENAME?=lsdlsrb2
diff --git a/src/sdl12/Makefile.cfg b/src/sdl12/Makefile.cfg
deleted file mode 100644
index 1d404c4c9393240e7e3bc147f360f977cb7b589f..0000000000000000000000000000000000000000
--- a/src/sdl12/Makefile.cfg
+++ /dev/null
@@ -1,163 +0,0 @@
-#
-# sdl/makefile.cfg for SRB2/SDL
-#
-
-#
-#SDL...., *looks at Alam*, THIS IS A MESS!
-#
-
-ifdef UNIXCOMMON
-include sdl/MakeNIX.cfg
-endif
-
-ifdef PANDORA
-include sdl/SRB2Pandora/Makefile.cfg
-endif #ifdef PANDORA
-
-ifdef DC
-include sdl/SRB2DC/Makefile.cfg
-endif #ifdef DC
-
-ifdef PS3N
-include sdl/SRB2PS3/Makefile.cfg
-endif #ifdef PS3N
-
-ifdef PSP
-include sdl/SRB2PSP/Makefile.cfg
-endif #ifdef PSP
-
-ifdef XBOX
-include sdl/SRB2XBOX/Makefile.cfg
-endif #ifdef XBOX
-
-ifdef WINCE
-include sdl/SRB2CE/Makefile.cfg
-endif #ifef WINCE
-
-ifdef CYGWIN32
-include sdl/MakeCYG.cfg
-endif #ifdef CYGWIN32
-
-ifdef SDL_PKGCONFIG
-SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
-SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
-else
-ifdef PREFIX
-	SDL_CONFIG?=$(PREFIX)-sdl-config
-else
-	SDL_CONFIG?=sdl-config
-endif
-
-ifdef STATIC
-	SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
-	SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --static-libs)
-else
-	SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
-	SDL_LDFLAGS?=$(shell $(SDL_CONFIG) --libs)
-endif
-endif
-
-
-	#use the x86 asm code
-ifndef CYGWIN32
-ifndef NOASM
-	USEASM=1
-endif
-endif
-
-	OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
-
-	OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
-
-ifndef NOHW
-	OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
-endif
-
-ifndef NOHS
-ifdef OPENAL
-	OBJS+=$(OBJDIR)/s_openal.o
-	OPTS+=-DSTATIC3DS
-	STATICHS=1
-else
-ifdef FMOD
-	OBJS+=$(OBJDIR)/s_fmod.o
-	OPTS+=-DSTATIC3DS
-	STATICHS=1
-else
-ifdef MINGW
-ifdef DS3D
-	OBJS+=$(OBJDIR)/s_ds3d.o
-	OPTS+=-DSTATIC3DS
-	STATICHS=1
-endif
-endif
-endif
-endif
-endif
-
-ifdef FILTERS
-	OBJS+=$(OBJDIR)/filters.o $(OBJDIR)/hq2x.o $(OBJDIR)/lq2x.o
-	OPTS+=-DHAVE_FILTER
-endif
-
-ifdef NOMIXER
-	i_sound_o=$(OBJDIR)/sdl_sound.o
-else
-	i_sound_o=$(OBJDIR)/mixer_sound.o
-	OPTS+=-DHAVE_MIXER
-	SDL_LDFLAGS+=-lSDL_mixer
-endif
-
-ifdef SDL_TTF
-	OPTS+=-DHAVE_TTF
-	SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
-	OBJS+=$(OBJDIR)/i_ttf.o
-endif
-
-#ifdef SDL_IMAGE
-#	OPTS+=-DHAVE_IMAGE
-#	SDL_LDFLAGS+=-lSDL_image
-#endif
-
-ifdef SDL_NET
-	OPTS+=-DHAVE_SDLNET
-	SDL_LDFLAGS+=-lSDL_net
-endif
-
-ifdef SDLMAIN
-	OPTS+=-DSDLMAIN
-else
-ifdef MINGW
-	SDL_CFLAGS+=-Umain
-	SDL_LDFLAGS+=-mconsole
-endif
-endif
-
-ifndef NOHW
-ifdef OPENAL
-ifdef MINGW
-	LIBS:=-lopenal32 $(LIBS)
-else
-	LIBS:=-lopenal $(LIBS)
-endif
-else
-ifdef MINGW
-ifdef DS3D
-	LIBS:=-ldsound -luuid $(LIBS)
-endif
-endif
-endif
-endif
-
-# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
-ifdef WII
-include sdl/SRB2WII/Makefile.cfg
-endif #ifdef WII
-
-CFLAGS+=$(SDL_CFLAGS)
-LIBS:=$(SDL_LDFLAGS) $(LIBS)
-ifndef WII
-ifdef STATIC
-	LIBS+=$(shell $(SDL_CONFIG) --static-libs)
-endif
-endif
diff --git a/src/sdl12/SDL_icon.xpm b/src/sdl12/SDL_icon.xpm
deleted file mode 100644
index cf72960dfc9048d1ab23b3c59ed4d29d65f4c404..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_icon.xpm
+++ /dev/null
@@ -1,425 +0,0 @@
-/* XPM */
-static char * C:\Repo\srb2\src\sdl\SDL_icon_xpm[] = {
-"32 32 390 2",
-"  	c None",
-". 	c #4F4F70",
-"+ 	c #4D4D87",
-"@ 	c #4D4D84",
-"# 	c #4E4E6C",
-"$ 	c #6C6C95",
-"% 	c #5E5EB2",
-"& 	c #6B6BE7",
-"* 	c #7373F9",
-"= 	c #7C7CFF",
-"- 	c #6F70E7",
-"; 	c #494BB2",
-"> 	c #4F4FA3",
-", 	c #6464D4",
-"' 	c #7979F5",
-") 	c #5F5FCA",
-"! 	c #5D5D93",
-"~ 	c #3A3A9F",
-"{ 	c #6060AC",
-"] 	c #777793",
-"^ 	c #5C5CB3",
-"/ 	c #7373EA",
-"( 	c #7A7AFF",
-"_ 	c #7575FF",
-": 	c #7979FF",
-"< 	c #6264DD",
-"[ 	c #47478C",
-"} 	c #564567",
-"| 	c #4647D0",
-"1 	c #5C5CAE",
-"2 	c #5E5EFF",
-"3 	c #2929FF",
-"4 	c #1D1DFF",
-"5 	c #1919D1",
-"6 	c #4F4F90",
-"7 	c #1E1ECE",
-"8 	c #5858FF",
-"9 	c #6767A8",
-"0 	c #4949A0",
-"a 	c #7070FB",
-"b 	c #7D7DFF",
-"c 	c #7777FF",
-"d 	c #7373FF",
-"e 	c #7272FF",
-"f 	c #7878FF",
-"g 	c #6465D8",
-"h 	c #363886",
-"i 	c #9F7655",
-"j 	c #C89B5C",
-"k 	c #1D1CB7",
-"l 	c #3031B1",
-"m 	c #1919F4",
-"n 	c #1111FF",
-"o 	c #1818FF",
-"p 	c #1B1BFF",
-"q 	c #1C1CFF",
-"r 	c #2626B3",
-"s 	c #1E1EC8",
-"t 	c #1A1AE8",
-"u 	c #24249F",
-"v 	c #2F2FD2",
-"w 	c #7676FF",
-"x 	c #6869E2",
-"y 	c #414290",
-"z 	c #8C6751",
-"A 	c #FCBA68",
-"B 	c #E9BD7D",
-"C 	c #201EB8",
-"D 	c #090AB8",
-"E 	c #1616EB",
-"F 	c #1818FD",
-"G 	c #1414EE",
-"H 	c #1010E1",
-"I 	c #0E0EE2",
-"J 	c #0E0EF4",
-"K 	c #0606B2",
-"L 	c #7A7A89",
-"M 	c #0C0C9A",
-"N 	c #0A0AA7",
-"O 	c #2424E4",
-"P 	c #6669E6",
-"Q 	c #4F4A8F",
-"R 	c #BF853B",
-"S 	c #FFD98D",
-"T 	c #CDAB76",
-"U 	c #1717C4",
-"V 	c #0F10BA",
-"W 	c #0909B6",
-"X 	c #0505C3",
-"Y 	c #0000B6",
-"Z 	c #0000BE",
-"` 	c #0000AD",
-" .	c #1D1D83",
-"..	c #63638E",
-"+.	c #090975",
-"@.	c #1414F3",
-"#.	c #5B5BFF",
-"$.	c #7B7BFF",
-"%.	c #7070FF",
-"&.	c #6E6EFF",
-"*.	c #7172F6",
-"=.	c #625DAF",
-"-.	c #BA9E6C",
-";.	c #887167",
-">.	c #090DF2",
-",.	c #1313BE",
-"'.	c #000085",
-").	c #0000AC",
-"!.	c #0202AA",
-"~.	c #242488",
-"{.	c #1414C7",
-"].	c #1717FF",
-"^.	c #5959FF",
-"/.	c #7F7FFF",
-"(.	c #7474FF",
-"_.	c #7171FF",
-":.	c #8686FF",
-"<.	c #7574FF",
-"[.	c #797CFF",
-"}.	c #5756B8",
-"|.	c #1C19A4",
-"1.	c #1617FF",
-"2.	c #1212BD",
-"3.	c #040485",
-"4.	c #0707A4",
-"5.	c #1B1B71",
-"6.	c #373797",
-"7.	c #1616FF",
-"8.	c #5050FF",
-"9.	c #8080FF",
-"0.	c #AAAAFF",
-"a.	c #AEAEF6",
-"b.	c #8A8AEF",
-"c.	c #6969FB",
-"d.	c #2728FF",
-"e.	c #1314FF",
-"f.	c #1919FF",
-"g.	c #1313E8",
-"h.	c #1F1FF4",
-"i.	c #5454FF",
-"j.	c #6D6DF0",
-"k.	c #6868B5",
-"l.	c #0B0BB8",
-"m.	c #1212C5",
-"n.	c #1616FC",
-"o.	c #1515FF",
-"p.	c #1212FF",
-"q.	c #2323FF",
-"r.	c #3636FF",
-"s.	c #4040FF",
-"t.	c #4343F9",
-"u.	c #5D5DB8",
-"v.	c #7F7F92",
-"w.	c #878793",
-"x.	c #4B4B94",
-"y.	c #0B0CE2",
-"z.	c #1313FF",
-"A.	c #4C4CFF",
-"B.	c #8282FF",
-"C.	c #7171ED",
-"D.	c #636394",
-"E.	c #575785",
-"F.	c #A9A99C",
-"G.	c #1414BC",
-"H.	c #1414FF",
-"I.	c #0707FD",
-"J.	c #2525AA",
-"K.	c #A8A8A4",
-"L.	c #EBEBE2",
-"M.	c #F9F9F2",
-"N.	c #E1E1CC",
-"O.	c #4D4D9F",
-"P.	c #0B0BF7",
-"Q.	c #2121FF",
-"R.	c #3232FF",
-"S.	c #5555FF",
-"T.	c #6161B4",
-"U.	c #B5B5B2",
-"V.	c #FFFFF8",
-"W.	c #4F4F9A",
-"X.	c #0B0BF5",
-"Y.	c #1616C5",
-"Z.	c #A8A8A1",
-"`.	c #FFFFFC",
-" +	c #FFFFFF",
-".+	c #C0C0C4",
-"++	c #1212D4",
-"@+	c #4444FF",
-"#+	c #6464FF",
-"$+	c #8383FF",
-"%+	c #6767C3",
-"&+	c #E4E4E4",
-"*+	c #9494AE",
-"=+	c #0808DF",
-"-+	c #0D0DF2",
-";+	c #61619A",
-">+	c #F1F1E0",
-",+	c #E8E8DD",
-"'+	c #2424BB",
-")+	c #1010FF",
-"!+	c #3434FF",
-"~+	c #6161FF",
-"{+	c #6969D2",
-"]+	c #EFEFF0",
-"^+	c #C2C2BA",
-"/+	c #1010B6",
-"(+	c #0909AC",
-"_+	c #A4A49A",
-":+	c #EAEADE",
-"<+	c #2525B8",
-"[+	c #2F2FFF",
-"}+	c #3C3CB5",
-"|+	c #EEEEEE",
-"1+	c #BBBBAD",
-"2+	c #0B0B56",
-"3+	c #0B0BFC",
-"4+	c #1212EF",
-"5+	c #0C0C3E",
-"6+	c #919187",
-"7+	c #DEDED6",
-"8+	c #1F1FC0",
-"9+	c #1A1AFF",
-"0+	c #1717FA",
-"a+	c #1515F8",
-"b+	c #1111FC",
-"c+	c #494992",
-"d+	c #999998",
-"e+	c #3E3E3B",
-"f+	c #3C3C99",
-"g+	c #535397",
-"h+	c #5A5A4D",
-"i+	c #6F6F70",
-"j+	c #BFBFC9",
-"k+	c #1111D6",
-"l+	c #1515F1",
-"m+	c #0F0FE2",
-"n+	c #0D0DD9",
-"o+	c #0909CD",
-"p+	c #0808C7",
-"q+	c #0505C7",
-"r+	c #0303CB",
-"s+	c #0101C0",
-"t+	c #0202AF",
-"u+	c #0606AC",
-"v+	c #121283",
-"w+	c #BBBBBB",
-"x+	c #BEBEBE",
-"y+	c #2F2F2E",
-"z+	c #C7C8BB",
-"A+	c #D8DAD1",
-"B+	c #272828",
-"C+	c #929292",
-"D+	c #8688C7",
-"E+	c #0506F6",
-"F+	c #1616F5",
-"G+	c #0B0BD3",
-"H+	c #0202B6",
-"I+	c #0000AF",
-"J+	c #0000B4",
-"K+	c #0000BD",
-"L+	c #0000BB",
-"M+	c #00009E",
-"N+	c #2C2C7E",
-"O+	c #6A6A8B",
-"P+	c #959595",
-"Q+	c #F0F0F1",
-"R+	c #E1E1E1",
-"S+	c #8C8E90",
-"T+	c #BEBEBF",
-"U+	c #C9C7C5",
-"V+	c #939699",
-"W+	c #E7EAED",
-"X+	c #CBCBC7",
-"Y+	c #413B9B",
-"Z+	c #0607DD",
-"`+	c #0C0CE2",
-" @	c #0303B9",
-".@	c #0000A8",
-"+@	c #181888",
-"@@	c #6A6A6A",
-"#@	c #626263",
-"$@	c #4B4B4C",
-"%@	c #3E3B36",
-"&@	c #9B805C",
-"*@	c #D9B07D",
-"=@	c #C9AE89",
-"-@	c #B9AF9E",
-";@	c #C7C5C4",
-">@	c #CBCCCF",
-",@	c #C7C6C6",
-"'@	c #AEA59A",
-")@	c #B69974",
-"!@	c #D8B87F",
-"~@	c #9B8272",
-"{@	c #0E0B9B",
-"]@	c #0000B7",
-"^@	c #0000B8",
-"/@	c #000082",
-"(@	c #00007A",
-"_@	c #636379",
-":@	c #62533E",
-"<@	c #B59B6C",
-"[@	c #DEB07B",
-"}@	c #FECC90",
-"|@	c #FFCE92",
-"1@	c #FEC98C",
-"2@	c #F1BD82",
-"3@	c #D1A979",
-"4@	c #BC9E73",
-"5@	c #CCA777",
-"6@	c #EAB980",
-"7@	c #FFCD90",
-"8@	c #FFD595",
-"9@	c #FDD782",
-"0@	c #413678",
-"a@	c #0000AE",
-"b@	c #000077",
-"c@	c #010193",
-"d@	c #0C0CE4",
-"e@	c #38389E",
-"f@	c #EEC585",
-"g@	c #FFDA9D",
-"h@	c #FFC992",
-"i@	c #FFC88F",
-"j@	c #FFC990",
-"k@	c #FFCE93",
-"l@	c #FFD094",
-"m@	c #FFCC92",
-"n@	c #C9A174",
-"o@	c #EDBD88",
-"p@	c #FAD287",
-"q@	c #3A2F7F",
-"r@	c #0000BA",
-"s@	c #0000B0",
-"t@	c #0101B2",
-"u@	c #1111ED",
-"v@	c #1919C1",
-"w@	c #95887C",
-"x@	c #DCAC6E",
-"y@	c #FFD393",
-"z@	c #FFCD94",
-"A@	c #FFCA93",
-"B@	c #FFC991",
-"C@	c #FFC78E",
-"D@	c #FFCB91",
-"E@	c #E0B581",
-"F@	c #BB9A6F",
-"G@	c #FFDC97",
-"H@	c #C1A173",
-"I@	c #0E0B9A",
-"J@	c #0000B5",
-"K@	c #0101B6",
-"L@	c #1010E0",
-"M@	c #1616EC",
-"N@	c #A68156",
-"O@	c #E7AC6B",
-"P@	c #FFC582",
-"Q@	c #FFCF8F",
-"R@	c #FFD195",
-"S@	c #FFD296",
-"T@	c #FFD396",
-"U@	c #FFD193",
-"V@	c #FFD28F",
-"W@	c #D2A96B",
-"X@	c #2F2482",
-"Y@	c #0000C1",
-"Z@	c #0000C0",
-"`@	c #0000BF",
-" #	c #0101BF",
-".#	c #1212F0",
-"+#	c #767698",
-"@#	c #9C866E",
-"##	c #A9865D",
-"$#	c #C0915D",
-"%#	c #C89760",
-"&#	c #C29360",
-"*#	c #AD8A61",
-"=#	c #9D8971",
-"-#	c #7F7A7A",
-";#	c #70708F",
-">#	c #6F6F91",
-",#	c #575788",
-"'#	c #464687",
-")#	c #2F2F87",
-"!#	c #15158F",
-"~#	c #0101A8",
-"{#	c #1313FB",
-"]#	c #57579F",
-"^#	c #343487",
-"/#	c #434388",
-"                                                                ",
-"                                                                ",
-"                                                                ",
-"                              . + @ #                           ",
-"                      $ % & * = - ; > , ' ) !                   ",
-"      ~ {       ] ^ / = ( _ : < [ } | 1 2 3 4 5 6               ",
-"      7 8 9   0 a b c d e f g h i j k l m n o p q r             ",
-"      s t u v _ f d d d w x y z A B C D E F G H I J K L         ",
-"      M N O _ c e d d d _ P Q R S T U V W X Y Z `  ...          ",
-"      +.@.#.$.d d d d %.&._ *.=.-.;.>.,.'.).!.~.                ",
-"      {.].^./.(.d d _.$.:._ <.[.}.|.1.2.3.4.5.                  ",
-"    6.7.7.4 8.e : w 9.0.a.b.c.2 d.e.f.g.h.i.j.k.                ",
-"    l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.o o z.A.B./.b C.D.            ",
-"    E.F.G.].o H.z.I.J.K.L.M.N.O.P.o o o Q.R.S._.b B.T.          ",
-"    U.V.W.X.f.f.7.Y.Z.`. + + +.+++].o o o.n z.q.@+#+$+%+        ",
-"    &+ +*+=+].o -+;+>+ + + + +,+'+H.o o o o o H.)+o !+~+{+      ",
-"    ]+ +^+/+H.o.(+_+ + + + + +:+<+z.o o o o o o o 7.n H.[+}+    ",
-"    |+ +1+2+3+4+5+6+ + + + + +7+8+H.o o f.9+f.9+f.F 0+a+b+o.c+  ",
-"    &+ +d+e+f+g+h+i+ + + + + +j+k+].f.9+l+m+n+o+p+q+r+s+t+u+v+  ",
-"    w+ +x+y+z+A+B+C+ + + + + +D+E+9+F+G+H+I+J+K+L+M+N+O+        ",
-"    P+Q+R+S+T+U+V+W+ + + + +X+Y+Z+`+ @I+J+Z .@+@E.              ",
-"    @@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@I+/@(@_@                ",
-"      :@<@[@}@|@1@2@3@4@5@6@7@8@9@0@L+a@b@c@d@e@                ",
-"        f@g@h@i@i@j@k@l@|@m@n@o@p@q@r@s@t@u@p v@                ",
-"        w@x@y@z@A@B@i@C@D@E@F@G@H@I@L+J@K@L@p M@                ",
-"            N@O@P@Q@R@S@T@U@V@W@X@Y@Z@Y@`@ #.#p +#              ",
-"                @###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#              ",
-"                                              ^#/#              ",
-"                                                                ",
-"                                                                ",
-"                                                                ",
-"                                                                "};
diff --git a/src/sdl12/SDL_main/SDL_dummy_main.c b/src/sdl12/SDL_main/SDL_dummy_main.c
deleted file mode 100644
index d8cfdd5bb2a87d2bb2a718aaee1e42cb38914404..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_main/SDL_dummy_main.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Include the SDL main definition header */
-#include "SDL_main.h"
-
-#ifdef main
-#undef main
-int main(int argc, char *argv[])
-{
-	return(SDL_main(argc, argv));
-}
-#else
-/* Nothing to do on this platform */;
-#endif
diff --git a/src/sdl12/SDL_main/SDL_macosx_main.h b/src/sdl12/SDL_main/SDL_macosx_main.h
deleted file mode 100644
index 4683df57a5e61fc41b189e67245f4a0a32d7552d..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_main/SDL_macosx_main.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
-       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
-       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
-
-    Feel free to customize this file to suit your needs
-*/
-
-#import <Cocoa/Cocoa.h>
-
-@interface SDLMain : NSObject
-@end
diff --git a/src/sdl12/SDL_main/SDL_macosx_main.m b/src/sdl12/SDL_main/SDL_macosx_main.m
deleted file mode 100644
index 226afe13d257f0b78a1bc99e93b9631ebe4fa547..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_main/SDL_macosx_main.m
+++ /dev/null
@@ -1,374 +0,0 @@
-/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
-       Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
-       Non-NIB-Code & other changes: Max Horn <max@quendi.de>
-
-    Feel free to customize this file to suit your needs
-*/
-
-#import "SDL.h"
-#import "SDL_macosx_main.h"
-#import <sys/param.h> /* for MAXPATHLEN */
-#import <unistd.h>
-
-/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
- but the method still is there and works. To avoid warnings, we declare
- it ourselves here. */
-@interface NSApplication(SDL_Missing_Methods)
-- (void)setAppleMenu:(NSMenu *)menu;
-@end
-
-/* Use this flag to determine whether we use SDLMain.nib or not */
-#define		SDL_USE_NIB_FILE	0
-
-/* Use this flag to determine whether we use CPS (docking) or not */
-#define		SDL_USE_CPS		1
-#if SDL_USE_CPS
-/* Portions of CPS.h */
-typedef struct CPSProcessSerNum
-{
-	UInt32		lo;
-	UInt32		hi;
-} CPSProcessSerNum;
-
-extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
-extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
-extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
-
-#endif /* SDL_USE_CPS */
-
-static int    gArgc;
-static char  **gArgv;
-static BOOL   gFinderLaunch;
-
-static void addArgument(const char *value)
-{
-	if(!gArgc)
-		gArgv = (char **)malloc(sizeof(*gArgv));
-	else
-	{
-		char **newgArgv = (char **)realloc(gArgv, sizeof(*gArgv) * (gArgc + 1));
-		if (!newgArgv)
-		{
-			newgArgv = malloc(sizeof(*gArgv) * (gArgc + 1));
-			memcpy(newgArgv, gArgv, sizeof(*gArgv) * gArgc);
-			free(gArgv);
-		}
-		gArgv = newgArgv;
-	}
-	gArgc++;
-	gArgv[gArgc - 1] = (char *)malloc(sizeof(char) * (strlen(value) + 1));
-	strcpy(gArgv[gArgc - 1], value);
-}
-
-static NSString *getApplicationName(void)
-{
-    NSDictionary *dict;
-    NSString *appName = NULL;
-
-    /* Determine the application name */
-    dict = ( NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
-    if (dict)
-        appName = [dict objectForKey: @"CFBundleName"];
-
-    if (![appName length])
-        appName = [[NSProcessInfo processInfo] processName];
-
-    return appName;
-}
-
-#if SDL_USE_NIB_FILE
-/* A helper category for NSString */
-@interface NSString (ReplaceSubString)
-- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
-@end
-#endif
-
-@interface SDLApplication : NSApplication
-@end
-
-@implementation SDLApplication
-/* Invoked from the Quit menu item */
-- (void)terminate:(id)sender
-{
-#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-    (void)sender;
-#endif
-    /* Post a SDL_QUIT event */
-    SDL_Event event;
-    event.type = SDL_QUIT;
-    SDL_PushEvent(&event);
-}
-@end
-
-/* The main class of the application, the application's delegate */
-@implementation SDLMain
-
-/* Set the working directory to the .app's parent directory */
-- (void) setupWorkingDirectory:(BOOL)shouldChdir
-{
-    if (shouldChdir)
-    {
-        char parentdir[MAXPATHLEN];
-	CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-	CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
-	if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN))
-        {
-	       assert ( chdir (parentdir) == 0 );   /* chdir to the binary app's parent */
-	}
-	CFRelease(url);
-	CFRelease(url2);
-    }
-
-}
-
-#if SDL_USE_NIB_FILE
-
-/* Fix menu to contain the real app name instead of "SDL App" */
-- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
-{
-    NSRange aRange;
-    NSEnumerator *enumerator;
-    NSMenuItem *menuItem;
-
-    aRange = [[aMenu title] rangeOfString:@"SDL App"];
-    if (aRange.length != 0)
-        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
-
-    enumerator = [[aMenu itemArray] objectEnumerator];
-    while ((menuItem = [enumerator nextObject]))
-    {
-        aRange = [[menuItem title] rangeOfString:@"SDL App"];
-        if (aRange.length != 0)
-            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
-        if ([menuItem hasSubmenu])
-            [self fixMenu:[menuItem submenu] withAppName:appName];
-    }
-    [ aMenu sizeToFit ];
-}
-
-#else
-
-static void setApplicationMenu(void)
-{
-    /* warning: this code is very odd */
-    NSMenu *appleMenu;
-    NSMenuItem *menuItem;
-    NSString *title;
-    NSString *appName;
-
-    appName = getApplicationName();
-    appleMenu = [[NSMenu alloc] initWithTitle:@""];
-
-    /* Add menu items */
-    title = [@"About " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
-
-    [appleMenu addItem:[NSMenuItem separatorItem]];
-
-    title = [@"Hide " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
-
-    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
-    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
-
-    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
-
-    [appleMenu addItem:[NSMenuItem separatorItem]];
-
-    title = [@"Quit " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
-
-
-    /* Put menu into the menubar */
-    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
-    [menuItem setSubmenu:appleMenu];
-    [[NSApp mainMenu] addItem:menuItem];
-
-    /* Tell the application object that this is now the application menu */
-    [NSApp setAppleMenu:appleMenu];
-
-    /* Finally give up our references to the objects */
-    [appleMenu release];
-    [menuItem release];
-}
-
-/* Create a window menu */
-static void setupWindowMenu(void)
-{
-    NSMenu      *windowMenu;
-    NSMenuItem  *windowMenuItem;
-    NSMenuItem  *menuItem;
-
-    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
-
-    /* "Minimize" item */
-    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
-    [windowMenu addItem:menuItem];
-    [menuItem release];
-
-    /* Put menu into the menubar */
-    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
-    [windowMenuItem setSubmenu:windowMenu];
-    [[NSApp mainMenu] addItem:windowMenuItem];
-
-    /* Tell the application object that this is now the window menu */
-    [NSApp setWindowsMenu:windowMenu];
-
-    /* Finally give up our references to the objects */
-    [windowMenu release];
-    [windowMenuItem release];
-}
-
-/* Replacement for NSApplicationMain */
-static void CustomApplicationMain (int argc, char **argv)
-{
-#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-    (void)argc;
-    (void)argv;
-#endif
-    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
-    SDLMain				*sdlMain;
-
-    /* Ensure the application object is initialised */
-    [SDLApplication sharedApplication];
-
-#if SDL_USE_CPS
-    {
-        CPSProcessSerNum PSN;
-        /* Tell the dock about us */
-        if (!CPSGetCurrentProcess(&PSN))
-            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
-                if (!CPSSetFrontProcess(&PSN))
-                    [SDLApplication sharedApplication];
-    }
-#endif /* SDL_USE_CPS */
-
-    /* Set up the menubar */
-    [NSApp setMainMenu:[[NSMenu alloc] init]];
-    setApplicationMenu();
-    setupWindowMenu();
-
-    /* Create SDLMain and make it the app delegate */
-    sdlMain = [[SDLMain alloc] init];
-    [NSApp setDelegate:sdlMain];
-
-    /* Start the main event loop */
-    [NSApp run];
-
-    [sdlMain release];
-    [pool release];
-}
-
-#endif
-
-- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
-{
-#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-    (void)theApplication;
-#endif
-    addArgument("-iwad");
-    addArgument([filename UTF8String]);
-    return YES;
-}
-
-/* Called when the internal event loop has just started running */
-- (void) applicationDidFinishLaunching: (NSNotification *) note
-{
-#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-    (void)note;
-#endif
-    int status;
-
-    /* Set the working directory to the .app's parent directory */
-    [self setupWorkingDirectory:gFinderLaunch];
-
-#if SDL_USE_NIB_FILE
-    /* Set the main menu to contain the real app name instead of "SDL App" */
-    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
-#endif
-
-    if (!getenv("SRB2WADDIR"))
-        setenv("SRB2WADDIR", [[[NSBundle mainBundle] resourcePath] UTF8String], 1);
-
-    /* Hand off to main application code */
-    status = SDL_main (gArgc, gArgv);
-
-    /* We're done, thank you for playing */
-    exit(status);
-}
-@end
-
-
-@implementation NSString (ReplaceSubString)
-
-- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
-{
-    size_t bufferSize;
-    size_t selfLen = [self length];
-    size_t aStringLen = [aString length];
-    unichar *buffer;
-    NSRange localRange;
-    NSString *result;
-
-    bufferSize = selfLen + aStringLen - aRange.length;
-    buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
-
-    /* Get first part into buffer */
-    localRange.location = 0;
-    localRange.length = aRange.location;
-    [self getCharacters:buffer range:localRange];
-
-    /* Get middle part into buffer */
-    localRange.location = 0;
-    localRange.length = aStringLen;
-    [aString getCharacters:(buffer+aRange.location) range:localRange];
-
-    /* Get last part into buffer */
-    localRange.location = aRange.location + aRange.length;
-    localRange.length = selfLen - localRange.location;
-    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
-
-    /* Build output string */
-    result = [NSString stringWithCharacters:buffer length:bufferSize];
-
-    NSDeallocateMemoryPages(buffer, bufferSize);
-
-    return result;
-}
-
-@end
-
-
-
-#ifdef main
-#  undef main
-#endif
-
-
-/* Main entry point to executable - should *not* be SDL_main! */
-int main (int argc, char **argv)
-{
-
-    /* Copy the arguments into a global variable */
-
-    /* This is passed if we are launched by double-clicking */
-    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
-        gArgc = 1;
-        gFinderLaunch = YES;
-    } else {
-        gArgc = argc;
-        gFinderLaunch = NO;
-    }
-    gArgv = argv;
-
-    /* Some additional arguments we always want to run with. */
-    //addArgument("-opengl");
-
-#if SDL_USE_NIB_FILE
-    [SDLApplication poseAsClass:[NSApplication class]];
-    NSApplicationMain (argc, argv);
-#else
-    CustomApplicationMain (argc, argv);
-#endif
-    return 0;
-}
diff --git a/src/sdl12/SDL_main/SDL_openxdk_main.c b/src/sdl12/SDL_main/SDL_openxdk_main.c
deleted file mode 100644
index 63db8da2d8f64f241bc05bc17a6609c270a4b65b..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_main/SDL_openxdk_main.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Include the SDL main definition header */
-#include "SDL_main.h"
-
-void XBoxStartup()
-{
-	SDL_main(0, NULL); /// \todo ?
-}
diff --git a/src/sdl12/SDL_main/SDL_win32_main.c b/src/sdl12/SDL_main/SDL_win32_main.c
deleted file mode 100644
index 46b20d0bd83590b0f23cf092ef5df4b46bf4d017..0000000000000000000000000000000000000000
--- a/src/sdl12/SDL_main/SDL_win32_main.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
-    SDL_main.c, placed in the public domain by Sam Lantinga  4/13/98
-
-    The WinMain function -- calls your program's main() function
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-#include <malloc.h>			/* For _alloca() */
-
-#include <tchar.h>
-
-#ifdef _WIN32_WCE
-# define DIR_SEPERATOR TEXT("\\")
-# define _tgetcwd(str,len)	wcscpy(str,TEXT(""))
-# define setbuf(f,b)
-# define setvbuf(w,x,y,z)
-# define _tremove(x)	DeleteFile(x)
-#else
-# define DIR_SEPERATOR TEXT("/")
-# include <direct.h>
-#endif
-
-/* Include the SDL main definition header */
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-#include "SDL.h"
-#include "SDL_main.h"
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-#include "../../win32/win_dbg.h"
-#define USE_MESSAGEBOX
-
-#ifdef main
-# ifndef _WIN32_WCE_EMULATION
-#  undef main
-# endif /* _WIN32_WCE_EMULATION */
-#endif /* main */
-
-/* The standard output files */
-//#ifdef _WIN32_WCE
-//#define STDOUT_FILE	TEXT("/Storage Card/SRB2DEMO/stdout.txt")
-//#define STDERR_FILE	TEXT("/Storage Card/SRB2DEMO/stderr.txt")
-//#else
-#define STDOUT_FILE	TEXT("stdout.txt")
-#define STDERR_FILE	TEXT("stderr.txt")
-//#endif
-
-#ifndef NO_STDIO_REDIRECT
-  static TCHAR stdoutPath[MAX_PATH];
-  static TCHAR stderrPath[MAX_PATH];
-#endif
-
-#if defined(_WIN32_WCE) && _WIN32_WCE < 300
-/* seems to be undefined in Win CE although in online help */
-#define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
-
-/* seems to be undefined in Win CE although in online help */
-char *strrchr(char *str, int c)
-{
-	char *p;
-
-	/* Skip to the end of the string */
-	p=str;
-	while (*p)
-		p++;
-
-	/* Look for the given character */
-	while ( (p >= str) && (*p != (CHAR)c) )
-		p--;
-
-	/* Return NULL if character not found */
-	if ( p < str ) {
-		p = NULL;
-	}
-	return p;
-}
-#endif /* _WIN32_WCE < 300 */
-
-/* Parse a command line buffer into arguments */
-static int ParseCommandLine(char *cmdline, char **argv)
-{
-	char *bufp;
-	int argc;
-
-	argc = 0;
-	for ( bufp = cmdline; *bufp; ) {
-		/* Skip leading whitespace */
-		while ( isspace(*bufp) ) {
-			++bufp;
-		}
-		/* Skip over argument */
-		if ( *bufp == '"' ) {
-			++bufp;
-			if ( *bufp ) {
-				if ( argv ) {
-					argv[argc] = bufp;
-				}
-				++argc;
-			}
-			/* Skip over word */
-			while ( *bufp && (*bufp != '"') ) {
-				++bufp;
-			}
-		} else {
-			if ( *bufp ) {
-				if ( argv ) {
-					argv[argc] = bufp;
-				}
-				++argc;
-			}
-			/* Skip over word */
-			while ( *bufp && ! isspace(*bufp) ) {
-				++bufp;
-			}
-		}
-		if ( *bufp ) {
-			if ( argv ) {
-				*bufp = '\0';
-			}
-			++bufp;
-		}
-	}
-	if ( argv ) {
-		argv[argc] = NULL;
-	}
-	return(argc);
-}
-
-/* Show an error message */
-static void ShowError(const char *title, const char *message)
-{
-/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
-#ifdef USE_MESSAGEBOX
-	MessageBoxA(NULL,
-		message,
-		title,
-		MB_ICONEXCLAMATION|MB_OK);
-#else
-	fprintf(stderr, "%s: %s\n", title, message);
-#endif
-}
-
-/* Pop up an out of memory message, returns to Windows */
-static BOOL OutOfMemory(void)
-{
-	ShowError("Fatal Error", "Out of memory - aborting");
-	return FALSE;
-}
-
-/* Remove the output files if there was no output written */
-static void __cdecl cleanup_output(void)
-{
-#ifndef NO_STDIO_REDIRECT
-	FILE *file;
-	int empty;
-#endif
-
-	/* Flush the output in case anything is queued */
-	fclose(stdout);
-	fclose(stderr);
-
-#ifndef NO_STDIO_REDIRECT
-	/* See if the files have any output in them */
-	if ( stdoutPath[0] ) {
-		file = _tfopen(stdoutPath, TEXT("rb"));
-		if ( file ) {
-			empty = (fgetc(file) == EOF) ? 1 : 0;
-			fclose(file);
-			if ( empty ) {
-				_tremove(stdoutPath);
-			}
-		}
-	}
-	if ( stderrPath[0] ) {
-		file = _tfopen(stderrPath, TEXT("rb"));
-		if ( file ) {
-			empty = (fgetc(file) == EOF) ? 1 : 0;
-			fclose(file);
-			if ( empty ) {
-				_tremove(stderrPath);
-			}
-		}
-	}
-#endif
-}
-
-#if defined(_MSC_VER) && !defined(_WIN32_WCE)
-/* The VC++ compiler needs main defined */
-#define console_main main
-#endif
-
-/* This is where execution begins [console apps] */
-int console_main(int argc, char *argv[])
-{
-	size_t n;
-	int st;
-	char *bufp, *appname;
-
-	/* Get the class name from argv[0] */
-	appname = argv[0];
-	if ( (bufp=strrchr(argv[0], '\\')) != NULL ) {
-		appname = bufp+1;
-	} else
-	if ( (bufp=strrchr(argv[0], '/')) != NULL ) {
-		appname = bufp+1;
-	}
-
-	if ( (bufp=strrchr(appname, '.')) == NULL )
-		n = strlen(appname);
-	else
-		n = (bufp-appname);
-
-	bufp = (char *)alloca(n+1);
-	if ( bufp == NULL ) {
-		return OutOfMemory();
-	}
-	strncpy(bufp, appname, n);
-	bufp[n] = '\0';
-	appname = bufp;
-
-	/* Load SDL dynamic link library */
-	if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
-		ShowError("WinMain() error", SDL_GetError());
-		return(FALSE);
-	}
-	atexit(cleanup_output);
-	atexit(SDL_Quit);
-
-#ifndef DISABLE_VIDEO
-#if 0
-	/* Create and register our class *
-	   DJM: If we do this here, the user nevers gets a chance to
-	   putenv(SDL_WINDOWID).  This is already called later by
-	   the (DIB|DX5)_CreateWindow function, so it should be
-	   safe to comment it out here.
-	if ( SDL_RegisterApp(appname, CS_BYTEALIGNCLIENT,
-	                     GetModuleHandle(NULL)) < 0 ) {
-		ShowError("WinMain() error", SDL_GetError());
-		exit(1);
-	}*/
-#else
-	/* Sam:
-	   We still need to pass in the application handle so that
-	   DirectInput will initialize properly when SDL_RegisterApp()
-	   is called later in the video initialization.
-	 */
-	SDL_SetModuleHandle(GetModuleHandle(NULL));
-#endif /* 0 */
-#endif /* !DISABLE_VIDEO */
-
-	/* Run the application main() code */
-	st = SDL_main(argc, argv);
-
-	/* Exit cleanly, calling atexit() functions */
-	//exit(0);
-	cleanup_output();
-	SDL_Quit();
-
-	/* Hush little compiler, don't you cry... */
-	return st;
-}
-
-/* This is where execution begins [windowed apps] */
-#ifdef _WIN32_WCE
-int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR szCmdLine, int sw)
-#else
-int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
-#endif
-{
-	HINSTANCE handle;
-	int Result = -1;
-	char **argv;
-	int argc;
-	LPSTR cmdline;
-#ifdef _WIN32_WCE
-	size_t nLen;
-	LPTSTR bufp;
-#else
-	LPSTR bufp;
-#endif
-#ifndef NO_STDIO_REDIRECT
-	FILE *newfp;
-#endif
-
-	/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
-	   keep them open.  This is a hack.. hopefully it will be fixed
-	   someday.  DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
-	 */
-	hPrev = hInst = NULL;
-	sw = 0;
-	handle = LoadLibrary(TEXT("DDRAW.DLL"));
-	if ( handle != NULL ) {
-		FreeLibrary(handle);
-	}
-
-#ifndef NO_STDIO_REDIRECT
-	_tgetcwd( stdoutPath, sizeof( stdoutPath ) );
-	_tcscat( stdoutPath, DIR_SEPERATOR STDOUT_FILE );
-
-	/* Redirect standard input and standard output */
-	newfp = _tfreopen(stdoutPath, TEXT("w"), stdout);
-
-#ifndef _WIN32_WCE
-	if ( newfp == NULL ) {	/* This happens on NT */
-#if !defined(stdout)
-		stdout = _tfopen(stdoutPath, TEXT("w"));
-#else
-		newfp = _tfopen(stdoutPath, TEXT("w"));
-		if ( newfp ) {
-			*stdout = *newfp;
-		}
-#endif
-	}
-#endif /* _WIN32_WCE */
-
-	_tgetcwd( stderrPath, sizeof( stderrPath ) );
-	_tcscat( stderrPath, DIR_SEPERATOR STDERR_FILE );
-
-	newfp = _tfreopen(stderrPath, TEXT("w"), stderr);
-#ifndef _WIN32_WCE
-	if ( newfp == NULL ) {	/* This happens on NT */
-#if !defined(stderr)
-		stderr = _tfopen(stderrPath, TEXT("w"));
-#else
-		newfp = _tfopen(stderrPath, TEXT("w"));
-		if ( newfp ) {
-			*stderr = *newfp;
-		}
-#endif
-	}
-#endif /* _WIN32_WCE */
-
-	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);	/* Line buffered */
-	setbuf(stderr, NULL);			/* No buffering */
-#endif /* !NO_STDIO_REDIRECT */
-
-#ifdef _WIN32_WCE
-	nLen = wcslen(szCmdLine)+128+1;
-	bufp = (wchar_t *)alloca(nLen*2);
-	wcscpy (bufp, TEXT("\""));
-	GetModuleFileName(NULL, bufp+1, 128-3);
-	wcscpy (bufp+wcslen(bufp), TEXT("\" "));
-	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
-	nLen = wcslen(bufp)+1;
-	cmdline = (char *)alloca(nLen);
-	if ( cmdline == NULL ) {
-		return OutOfMemory();
-	}
-	WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
-#else
-	szCmdLine = NULL;
-	/* Grab the command line (use alloca() on Windows) */
-	bufp = GetCommandLineA();
-	cmdline = (LPSTR)alloca(strlen(bufp)+1);
-	if ( cmdline == NULL ) {
-		return OutOfMemory();
-	}
-	strcpy(cmdline, bufp);
-#endif
-
-	/* Parse it into argv and argc */
-	argc = ParseCommandLine(cmdline, NULL);
-	argv = (char **)alloca((argc+1)*(sizeof *argv));
-	if ( argv == NULL ) {
-		return OutOfMemory();
-	}
-	ParseCommandLine(cmdline, argv);
-
-#ifdef BUGTRAP
-	/* Try BugTrap. */
-	if(InitBugTrap())
-		Result = console_main(argc, argv);
-	else
-	{
-#endif
-
-		/* Run the main program (after a little SDL initialization) */
-#ifndef _WIN32_WCE
-		 __try
-#endif
-		{
-			Result = console_main(argc, argv);
-		}
-#ifndef _WIN32_WCE
-		__except ( RecordExceptionInfo(GetExceptionInformation()))
-		{
-			SetUnhandledExceptionFilter(EXCEPTION_CONTINUE_SEARCH); //Do nothing here.
-		}
-#endif
-
-#ifdef BUGTRAP
-	}	/* BT failure clause. */
-
-	/* This is safe even if BT didn't start. */
-	ShutdownBugTrap();
-#endif
-
-	return Result;
-}
diff --git a/src/sdl12/SRB2CE/Makefile.cfg b/src/sdl12/SRB2CE/Makefile.cfg
deleted file mode 100644
index 8d4ae3e48829f9c63b22e75ba5e16c420ba32ad9..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2CE/Makefile.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Makefile.cfg for WinCE with GCC
-#
-
-OPTS+=-D_WIN32_WCE -D_UNICODE
-SDL_CFLAGS?=
-SDL_LDFLAGS?=
-NOHS=1
-NOHW=1
-NONET=1
-NOMIXER=1
-NOPNG=1
diff --git a/src/sdl12/SRB2CE/SRB2CE.zip b/src/sdl12/SRB2CE/SRB2CE.zip
deleted file mode 100644
index 3ac8530dcb124cbda512a7d469da933c3fc974bf..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2CE/SRB2CE.zip and /dev/null differ
diff --git a/src/sdl12/SRB2CE/cehelp.c b/src/sdl12/SRB2CE/cehelp.c
deleted file mode 100644
index 7c5efdee92b0b187f007c8abf43c6141d6e8d6fc..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2CE/cehelp.c
+++ /dev/null
@@ -1,446 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2004 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// DESCRIPTION:
-//      stub and replacement "ANSI" C functions for use under Windows CE
-//
-//-----------------------------------------------------------------------------
-
-#include "../../doomdef.h"
-#include "cehelp.h"
-
-#define _SEC_IN_MINUTE 60
-#define _SEC_IN_HOUR 3600
-#define _SEC_IN_DAY 86400
-
-static const int DAYS_IN_MONTH[12] =
-{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-#define _DAYS_IN_MONTH(x) ((x == 1) ? days_in_feb : DAYS_IN_MONTH[x])
-
-static const int _DAYS_BEFORE_MONTH[12] =
-{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-#define _ISLEAP(y) (((y) % 4) == 0 && (((y) % 100) != 0 || (((y)+1900) % 400) == 0))
-#define _DAYS_IN_YEAR(year) (_ISLEAP(year) ? 366 : 365)
-
-char *strerror(int ecode)
-{
-	static char buff[1024 + 1];
-	DWORD dwMsgLen = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
-		ecode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buff[0], 1024, NULL);
-	return buff;
-}
-
-int unlink( const char *filename )
-{
-	return remove(filename);
-}
-
-int remove( const char *path )
-{
-	return DeleteFileA(path)-1;
-}
-
-int rename( const char *oldname, const char *newname )
-{
-	return MoveFileA(oldname, newname)!=0;
-}
-
-static inline void STToTM(const SYSTEMTIME *st, struct tm *tm)
-{
-	if (!st || !tm) return;
-	tm->tm_sec   = st->wSecond;
-	tm->tm_min   = st->wMinute;
-	tm->tm_hour  = st->wHour;
-	tm->tm_mday  = st->wDay;
-	tm->tm_mon   = st->wMonth - 1;
-	tm->tm_year  = st->wYear - 1900;
-	tm->tm_wday  = st->wDayOfWeek;
-	tm->tm_yday  = 0;
-	tm->tm_isdst = 0;
-}
-
-time_t time(time_t *T)
-{
-	time_t returntime;
-	SYSTEMTIME st;
-	struct tm stft;
-	GetSystemTime(&st);
-	STToTM(&st,&stft);
-	returntime = mktime(&stft);
-	if (T) *T = returntime;
-	return returntime;
-}
-
-static inline UINT64 TTtoFT(const time_t wt, FILETIME *ft)
-{
-	UINT64 temptime = wt; // FILETIME: 1/(10^7) secs since January 1, 1601
-	temptime *= 10000000; // time_t  : 1 secs since January 1, 1970
-	// 369 years * 365 days * 24 hours * 60 mins * 60 secs * 10
-	//       123 leaps days * 24 hours * 60 mins * 60 secs * 10
-	temptime += 116444736000000000;
-	if (ft) CopyMemory(ft,&temptime,sizeof (ULARGE_INTEGER));
-	return temptime;
-}
-
-static struct tm cehelptm;
-
-struct tm * localtime(const time_t *CLOCK)
-{
-	SYSTEMTIME st;
-	FILETIME stft;
-	UINT64 ftli = 0;
-	if (CLOCK) ftli = TTtoFT(*CLOCK, &stft);
-	if (ftli)
-		FileTimeToSystemTime(&stft,&st);
-	else
-		GetSystemTime(&st);
-	STToTM(&st,&cehelptm);
-	if (st.wYear >= 1970)
-		return &cehelptm;
-	else
-		return NULL;
-}
-
-static void validate_structure (struct tm *tim_p) // from newlib
-{
-  div_t res;
-  int days_in_feb = 28;
-
-  /* calculate time & date to account for out of range values */
-  if (tim_p->tm_sec < 0 || tim_p->tm_sec > 59)
-    {
-      res = div (tim_p->tm_sec, 60);
-      tim_p->tm_min += res.quot;
-      if ((tim_p->tm_sec = res.rem) < 0)
-	{
-	  tim_p->tm_sec += 60;
-	  --tim_p->tm_min;
-	}
-    }
-
-  if (tim_p->tm_min < 0 || tim_p->tm_min > 59)
-    {
-      res = div (tim_p->tm_min, 60);
-      tim_p->tm_hour += res.quot;
-      if ((tim_p->tm_min = res.rem) < 0)
-	{
-	  tim_p->tm_min += 60;
-	  --tim_p->tm_hour;
-        }
-    }
-
-  if (tim_p->tm_hour < 0 || tim_p->tm_hour > 23)
-    {
-      res = div (tim_p->tm_hour, 24);
-      tim_p->tm_mday += res.quot;
-      if ((tim_p->tm_hour = res.rem) < 0)
-	{
-	  tim_p->tm_hour += 24;
-	  --tim_p->tm_mday;
-        }
-    }
-
-  if (tim_p->tm_mon > 11)
-    {
-      res = div (tim_p->tm_mon, 12);
-      tim_p->tm_year += res.quot;
-      if ((tim_p->tm_mon = res.rem) < 0)
-        {
-	  tim_p->tm_mon += 12;
-	  --tim_p->tm_year;
-        }
-    }
-
-  if (_DAYS_IN_YEAR (tim_p->tm_year) == 366)
-    days_in_feb = 29;
-
-  if (tim_p->tm_mday <= 0)
-    {
-      while (tim_p->tm_mday <= 0)
-	{
-	  if (--tim_p->tm_mon == -1)
-	    {
-	      tim_p->tm_year--;
-	      tim_p->tm_mon = 11;
-	      days_in_feb =
-		((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
-		 29 : 28);
-	    }
-	  tim_p->tm_mday += _DAYS_IN_MONTH (tim_p->tm_mon);
-	}
-    }
-  else
-    {
-      while (tim_p->tm_mday > _DAYS_IN_MONTH (tim_p->tm_mon))
-	{
-	  tim_p->tm_mday -= _DAYS_IN_MONTH (tim_p->tm_mon);
-	  if (++tim_p->tm_mon == 12)
-	    {
-	      tim_p->tm_year++;
-	      tim_p->tm_mon = 0;
-	      days_in_feb =
-		((_DAYS_IN_YEAR (tim_p->tm_year) == 366) ?
-		 29 : 28);
-	    }
-	}
-    }
-}
-
-time_t mktime (struct tm *tim_p) // from newlib
-{
-  time_t tim = 0;
-  long days = 0;
-  int year;
-
-  /* validate structure */
-  validate_structure (tim_p);
-
-  /* compute hours, minutes, seconds */
-  tim += tim_p->tm_sec + (tim_p->tm_min * _SEC_IN_MINUTE) +
-    (tim_p->tm_hour * _SEC_IN_HOUR);
-
-  /* compute days in year */
-  days += tim_p->tm_mday - 1;
-  days += _DAYS_BEFORE_MONTH[tim_p->tm_mon];
-  if (tim_p->tm_mon > 1 && _DAYS_IN_YEAR (tim_p->tm_year) == 366)
-    days++;
-
-  /* compute day of the year */
-  tim_p->tm_yday = days;
-
-  if (tim_p->tm_year > 10000
-      || tim_p->tm_year < -10000)
-    {
-      return (time_t) -1;
-    }
-
-  /* compute days in other years */
-  if (tim_p->tm_year > 70)
-    {
-      for (year = 70; year < tim_p->tm_year; year++)
-	days += _DAYS_IN_YEAR (year);
-    }
-  else if (tim_p->tm_year < 70)
-    {
-      for (year = 69; year > tim_p->tm_year; year--)
-	days -= _DAYS_IN_YEAR (year);
-      days -= _DAYS_IN_YEAR (year);
-    }
-
-  /* compute day of the week */
-  if ((tim_p->tm_wday = (days + 4) % 7) < 0)
-    tim_p->tm_wday += 7;
-
-  /* compute total seconds */
-  tim += (days * _SEC_IN_DAY);
-
-  return tim;
-}
-
-#undef WINAPI
-#define WINAPI __stdcall //__delcspec(dllexport)
-
-#ifdef _MSC_VER
-//#pragma warning(disable : 4273)
-#endif
-
-
-static __forceinline int STRtoWSTR(LPCSTR lpMultiByteStr, int cchMultiByte,
-	LPWSTR lpWideCharStr, int cchWideChar)
-{
-	return MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpMultiByteStr,
-		cchMultiByte,lpWideCharStr,cchWideChar);
-}
-
-static __forceinline int WSTRtoSTR(LPCWSTR lpWideCharStr, int cchWideChar,
-	LPSTR lpMultiByteStr, int cbMultiByte)
-{
-	return WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK|WC_SEPCHARS,
-		lpWideCharStr,cchWideChar,lpMultiByteStr,cbMultiByte,NULL,NULL);
-}
-
-DWORD WINAPI FormatMessageA(
-    DWORD dwFlags,
-    LPCVOID lpSource,
-    DWORD dwMessageId,
-    DWORD dwLanguageId,
-    LPSTR lpBuffer,
-    DWORD nSize,
-    va_list *Arguments)
-{
-	const int nSizeW = STRtoWSTR(lpBuffer,nSize,NULL,0);
-	int nSizeF = 0;
-	LPWSTR lpBufferW = alloca(sizeof (wchar_t)*nSizeW);
-	LPWSTR lpSourceW = NULL;
-
-	if (!lpBufferW)
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		ZeroMemory(lpBuffer,nSize);
-		return nSizeF;
-	}
-
-	if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
-	{
-		const int sLen = STRtoWSTR(lpSource, -1, NULL, 0);
-		lpSourceW = alloca(sizeof (wchar_t)*sLen);
-
-		if (lpSourceW)
-			STRtoWSTR(lpSource, -1, lpSourceW, sLen);
-		else
-		{
-			SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-			return nSizeF;
-		}
-	}
-
-	if (lpSourceW)
-		nSizeF = FormatMessageW(dwFlags, lpSourceW, dwMessageId, dwLanguageId,
-			lpBufferW, nSizeW, Arguments);
-	else
-		nSizeF = FormatMessageW(dwFlags, lpSource, dwMessageId, dwLanguageId,
-			lpBufferW, nSizeW, Arguments);
-
-	return WSTRtoSTR(lpBufferW, nSizeF, lpBuffer, nSize);
-}
-
-BOOL WINAPI DeleteFileA(
-    LPCSTR lpFileName)
-{
-	const int sLen = STRtoWSTR(lpFileName, -1, NULL, 0);
-	LPWSTR lpFileNameW = alloca(sizeof (wchar_t)*sLen);
-
-	if (lpFileNameW)
-		STRtoWSTR(lpFileName, -1, lpFileNameW, sLen);
-	else
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return 0;
-	}
-
-	return DeleteFileW(lpFileNameW);
-}
-
-BOOL WINAPI MoveFileA(
-  LPCSTR lpExistingFileName,
-  LPCSTR lpNewFileName
-)
-{
-	const int sLen1 = STRtoWSTR(lpExistingFileName, -1, NULL, 0);
-	LPWSTR lpExistingFileNameW = alloca(sizeof (wchar_t)*sLen1);
-
-	const int sLen2 = STRtoWSTR(lpNewFileName, -1, NULL, 0);
-	LPWSTR lpNewFileNameW = alloca(sizeof (wchar_t)*sLen2);
-
-
-	if (!lpExistingFileNameW  || !lpNewFileNameW)
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return 0;
-	}
-
-	STRtoWSTR(lpExistingFileName, -1, lpExistingFileNameW, sLen1);
-	STRtoWSTR(lpNewFileName, -1, lpNewFileNameW, sLen2);
-
-	return MoveFileW(lpExistingFileNameW, lpNewFileNameW);
-}
-
-
-HANDLE WINAPI CreateFileA(
-    LPCSTR lpFileName,
-    DWORD dwDesiredAccess,
-    DWORD dwShareMode,
-    LPSECURITY_ATTRIBUTES lpSecurityAttributes,
-    DWORD dwCreationDisposition,
-    DWORD dwFlagsAndAttributes,
-    HANDLE hTemplateFile)
-{
-	const int sLen = STRtoWSTR(lpFileName, -1, NULL, 0);
-	LPWSTR lpFileNameW = alloca(sizeof (wchar_t)*sLen);
-
-	if (lpFileNameW)
-		STRtoWSTR(lpFileName, -1, lpFileNameW, sLen);
-	else
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return INVALID_HANDLE_VALUE;
-	}
-
-	return CreateFileW(lpFileNameW, dwDesiredAccess, dwShareMode,
-		lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
-		hTemplateFile);
-}
-
-BOOL WINAPI CreateDirectoryA(
-    LPCSTR lpPathName,
-    LPSECURITY_ATTRIBUTES lpSecurityAttributes)
-{
-	const int sLen = STRtoWSTR(lpPathName, -1, NULL, 0);
-	LPWSTR lpPathNameW = alloca(sizeof (wchar_t)*sLen);
-
-	if (lpPathNameW)
-		STRtoWSTR(lpPathName, -1, lpPathNameW, sLen);
-	else
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return 0;
-	}
-
-	return CreateDirectoryW(lpPathNameW, lpSecurityAttributes);
-}
-
-int WINAPI MessageBoxA(
-    HWND hWnd ,
-    LPCSTR lpText,
-    LPCSTR lpCaption,
-    UINT uType)
-{
-	const int sLen1 = STRtoWSTR(lpText, -1, NULL, 0);
-	LPWSTR lpTextW = alloca(sizeof (wchar_t)*sLen1);
-
-	const int sLen2 = STRtoWSTR(lpCaption, -1, NULL, 0);
-	LPWSTR lpCaptionW = alloca(sizeof (wchar_t)*sLen2);
-
-
-	if (!lpTextW || !lpCaptionW)
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return 0;
-	}
-
-	STRtoWSTR(lpText, -1, lpTextW, sLen1);
-	STRtoWSTR(lpCaption, -1, lpCaptionW, sLen2);
-
-	return MessageBoxW(hWnd, lpTextW, lpCaptionW, uType);
-}
-
-VOID WINAPI OutputDebugStringA(
-    LPCSTR lpOutputString)
-{
-	const int sLen = STRtoWSTR(lpOutputString, -1, NULL, 0);
-	LPWSTR lpOutputStringW = alloca(sizeof (wchar_t)*sLen);
-
-	if (lpOutputStringW)
-		STRtoWSTR(lpOutputString, -1, lpOutputStringW, sLen);
-	else
-	{
-		SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-		return;
-	}
-
-	OutputDebugStringW(lpOutputStringW);
-}
diff --git a/src/sdl12/SRB2CE/cehelp.h b/src/sdl12/SRB2CE/cehelp.h
deleted file mode 100644
index bc265b05859de1029eac92fafdebb1c672aa9519..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2CE/cehelp.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2004 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// DESCRIPTION:
-//      stub and replacement "ANSI" C functions for use under Windows CE
-//
-//-----------------------------------------------------------------------------
-
-#ifndef __I_WINCE__
-#define __I_WINCE__
-
-#ifdef USEASMCE
-#define USEASM // Remline if NASM doesn't work on x86 targets
-#endif
-
-char *strerror(int ecode);
-int access(const char *path, int amode);
-int unlink( const char *filename );
-int remove( const char *path );
-int rename( const char *oldname, const char *newname );
-//CreateDirectoryEx( const char *currectpath, const char *path,SECURITY_ATTRIBUTES)
-
-#ifndef _TIME_T_DEFINED
-typedef long time_t;        /* time value */
-#define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
-#endif
-
-time_t time(time_t *T);
-
-#ifndef __GNUC__
-#ifndef _TM_DEFINED
-struct tm {
-        int tm_sec;     /* seconds after the minute - [0,59] */
-        int tm_min;     /* minutes after the hour - [0,59] */
-        int tm_hour;    /* hours since midnight - [0,23] */
-        int tm_mday;    /* day of the month - [1,31] */
-        int tm_mon;     /* months since January - [0,11] */
-        int tm_year;    /* years since 1900 */
-        int tm_wday;    /* days since Sunday - [0,6] */
-        int tm_yday;    /* days since January 1 - [0,365] */
-        int tm_isdst;   /* daylight savings time flag */
-        };
-#define _TM_DEFINED
-#endif
-
-struct tm * localtime(const time_t *CLOCK);
-
-time_t mktime (struct tm *tim_p);
-#endif
-
-#endif
diff --git a/src/sdl12/SRB2DC/.gitignore b/src/sdl12/SRB2DC/.gitignore
deleted file mode 100644
index a966585d4dc8067dc64060c2883af2c65e394039..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/scramble
diff --git a/src/sdl12/SRB2DC/IP.BIN b/src/sdl12/SRB2DC/IP.BIN
deleted file mode 100644
index c3366213bde1c6b5dc03db4cfdab85c1c74ef5fc..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2DC/IP.BIN and /dev/null differ
diff --git a/src/sdl12/SRB2DC/Makefile.cfg b/src/sdl12/SRB2DC/Makefile.cfg
deleted file mode 100644
index 3edaf8a168d98e0b2e30f23483d8feabb0d100b6..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/Makefile.cfg
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Makefile.cfg for SRB2/Dreamcast
-#
-
-#include $(KOS_BASE)/Makefile.rules
-
-#
-#hmmm, the Dreamcast
-#
-
-	HOSTCC:=$(CC)
-	CC=$(KOS_CC)
-	PREFIX=$(KOS_CC_BASE)/bin/$(KOS_CC_PREFIX)
-	OBJDUMP=$(PREFIX)-objdump
-	OBJCOPY=$(PREFIX)-objcopy
-
-	#NOHW=1      #No working MiniGL right now
-	NOHS=1      #No HWSound right now
-ifndef LWIP
-	NONET=1     #No LWIP
-endif
-	#i_net_o=$(OBJDIR)/i_udp.o #use KOS's UDP
-	#NOMIXER=1  #Basic sound only
-	NOIPX=1    #No IPX network code
-	NOPNG=1    #No Screenshot
-
-	OPTS=$(KOS_CFLAGS) -DUNIXCOMMON -DDC
-ifndef NOHW
-	OPTS+=-DSTATIC_OPENGL -DMINI_GL_COMPATIBILITY -DKOS_GL_COMPATIBILITY
-endif
-	SDL_CFLAGS?=-I$(KOS_BASE)/addons/include/SDL
-	SDL_LDFLAGS?=-lSDL
-	LDFLAGS=$(KOS_LDFLAGS)
-	LIBS:=$(KOS_LIBS) -lconio -lm
-ifndef NOMIXER
-	LIBS:=-loggvorbisplay -lSDL $(LIBS)
-endif
-
-ifdef LWIP
-	OPTS+=-I$(KOS_BASE)/../kos-ports/lwip/kos/include -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include/ipv4 -I$(KOS_BASE)/../kos-ports/lwip/lwip/src/include -DIPv4
-	LIBS:=-llwip4 -lkosutils $(LIBS)
-	OPTS+=-DHAVE_LWIP
-endif
-ifndef NOHW
-	LIBS+=-lgl
-endif
-
-	i_system_o+=$(OBJDIR)/dchelp.o
-	i_main_o=$(KOS_START) $(OBJDIR)/i_main.o $(OBJEXTRA)
-
-	# name of the exefile
-	EXENAME?=SRB2.elf
-	BINNAME?=SRB2.BIN
diff --git a/src/sdl12/SRB2DC/SELFBOOT.BIN b/src/sdl12/SRB2DC/SELFBOOT.BIN
deleted file mode 100644
index a87ee386927e4dd72d947aa08faecd1b94677c93..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2DC/SELFBOOT.BIN and /dev/null differ
diff --git a/src/sdl12/SRB2DC/VMU.xbm b/src/sdl12/SRB2DC/VMU.xbm
deleted file mode 100644
index 0d56985f350e9f1476b53169f551d945caa60fc2..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/VMU.xbm
+++ /dev/null
@@ -1,19 +0,0 @@
-#define VMU_width 48
-#define VMU_height 32
-static unsigned char VMU_bits[] = {
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00,
-   0x00, 0x00, 0x58, 0x75, 0x00, 0x00, 0x00, 0x00, 0xee, 0xaa, 0x00, 0x00,
-   0x00, 0x86, 0x55, 0x55, 0x01, 0x00, 0x00, 0xda, 0xc8, 0xaf, 0x00, 0x00,
-   0x00, 0x62, 0x55, 0x54, 0x00, 0x00, 0x00, 0x32, 0xa2, 0x6c, 0x00, 0x00,
-   0x00, 0x5c, 0x55, 0xfd, 0x01, 0x00, 0x00, 0xac, 0x88, 0xaa, 0x02, 0x00,
-   0x00, 0x54, 0x75, 0x55, 0x05, 0x00, 0x00, 0xac, 0xbf, 0xaa, 0x0a, 0x00,
-   0x00, 0xd6, 0x61, 0x55, 0x15, 0x00, 0x00, 0xe9, 0xc0, 0xaa, 0x2a, 0x00,
-   0x00, 0x39, 0x40, 0x55, 0x55, 0x00, 0x00, 0x6d, 0xc0, 0xaa, 0xbe, 0x00,
-   0x00, 0x6d, 0x40, 0xd5, 0xc3, 0x00, 0x00, 0x6d, 0xc0, 0xea, 0x00, 0x00,
-   0x00, 0x29, 0x60, 0xf5, 0x00, 0x00, 0x00, 0x26, 0xe0, 0xfa, 0x00, 0x00,
-   0x00, 0x58, 0xb8, 0xbd, 0x00, 0x00, 0x00, 0x84, 0x07, 0xdf, 0x00, 0x00,
-   0x00, 0x08, 0x20, 0xae, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x5f, 0x01, 0x00,
-   0x00, 0xc0, 0x3f, 0xb8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00,
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
diff --git a/src/sdl12/SRB2DC/dchelp.c b/src/sdl12/SRB2DC/dchelp.c
deleted file mode 100644
index 5fdf04bc28f47d2ec005336ffbc6f70f8fd95b5c..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/dchelp.c
+++ /dev/null
@@ -1,134 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2006 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// DESCRIPTION:
-//      stub and replacement "ANSI" C functions for use on Dreamcast/KOS
-//
-//-----------------------------------------------------------------------------
-#include <kos/fs.h>
-#include <errno.h>
-#ifndef HAVE_LWIP
-#include <sys/socket.h>
-#endif
-#include "../../doomdef.h"
-#include "dchelp.h"
-
-int access(const char *path, int amode)
-{
-	file_t handle = FILEHND_INVALID;
-
-	if (amode == F_OK || amode == R_OK)
-		handle=fs_open(path,O_RDONLY);
-	else if (amode == (R_OK|W_OK))
-		handle=fs_open(path,O_RDWR);
-	else if (amode == W_OK)
-		handle=fs_open(path,O_WRONLY);
-
-	if (handle != FILEHND_INVALID)
-	{
-		fs_close(handle);
-		return 0;
-	}
-
-	return -1;
-}
-
-double hypot(double x, double y)
-{
-	double ax, yx, yx2, yx1;
-	if (abs(y) > abs(x)) // |y|>|x|
-	{
-		ax = abs(y); // |y| => ax
-		yx = (x/y);
-	}
-	else // |x|>|y|
-	{
-		ax = abs(x); // |x| => ax
-		yx = (x/y);
-	}
-	yx2 = yx*yx; // (x/y)^2
-	yx1 = sqrt(1+yx2); // (1 + (x/y)^2)^1/2
-	return ax*yx1; // |x|*((1 + (x/y)^2)^1/2)
-}
-
-#if !(defined (NONET) || defined (NOMD5))
-#ifdef HAVE_LWIP
-
-#include <lwip/lwip.h>
-
-static uint8 ip[4];
-static char *h_addr_listtmp[2] = {ip, NULL};
-static struct hostent hostenttmp = {NULL, NULL, 0, 1, h_addr_listtmp};
-
-struct hostent *gethostbyname(const char *name)
-{
-	struct sockaddr_in dnssrv;
-	dnssrv.sin_family = AF_INET;
-	dnssrv.sin_port = htons(53);
-	dnssrv.sin_addr.s_addr = htonl(0x0a030202); ///< what?
-	if (lwip_gethostbyname(&dnssrv, name, ip) < 0)
-		return NULL;
-	else
-		return &hostenttmp;
-}
-#else
-
-struct hostent *gethostbyname(const char *name)
-{
-	(void)name;
-	return NULL;
-}
-
-int ioctl(int s, long cmd, void *argp)
-{
-	return fs_ioctl(s, argp, cmd); //FIONBIO?
-}
-
-int select(int maxfdp1, void *readset, void *writeset, void *exceptset,
-                void *timeout)
-{
-	(void)maxfdp1;
-	(void)readset;
-	(void)writeset;
-	(void)exceptset;
-	(void)timeout;
-	errno = EAFNOSUPPORT;
-	return -1;
-}
-
-int getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
-{
-	(void)s;
-	(void)level; //SOL_SOCKET
-	(void)optname; //SO_RCVBUF, SO_ERROR
-	(void)optval;
-	(void)optlen;
-	errno = EAFNOSUPPORT;
-	return -1;
-}
-
-int setsockopt (int s, int level, int optname, void *optval, socklen_t optlen)
-{
-	(void)s;
-	(void)level; //SOL_SOCKET
-	(void)optname; //SO_REUSEADDR, SO_BROADCAST, SO_RCVBUF
-	(void)optval;
-	(void)optlen;
-	errno = EAFNOSUPPORT;
-	return -1;
-}
-
-#endif
-#endif
diff --git a/src/sdl12/SRB2DC/dchelp.h b/src/sdl12/SRB2DC/dchelp.h
deleted file mode 100644
index 236f311103466caa95dc93a956ac2a8a9a15abc6..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/dchelp.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2006 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// DESCRIPTION:
-//       stub and replacement "ANSI" C functions for use on Dreamcast/KOS
-//
-//-----------------------------------------------------------------------------
-
-#ifndef __I_DREAMCAST__
-#define __I_DREAMCAST__
-
-struct hostent
-{
-	char *h_name;			/* Official name of host.  */
-	char **h_aliases;		/* Alias list.  */
-	int h_addrtype;		/* Host address type.  */
-	int h_length;			/* Length of address.  */
-	char **h_addr_list;		/* List of addresses from name server.  */
-#define	h_addr	h_addr_list[0]	/* Address, for backward compatibility.  */
-};
-
-struct hostent *gethostbyname(const char *name);
-
-#ifndef HAVE_LWIP
-#define INADDR_NONE     ((uint32) 0xffffffff)
-#define INADDR_LOOPBACK ((uint32) 0x7f000001)
-#define SOCK_STREAM     1
-#define FIONBIO         0
-#define SOL_SOCKET      0
-#define SO_ERROR        0
-#define SO_REUSEADDR    0
-#define SO_BROADCAST    0
-#define SO_RCVBUF       0
-int ioctl(int s, long cmd, void *argp);
-int select(int maxfdp1, void *readset, void *writeset, void *exceptset, void *timeout);
-int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
-int setsockopt(int s, int level, int optname, void *optval, socklen_t optlen);
-#endif
-#endif
diff --git a/src/sdl12/SRB2DC/i_udp.c b/src/sdl12/SRB2DC/i_udp.c
deleted file mode 100644
index ec5e305fc5f3598e41cadb173ff1bcb5c4a31d55..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/i_udp.c
+++ /dev/null
@@ -1,455 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 2005 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief KOS UDP network interface
-
-#include "../../doomdef.h"
-
-#include "../../i_system.h"
-#include "../../d_event.h"
-#include "../../d_net.h"
-#include "../../m_argv.h"
-
-#include "../../doomstat.h"
-
-#include "../../i_net.h"
-
-#include "../../z_zone.h"
-
-#include "../../i_tcp.h"
-
-#include <kos/net.h>
-//#include <net/net_ipv4.h>
-#define NET_NONE  0x00000000
-#define NET_LOCAL 0x0100007F
-#define NET_ANY   0xFFFFFFFF
-
-#define MAXBANS 20
-
-typedef struct
-{
-	uint32 host;
-	uint16 port;
-} IPaddress;
-
-static IPaddress clientaddress[MAXNETNODES+1];
-static boolean nodeconnected[MAXNETNODES+1];
-
-static int mysocket = 0;
-static boolean init_KOSUDP_driver = false;
-
-static size_t numbans = 0;
-static IPaddress banned[MAXBANS];
-static boolean KOSUDP_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
-
-static inline int net_udp_sendto(int sock, const uint8 *data, int size, uint16 rem_port, uint32 rem_addr)
-{
-	uint8 dst_ip[4] = {((uint8*)(&(rem_addr)))[0],
-			((uint8*)(&(rem_addr)))[1],
-			((uint8*)(&(rem_addr)))[2],
-			((uint8*)(&(rem_addr)))[3]};
-	return net_udp_send_raw(net_default_dev, clientaddress[0].port, rem_port, dst_ip, data, size);
-	(void)sock;
-}
-
-static inline int net_udp_recvfrom(int sock, uint8 *buf, int size, uint16 *rem_port, uint32 *rem_addr)
-{
-	return net_udp_recv(sock, buf, size);
-	(void)rem_port;
-	(void)rem_addr;
-}
-
-static const char *KOSUDP_AddrToStr(IPaddress* sk)
-{
-	static char s[22]; // 255.255.255.255:65535
-	sprintf(s,"%d.%d.%d.%d:%d",
-			((uint8*)(&(sk->host)))[3],
-			((uint8*)(&(sk->host)))[2],
-			((uint8*)(&(sk->host)))[1],
-			((uint8*)(&(sk->host)))[0],
-			net_ntohs(sk->port));
-	return s;
-}
-
-static const char *KOSUDP_GetNodeAddress(int node)
-{
-	if (!nodeconnected[node])
-		return NULL;
-	return KOSUDP_AddrToStr(&clientaddress[node]);
-}
-
-static const char *KOSUDP_GetBanAddress(size_t ban)
-{
-	if (ban > numbans)
-		return NULL;
-	return KOSUDP_AddrToStr(&banned[ban]);
-}
-
-static boolean KOSUDP_cmpaddr(IPaddress* a, IPaddress* b)
-{
-	return (a->host == b->host && (b->port == 0 || a->port == b->port));
-}
-
-static SINT8 getfreenode(void)
-{
-	SINT8 j;
-
-	for (j = 0; j < MAXNETNODES; j++)
-		if (!nodeconnected[j])
-		{
-			nodeconnected[j] = true;
-			return j;
-		}
-	return -1;
-}
-
-static void KOSUDP_Get(void)
-{
-	int size;
-	size_t i;
-	SINT8 j;
-	IPaddress temp = {clientaddress[BROADCASTADDR].host,clientaddress[BROADCASTADDR].port};
-
-	size = net_udp_recvfrom(mysocket,(char *)&doomcom->data, MAXPACKETLENGTH, &temp.port, &temp.host);
-	if (size == 0)
-	{
-		doomcom->remotenode = -1; // no packet
-		return;
-	}
-
-	// find remote node number
-	for (i = 0; i < MAXNETNODES; i++)
-		if (KOSUDP_cmpaddr(&temp, &(clientaddress[i])))
-		{
-			doomcom->remotenode = (INT16)i; // good packet from a game player
-			doomcom->datalength = (INT16)size;
-			return;
-		}
-
-	// not found
-
-	// find a free slot
-	j = getfreenode();
-	if (j > 0)
-	{
-		M_Memcpy(&clientaddress[j], &temp, sizeof (temp));
-		DEBFILE(va("New node detected: node:%d address:%s\n", j,
-				KOSUDP_GetNodeAddress(j)));
-		doomcom->remotenode = (INT16)j; // good packet from a game player
-		doomcom->datalength = (INT16)size;
-		// check if it's a banned dude so we can send a refusal later
-		for (i = 0; i < numbans; i++)
-			if (KOSUDP_cmpaddr(&temp, &banned[i]))
-			{
-				KOSUDP_bannednode[j] = true;
-				DEBFILE("This dude has been banned\n");
-				break;
-			}
-		if (i == numbans)
-			KOSUDP_bannednode[j] = false;
-		return;
-	}
-
-	DEBFILE("New node detected: No more free slots\n");
-	doomcom->remotenode = -1; // no packet
-}
-
-#if 0
-static boolean KOSUDP_CanSend(void)
-{
-	return true;
-}
-#endif
-
-static void KOSUDP_Send(void)
-{
-	const IPaddress *nodeinfo;
-
-	if (!doomcom->remotenode || !nodeconnected[doomcom->remotenode])
-		return;
-
-	nodeinfo = clientaddress + doomcom->remotenode;
-
-	if (net_udp_sendto(mysocket, (char *)&doomcom->data, doomcom->datalength, nodeinfo->port, nodeinfo->host) == -1)
-	{
-		CONS_Printf("KOSUDP: error sending data\n");
-	}
-}
-
-static void KOSUDP_FreeNodenum(int numnode)
-{
-	// can't disconnect from self :)
-	if (!numnode)
-		return;
-
-	DEBFILE(va("Free node %d (%s)\n", numnode, KOSUDP_GetNodeAddress(numnode)));
-
-	nodeconnected[numnode] = false;
-
-	memset(&clientaddress[numnode], 0, sizeof (IPaddress));
-}
-
-static int KOSUDP_Socket(void)
-{
-	int temp = 0;
-	uint16 portnum = 0;
-	const uint32 hostip = net_default_dev?net_ntohl(net_ipv4_address(net_default_dev->ip_addr)):NET_LOCAL;
-	//Hurdler: I'd like to put a server and a client on the same computer
-	//Logan: Me too
-	//BP: in fact for client we can use any free port we want i have read
-	//    in some doc that connect in udp can do it for us...
-	//Alam: where?
-	if (M_CheckParm("-clientport"))
-	{
-		if (!M_IsNextParm())
-			I_Error("syntax: -clientport <portnum>");
-		portnum = net_ntohs(atoi(M_GetNextParm()));
-	}
-	else
-		portnum = net_ntohs(sock_port);
-
-	temp = net_udp_sock_open(portnum, hostip, portnum, NET_NONE);
-	if (temp)
-	{
-		int btemp = net_udp_sock_open(portnum, hostip, portnum, NET_ANY);
-		clientaddress[0].port = portnum;
-		clientaddress[0].host = NET_NONE;
-		if (btemp)
-		{
-			clientaddress[BROADCASTADDR].port = net_ntohs(sock_port);
-			clientaddress[BROADCASTADDR].host = NET_ANY;
-		}
-		else
-		{
-			CONS_Printf("KOSUDP: can't setup broadcast sock\n");
-			net_udp_sock_close(temp);
-			return 0;
-		}
-	}
-	else
-	{
-		CONS_Printf("KOSUDP: can't setup main sock\n");
-		return 0;
-	}
-
-	doomcom->extratics = 1; // internet is very high ping
-
-	return temp;
-}
-
-static void I_ShutdownKOSUDPDriver(void)
-{
-	//net_shutdown();
-	init_KOSUDP_driver = false;
-}
-
-static void I_InitKOSUDPDriver(void)
-{
-	if (init_KOSUDP_driver)
-		I_ShutdownKOSUDPDriver();
-	else
-		net_init();
-	D_SetDoomcom();
-	memset(&clientaddress,0,sizeof (clientaddress));
-	init_KOSUDP_driver = true;
-}
-
-static void KOSUDP_CloseSocket(void)
-{
-	if (mysocket)
-		net_udp_sock_close(mysocket);
-	mysocket = 0;
-}
-
-static SINT8 KOSUDP_NetMakeNodewPort(const char *hostname, const char* port)
-{
-	SINT8 newnode;
-	uint16 portnum = net_ntohs(sock_port);
-
-	if (port && !port[0])
-		portnum = net_ntohs((UINT16)atoi(port));
-
-	newnode = getfreenode();
-	if (newnode == -1)
-		return -1;
-	// find ip of the server
-	clientaddress[newnode].port = portnum;
-	clientaddress[newnode].host = inet_addr(hostname);
-
-	if (clientaddress[newnode].host == NET_NONE)
-	{
-		free(hostname);
-		return -1;
-	}
-	return newnode;
-}
-
-static boolean KOSUDP_OpenSocket(void)
-{
-	size_t i;
-
-	memset(clientaddress, 0, sizeof (clientaddress));
-
-	for (i = 0; i < MAXNETNODES; i++)
-		nodeconnected[i] = false;
-
-	//CONS_Printf("KOSUDP Code starting up\n");
-
-	nodeconnected[0] = true; // always connected to self
-	nodeconnected[BROADCASTADDR] = true;
-	I_NetSend = KOSUDP_Send;
-	I_NetGet = KOSUDP_Get;
-	I_NetCloseSocket = KOSUDP_CloseSocket;
-	I_NetFreeNodenum = KOSUDP_FreeNodenum;
-	I_NetMakeNodewPort = KOSUDP_NetMakeNodewPort;
-
-	//I_NetCanSend = KOSUDP_CanSend;
-
-	// build the socket but close it first
-	KOSUDP_CloseSocket();
-	mysocket = KOSUDP_Socket();
-
-	if (mysocket)
-	{
-#if 0
-		// for select
-		myset = SDLNet_AllocSocketSet(1);
-		if (!myset)
-		{
-			CONS_Printf("SDL_Net: %s",SDLNet_GetError());
-			return false;
-		}
-		if (SDLNet_UDP_AddSocket(myset,mysocket) == -1)
-		{
-			CONS_Printf("SDL_Net: %s",SDLNet_GetError());
-			return false;
-		}
-#endif
-		return true;
-	}
-	return false;
-}
-
-static boolean KOSUDP_Ban(int node)
-{
-	if (numbans == MAXBANS)
-		return false;
-
-	M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (IPaddress));
-	banned[numbans].port = 0'
-	numbans++;
-	return true;
-}
-
-static void KOSUDP_ClearBans(void)
-{
-	numbans = 0;
-}
-
-//
-// I_InitNetwork
-// Only required for DOS, so this is more a dummy
-//
-boolean I_InitNetwork(void)
-{
-	char serverhostname[255];
-	boolean ret = false;
-	//if (!M_CheckParm ("-kosnet"))
-	//	return false;
-	// initilize the driver
-	I_InitKOSUDPDriver();
-	I_AddExitFunc(I_ShutdownKOSUDPDriver);
-	if (!init_KOSUDP_driver)
-		return false;
-
-	if (M_CheckParm("-udpport"))
-	{
-		if (M_IsNextParm())
-			sock_port = (UINT16)atoi(M_GetNextParm());
-		else
-			sock_port = 0;
-	}
-
-	// parse network game options,
-	if (M_CheckParm("-server") || dedicated)
-	{
-		server = true;
-
-		// If a number of clients (i.e. nodes) is specified, the server will wait for the clients
-		// to connect before starting.
-		// If no number is specified here, the server starts with 1 client, and others can join
-		// in-game.
-		// Since Boris has implemented join in-game, there is no actual need for specifying a
-		// particular number here.
-		// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
-/*		if (M_IsNextParm())
-			doomcom->numnodes = (INT16)atoi(M_GetNextParm());
-		else */if (dedicated)
-			doomcom->numnodes = 0;
-		else
-			doomcom->numnodes = 1;
-
-		if (doomcom->numnodes < 0)
-			doomcom->numnodes = 0;
-		if (doomcom->numnodes > MAXNETNODES)
-			doomcom->numnodes = MAXNETNODES;
-
-		// server
-		servernode = 0;
-		// FIXME:
-		// ??? and now ?
-		// server on a big modem ??? 4*isdn
-		net_bandwidth = 16000;
-		hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
-
-		ret = true;
-	}
-	else if (M_CheckParm("-connect"))
-	{
-		if (M_IsNextParm())
-			strcpy(serverhostname, M_GetNextParm());
-		else
-			serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it
-
-		// server address only in ip
-		if (serverhostname[0])
-		{
-			COM_BufAddText("connect \"");
-			COM_BufAddText(serverhostname);
-			COM_BufAddText("\"\n");
-
-			// probably modem
-			hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
-		}
-		else
-		{
-			// so we're on a LAN
-			COM_BufAddText("connect any\n");
-
-			net_bandwidth = 800000;
-			hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
-		}
-	}
-
-	I_NetOpenSocket = KOSUDP_OpenSocket;
-	I_Ban = KOSUDP_Ban;
-	I_ClearBans = KOSUDP_ClearBans;
-	I_GetNodeAddress = KOSUDP_GetNodeAddress;
-	I_GetBanAddress = KOSUDP_GetBanAddress;
-	bannednode = KOSUDP_bannednode;
-
-	return ret;
-}
diff --git a/src/sdl12/SRB2DC/scramble.c b/src/sdl12/SRB2DC/scramble.c
deleted file mode 100644
index a3483b00dcd3a3ac8579b3a557ca9717dc4395cb..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2DC/scramble.c
+++ /dev/null
@@ -1,259 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#define MAXCHUNK (2048*1024)
-
-static unsigned int seed;
-
-void my_srand(unsigned int n)
-{
-  seed = n & 0xffff;
-}
-
-unsigned int my_rand()
-{
-  seed = (seed * 2109 + 9273) & 0x7fff;
-  return (seed + 0xc000) & 0xffff;
-}
-
-void load(FILE *fh, unsigned char *ptr, unsigned long sz)
-{
-  if (fread(ptr, 1, sz, fh) != sz)
-    {
-      fprintf(stderr, "Read error!\n");
-      exit(1);
-    }
-}
-
-void load_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
-{
-  static int idx[MAXCHUNK/32];
-  int i;
-
-  /* Convert chunk size to number of slices */
-  sz /= 32;
-
-  /* Initialize index table with unity,
-     so that each slice gets loaded exactly once */
-  for (i = 0; i < sz; i++)
-    idx[i] = i;
-
-  for (i = sz-1; i >= 0; --i)
-    {
-      /* Select a replacement index */
-      int x = (my_rand() * i) >> 16;
-
-      /* Swap */
-      int tmp = idx[i];
-      idx[i] = idx[x];
-      idx[x] = tmp;
-
-      /* Load resulting slice */
-      load(fh, ptr+32*idx[i], 32);
-    }
-}
-
-void load_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
-{
-  unsigned long chunksz;
-
-  my_srand(filesz);
-
-  /* Descramble 2 meg blocks for as long as possible, then
-     gradually reduce the window down to 32 bytes (1 slice) */
-  for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
-    while (filesz >= chunksz)
-      {
-	load_chunk(fh, ptr, chunksz);
-	filesz -= chunksz;
-	ptr += chunksz;
-      }
-
-  /* Load final incomplete slice */
-  if (filesz)
-    load(fh, ptr, filesz);
-}
-
-void read_file(char *filename, unsigned char **ptr, unsigned long *sz)
-{
-  FILE *fh = fopen(filename, "rb");
-  if (fh == NULL)
-    {
-      fprintf(stderr, "Can't open \"%s\".\n", filename);
-      exit(1);
-    }
-  if (fseek(fh, 0, SEEK_END)<0)
-    {
-      fprintf(stderr, "Seek error.\n");
-      exit(1);
-    }
-  *sz = ftell(fh);
-  *ptr = malloc(*sz);
-  if ( *ptr == NULL )
-    {
-      fprintf(stderr, "Out of memory.\n");
-      exit(1);
-    }
-  if (fseek(fh, 0, SEEK_SET)<0)
-    {
-      fprintf(stderr, "Seek error.\n");
-      exit(1);
-    }
-  load_file(fh, *ptr, *sz);
-  fclose(fh);
-}
-
-void save(FILE *fh, unsigned char *ptr, unsigned long sz)
-{
-  if (fwrite(ptr, 1, sz, fh) != sz)
-    {
-      fprintf(stderr, "Write error!\n");
-      exit(1);
-    }
-}
-
-void save_chunk(FILE *fh, unsigned char *ptr, unsigned long sz)
-{
-  static int idx[MAXCHUNK/32];
-  int i;
-
-  /* Convert chunk size to number of slices */
-  sz /= 32;
-
-  /* Initialize index table with unity,
-     so that each slice gets saved exactly once */
-  for (i = 0; i < sz; i++)
-    idx[i] = i;
-
-  for (i = sz-1; i >= 0; --i)
-    {
-      /* Select a replacement index */
-      int x = (my_rand() * i) >> 16;
-
-      /* Swap */
-      int tmp = idx[i];
-      idx[i] = idx[x];
-      idx[x] = tmp;
-
-      /* Save resulting slice */
-      save(fh, ptr+32*idx[i], 32);
-    }
-}
-
-void save_file(FILE *fh, unsigned char *ptr, unsigned long filesz)
-{
-  unsigned long chunksz;
-
-  my_srand(filesz);
-
-  /* Descramble 2 meg blocks for as long as possible, then
-     gradually reduce the window down to 32 bytes (1 slice) */
-  for (chunksz = MAXCHUNK; chunksz >= 32; chunksz >>= 1)
-    while (filesz >= chunksz)
-      {
-	save_chunk(fh, ptr, chunksz);
-	filesz -= chunksz;
-	ptr += chunksz;
-      }
-
-  /* Save final incomplete slice */
-  if (filesz)
-    save(fh, ptr, filesz);
-}
-
-void write_file(char *filename, unsigned char *ptr, unsigned long sz)
-{
-  FILE *fh = fopen(filename, "wb");
-  if (fh == NULL)
-    {
-      fprintf(stderr, "Can't open \"%s\".\n", filename);
-      exit(1);
-    }
-  save_file(fh, ptr, sz);
-  fclose(fh);
-}
-
-void descramble(char *src, char *dst)
-{
-  unsigned char *ptr = NULL;
-  unsigned long sz = 0;
-  FILE *fh;
-
-  read_file(src, &ptr, &sz);
-
-  fh = fopen(dst, "wb");
-  if (fh == NULL)
-    {
-      fprintf(stderr, "Can't open \"%s\".\n", dst);
-      exit(1);
-    }
-  if ( fwrite(ptr, 1, sz, fh) != sz )
-    {
-      fprintf(stderr, "Write error.\n");
-      exit(1);
-    }
-  fclose(fh);
-  free(ptr);
-}
-
-void scramble(char *src, char *dst)
-{
-  unsigned char *ptr = NULL;
-  unsigned long sz = 0;
-  FILE *fh;
-
-  fh = fopen(src, "rb");
-  if (fh == NULL)
-    {
-      fprintf(stderr, "Can't open \"%s\".\n", src);
-      exit(1);
-    }
-  if (fseek(fh, 0, SEEK_END)<0)
-    {
-      fprintf(stderr, "Seek error.\n");
-      exit(1);
-    }
-  sz = ftell(fh);
-  ptr = malloc(sz);
-  if ( ptr == NULL )
-    {
-      fprintf(stderr, "Out of memory.\n");
-      exit(1);
-    }
-  if (fseek(fh, 0, SEEK_SET)<0)
-    {
-      fprintf(stderr, "Seek error.\n");
-      exit(1);
-    }
-  if ( fread(ptr, 1, sz, fh) != sz )
-    {
-      fprintf(stderr, "Read error.\n");
-      exit(1);
-    }
-  fclose(fh);
-
-  write_file(dst, ptr, sz);
-
-  free(ptr);
-}
-
-int main(int argc, char *argv[])
-{
-  int opt = 0;
-
-  if (argc > 1 && !strcmp(argv[1], "-d"))
-    opt ++;
-
-  if (argc != 3+opt)
-    {
-      fprintf(stderr, "Usage: %s [-d] from to\n", argv[0]);
-      exit(1);
-    }
-
-  if (opt)
-    descramble(argv[2], argv[3]);
-  else
-    scramble(argv[1], argv[2]);
-
-  return 0;
-}
diff --git a/src/sdl12/SRB2PS3/ICON0.png b/src/sdl12/SRB2PS3/ICON0.png
deleted file mode 100644
index 140230c1e17bcf341498374ede7feea16ac5b54c..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2PS3/ICON0.png and /dev/null differ
diff --git a/src/sdl12/SRB2PS3/Makefile.cfg b/src/sdl12/SRB2PS3/Makefile.cfg
deleted file mode 100644
index a4a01714aee4355a5b1d330533c2060f98c9b84c..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PS3/Makefile.cfg
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# Makefile.cfg for SRB2 for the PlayStation 3 using PSL1GHT
-#
-
-# Check if PS3DEV and PSL1GHT is set in the environment. If so, continue with compilation.
-.SUFFIXES:
-
-ifeq ($(strip $(PS3DEV)),)
-$(error "Please set PS3DEV in your environment. export PS3DEV=<path to>ps3dev-toolchain")
-endif
-
-ifeq ($(strip $(PSL1GHT)),)
-$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path to>PSL1GHT")
-endif
-
-# Set compiler flags
-
-# Disable same warning flags
-WFLAGS+=-Wno-shadow -Wno-char-subscripts -Wno-format
-
-ifdef JAILBREAK
-EXENAME?=SRB2PS3-jb.elf
-PKGNAME?=SRB2PS3-jb.pkg
-else
-EXENAME?=SRB2PS3.elf
-PKGNAME?=SRB2PS3.pkg
-endif
-DGBNAME?=$(EXENAME).debug
-
-SRB2PS3DIR=sdl/SRB2PS3
-ICON0?=$(SRB2PS3DIR)/ICON0.png
-SFOXML?=sfo.xml
-SRB2TTF?=sdl/srb2.ttf
-
-TITLE=Sonic Robo Blast 2 v2.0.6
-APPID=SRB2-PS3
-CONTENTID=UP0001-$(APPID)_00-0000000000000000
-
-FSELF=$(PS3DEV)/bin/fself.py
-MAKE_SELF_NPDRM=$(PS3DEV)/ps3publictools/make_self_npdrm
-FINALIZE=$(PS3DEV)/ps3publictools/package_finalize
-SFO=$(PS3DEV)/bin/sfo.py
-PKG=$(PS3DEV)/bin/pkg.py
-PS3LOADEXE=$(PS3DEV)/ps3tools/ps3load
-SED=sed
-MV=mv
-XARGS=xargs
-FOR=for
-SHXARGS:=$(XARGS)
-SHSED:=$(SED)
-SPRXLINKER=$(PS3DEV)/bin/sprxlinker
-
-ifdef JAILBREAK
-PKGDIR=$(BIN)/pkg-jb
-else
-PKGDIR=$(BIN)/pkg
-endif
-USRDIR=$(PKGDIR)/USRDIR
-ETCDIR=$(USRDIR)/etc
-WGET=wget -P $(ETCDIR) -c -nc
-
-ifndef ECHO
-	FSELF:=@$(FSELF)
-	MAKE_SELF_NPDRM:=@$(MAKE_SELF_NPDRM)
-	FINALIZE:=@$(FINALIZE)
-	SFO:=@$(SFO)
-	PKG:=@$(PKG)
-	PS3LOADEXE:=@$(PS3LOADEXE)
-	SED:=@$(SED)
-	MV:=@$(MV)
-	SPRXLINKER:=@$(SPRXLINKER)
-	XARGS:=@$(XARGS)
-	FOR:=@(FOR)
-endif
-
-# SRB2PS3 needs SDL_ttf to display any console text
-SDL_TTF=1
-
-# newlib has no support for networking
-#NONET=1
-
-# use absolute paths because changing PATH variable breaks distcc
-PREFIX := $(PS3DEV)/ppu/bin/$(PREFIX)
-
-# PS3DEV toolchain libdir and includedir
-PS3DEV_INC := $(PS3DEV)/ppu/include
-PS3DEV_LIB := $(PS3DEV)/ppu/lib
-
-# PSL1GHT libdir and includedir
-PSL1GHT_INC := $(PSL1GHT)/ppu/include
-PSL1GHT_LIB := $(PSL1GHT)/ppu/lib
-
-PS3PORTS := $(PS3DEV)/portlibs
-PS3PORTS_BIN := $(PS3PORTS)/ppu/bin
-PS3PORTS_INC := $(PS3PORTS)/ppu/include
-
-PNG_CONFIG := $(PS3PORTS_BIN)/libpng-config
-# static compilation
-PNG_STATIC=1
-
-SDL_CONFIG := $(PS3PORTS_BIN)/sdl-config
-
-INCLUDE := -I$(PSL1GHT_INC) -I$(PS3DEV_INC) -I$(PS3PORTS_INC)
-
-OPTS+=-D_PS3 -DUNIXCOMMON
-CFLAGS+= -g $(INCLUDE) -L$(PSL1GHT_LIB) -L$(PS3DEV_LIB) -L$(PS3DEV)/lib
-CXXFLAGS+=$(CFLAGS)
-LDFLAGS+= -B$(PSL1GHT_LIB) -B$(PS3DEV_LIB) -B$(PS3DEV)/lib
-LIBS+=-lrsx
-ifndef NONET
-LIBS+=-lnet -lsysmodule
-endif
-
-$(BIN)/$(PKGNAME): $(OBJS) $(BIN)/$(EXENAME)
-	@echo Linking $(PKGNAME)...
-	-$(MKDIR) $(ETCDIR)
-	$(CP) $(ICON0) $(PKGDIR)
-	$(CP) $(SRB2TTF) $(ETCDIR)
-ifdef WITHDATA
-	$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) 's/\.srb/\.wad/' | $(SHXARGS) -n 1 basename); do \
-		$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
-	done
-endif
-	$(SPRXLINKER) $(BIN)/$(EXENAME)
-ifdef JAILBREAK
-	$(SED) 's/@@PS3_SYSTEM_VER@@/3.41/' $(SRB2PS3DIR)/$(SFOXML) > $(BIN)/$(SFOXML)
-	$(FSELF) -n $(BIN)/$(EXENAME) $(USRDIR)/EBOOT.BIN
-else
-	$(SED) 's/@@PS3_SYSTEM_VER@@/3.55/' $(SRB2PS3DIR)/$(SFOXML) > $(BIN)/$(SFOXML)
-	$(MAKE_SELF_NPDRM) $(BIN)/$(EXENAME) $(USRDIR)/EBOOT.BIN $(CONTENTID)
-endif
-	$(SFO) --title "$(TITLE)" --appid "$(APPID)" -f $(BIN)/$(SFOXML) $(PKGDIR)/PARAM.SFO
-	$(PKG) --contentid $(CONTENTID) $(PKGDIR)/ $(BIN)/$(PKGNAME)
-ifndef JAILBREAK
-	$(FINALIZE) $(BIN)/$(PKGNAME)
-endif
-
-run: $(BIN)/$(EXENAME)
-	$(PS3LOADEXE) $(USRDIR)/EBOOT.BIN
diff --git a/src/sdl12/SRB2PS3/sfo.xml b/src/sdl12/SRB2PS3/sfo.xml
deleted file mode 100644
index d7719b5401f2aa88cfa513ca10ce31e926b27947..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PS3/sfo.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" ?>
-<sfo>
-	<value name="APP_VER" type="string">
-		02.06
-	</value>
-	<value name="ATTRIBUTE" type="integer">
-		0
-	</value>
-	<value name="BOOTABLE" type="integer">
-		1
-	</value>
-	<value name="CATEGORY" type="string">
-		HG
-	</value>
-	<value name="LICENSE" type="string">
-		This application was created with the official non-official SDK called PSL1GHT, for more information visit http://www.psl1ght.com/ . This is in no way associated with Sony Computer Entertainment Inc., please do not contact them for help, they will not be able to provide it.
-	</value>
-	<value name="PARENTAL_LEVEL" type="integer">
-		0
-	</value>
-	<value name="PS3_SYSTEM_VER" type="string">
-		0@@PS3_SYSTEM_VER@@00
-	</value>
-	<value name="RESOLUTION" type="integer">
-		63
-	</value>
-	<value name="SOUND_FORMAT" type="integer">
-		279
-	</value>
-	<value name="TITLE" type="string">
-		Sonic Robo Blast 2
-	</value>
-	<value name="TITLE_ID" type="string">
-		SRB200000
-	</value>
-	<value name="VERSION" type="string">
-		02.06
-	</value>
-</sfo>
diff --git a/src/sdl12/SRB2PSP/ICON0.png b/src/sdl12/SRB2PSP/ICON0.png
deleted file mode 100644
index 140230c1e17bcf341498374ede7feea16ac5b54c..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2PSP/ICON0.png and /dev/null differ
diff --git a/src/sdl12/SRB2PSP/Makefile.cfg b/src/sdl12/SRB2PSP/Makefile.cfg
deleted file mode 100644
index f9ec6416bad850f2281825c50db87e24a1d63e66..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/Makefile.cfg
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Makefile.cfg for SRB2/PSP
-#
-
-#
-#hmmm, the PSP
-#
-
-	PSPSDK=$(shell psp-config -p)
-	PSPDEV=$(shell psp-config -d)
-	PSPPREFIX=$(shell psp-config -P)
-	STRIP=psp-strip
-	MKSFO?=mksfoex -d MEMSIZE=1
-	#MKSFO=mksfo
-	PACK_PBP=pack-pbp
-	FIXUP=psp-fixup-imports
-	HOSTCC:=$(CC)
-	CC=$(PSPDEV)/bin/psp-gcc
-	OBJCOPY=psp-objcopy
-	OBJDUMP=psp-objdump
-ifdef FIXEDPRX
-	PRXGEN=psp-prxgen
-else
-	PRXGEN=$(OBJCOPY)
-endif
-ifndef PRXSIGN
-	SIGNER:=$(PSPDEV)/bin/$(OBJCOPY)
-endif
-
-ifndef ECHO
-	MKSFO:=@$(MKSFO)
-	PACK_PBP:=@$(PACK_PBP)
-	FIXUP:=@$(FIXUP)
-	PRXGEN:=@$(PRXGEN)
-endif
-
-	PSP_EBOOT_TITLE=SRB2-PSP vME
-	PSP_EBOOT_SFO=$(BIN)/PARAM.SFO
-	PSP_EBOOT_ICON=sdl/SRB2PSP/ICON0.png
-	PSP_EBOOT_ICON1=NULL
-	PSP_EBOOT_UNKPNG=NULL
-	PSP_EBOOT_PIC1=sdl/SRB2PSP/PIC1.png
-	PSP_EBOOT_SND0=NULL
-	PSP_EBOOT_PSAR=NULL
-
-	SIGNER?=sdl/SRB2PSP/psp-prxsign/psp-prxsign
-
-	SDL=1
-	PREFIX=psp
-	NONX86=1
-	#NOHW=1
-	NOHS=1
-	NOMD5=1
-	NONET=1       #No TCPIP code
-	NOPNG=1       #No Screenshot
-
-	OPTS=-I$(PSPPREFIX)/include -I$(PSPSDK)/include
-	OPTS+=-DUNIXCOMMON -DFORCESDLMAIN -G0
-	WFLAGS+=-Wno-undef
-	WFLAGS+=-O1
-	LIBS=-lm
-	SDL_CONFIG?=$(PSPPREFIX)/bin/sdl-config
-	#SDL_CFLAGS?=-I$(PSPDEV)/psp/include/SDL
-	#SDL_LDFLAGS?=-lSDLmain -lSDL -lglut -lGLU -lGL -lpspgu -lpspaudiolib -lpspaudio -lpsphprm -lpspvfpu -lpsprtc
-ifndef NOMIXER
-	LIBS:=-liberty -lvorbisfile -lvorbis -logg -lSDL $(LIBS)
-endif
-ifndef NOHW
-	OPTS+=-DSTATIC_OPENGL -DMINI_GL_COMPATIBILITY
-	LIBS+=-lGLU -lGL -lm
-endif
-	#PSPSDK_LIBS=-L$(PSPSDK)/lib -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk
-	#LIBS+=$(PSPSDK_LIBS) -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel
-ifdef FIXEDPRX
-	LDFLAGS := -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx $(LDFLAGS)
-	LIBS+=$(PSPSDK)/lib/prxexports.o
-endif
-
-ifeq ($(PSP_FW_VERSION),)
-PSP_FW_VERSION=150
-endif
-
-	CPPFLAGS:=-D_PSP_FW_VERSION=$(PSP_FW_VERSION) $(CPPFLAGS)
-
-
-	# name of the exefile
-	EXENAME?=SRB2PSP.elf
-	PRXNAME?=SRB2PSP.prx
-	DBGNAME?=SRB2PSP.debug
-
-post-build: $(BIN)/EBOOT.PBP
-
-kxploit: $(BIN)/$(EXENAME) $(PSP_EBOOT_SFO)
-	-$(MKDIR) "$(BIN)/kxploit/srb2"
-	@echo emitting kxploit/srb2/
-	$(STRIP) $(BIN)/$(EXENAME) -o $(BIN)/kxploit/srb2/EBOOT.PBP
-	@echo emitting kxploit/srb2%
-	-$(MKDIR) "$(BIN)/kxploit/srb2%/"
-	$(PACK_PBP) "$(BIN)/kxploit/srb2%/EBOOT.PBP" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
-		$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
-		$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
-
-sdl/SRB2PSP/psp-prxsign/psp-prxsign:
-	-$(MAKE) -C sdl/SRB2PSP/psp-prxsign CFLAGS=-pipe CC="$(HOSTCC)"
-
-fix-up: $(BIN)/$(EXENAME)
-	@echo Running psp-fixup-imports on $(EXENAME)
-	$(FIXUP) $(BIN)/$(EXENAME)
-
-$(BIN)/$(PRXNAME): $(BIN)/$(EXENAME) fix-up
-	@echo Building $(PRXNAME) out of $(EXENAME)
-	$(PRXGEN) $(BIN)/$(EXENAME) $@
-
-$(BIN)/EBOOT.PBP: $(BIN)/$(PRXNAME) $(SIGNER) $(PSP_EBOOT_SFO)
-	@echo Signing and running pack-pbp to make PBP
-	$(SIGNER) $(BIN)/$(PRXNAME) $(BIN)/$(PRXNAME).sign
-	$(PACK_PBP) $@ $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
-		$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
-		$(PSP_EBOOT_SND0)  $(BIN)/$(PRXNAME).sign $(PSP_EBOOT_PSAR)
-	$(REMOVE) $(BIN)/$(PRXNAME).sign
-
-$(PSP_EBOOT_SFO):
-	-$(MKDIR) $(BIN)
-	$(MKSFO) '$(PSP_EBOOT_TITLE)' $@
-
-#include $(PSPSDK)/lib/build.mak
diff --git a/src/sdl12/SRB2PSP/PIC1.png b/src/sdl12/SRB2PSP/PIC1.png
deleted file mode 100644
index 0722a96bc78ce4c82edaed348bc6f86826e5690a..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2PSP/PIC1.png and /dev/null differ
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/.gitignore b/src/sdl12/SRB2PSP/psp-prxsign/.gitignore
deleted file mode 100644
index 6a07f1a5a2baa158afc10a9ea7dd98ac57c83d2e..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/psp-prxsign
-/psp-prxsign.exe
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/Makefile b/src/sdl12/SRB2PSP/psp-prxsign/Makefile
deleted file mode 100644
index 4a9b7da0f29b4cad9972d099ea87490113bc91e4..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-EXE=psp-prxsign
-SRC=main.c cmac.c
-OBJ=$(SRC:.c=.o)# replaces the .c from SRC with .o
-
-OPENSSL_PKGCONFIG?=openssl
-OPENSSL_CFLAGS?=$(shell pkg-config $(OPENSSL_PKGCONFIG) --cflags)
-OPENSSL_LDFLAGS?=$(shell pkg-config $(OPENSSL_PKGCONFIG) --libs)
-
-CFLAGS+=$(OPENSSL_CFLAGS)
-LDFLAGS+=$(OPENSSL_LDFLAGS)
-
-.PHONY : all     # .PHONY ignores files named all
-
-all: $(EXE)      # all is dependent on $(BIN) to be complete
-
-
-$(EXE): $(OBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist
-	$(CC) $^ $(LDFLAGS) -o $@
-
-.PHONY : clean   # .PHONY ignores files named clean
-clean:
-	-$(RM) $(OBJ) $(EXE)
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/cmac.c b/src/sdl12/SRB2PSP/psp-prxsign/cmac.c
deleted file mode 100644
index f527f7a71a322d49ba850250587eed1e77568abf..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/cmac.c
+++ /dev/null
@@ -1,130 +0,0 @@
-#include "cmac.h"
-
-#define AES_128 0
-unsigned char const_Rb[16] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87
-};
-unsigned char const_Zero[16] = {
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-void xor_128(unsigned char *a, unsigned char *b, unsigned char *out)
-{
-	int i;
-	for (i=0;i<16; i++)
-	{
-		out[i] = a[i] ^ b[i];
-	}
-}
-
-/* AES-CMAC Generation Function */
-
-static inline void leftshift_onebit(unsigned char *input,unsigned char *output)
-{
-	int i;
-    unsigned char overflow = 0;
-
-	for ( i=15; i>=0; i-- )
-	{
-		output[i] = input[i] << 1;
-		output[i] |= overflow;
-		overflow = (input[i] & 0x80)?1:0;
-	}
-}
-
-void generate_subkey(unsigned char *key, unsigned char *K1, unsigned char *K2)
-{
-	unsigned char L[16];
-	unsigned char Z[16];
-	unsigned char tmp[16];
-	int i;
-
-	for ( i=0; i<16; i++ ) Z[i] = 0;
-
-	AES_KEY aes;
-	AES_set_encrypt_key(key, 128, &aes);
-
-	AES_encrypt(Z, L, &aes);
-
-	if ( (L[0] & 0x80) == 0 ) /* If MSB(L) = 0, then K1 = L << 1 */
-	{
-		leftshift_onebit(L,K1);
-	} else {    /* Else K1 = ( L << 1 ) (+) Rb */
-        leftshift_onebit(L,tmp);
-        xor_128(tmp,const_Rb,K1);
-    }
-
-	if ( (K1[0] & 0x80) == 0 )
-	{
-        leftshift_onebit(K1,K2);
-    } else {
-        leftshift_onebit(K1,tmp);
-        xor_128(tmp,const_Rb,K2);
-    }
-}
-
-static inline void padding ( unsigned char *lastb, unsigned char *pad, int length )
-{
-	int j;
-
-	/* original last block */
-	for ( j=0; j<16; j++ )
-	{
-		if ( j < length )
-		{
-            pad[j] = lastb[j];
-        } else if ( j == length ) {
-            pad[j] = 0x80;
-        } else {
-            pad[j] = 0x00;
-        }
-	}
-}
-
-void AES_CMAC ( unsigned char *key, unsigned char *input, int length, unsigned char *mac )
-{
-    unsigned char X[16],Y[16], M_last[16], padded[16];
-    unsigned char K1[16], K2[16];
-    int n, i, flag;
-    generate_subkey(key,K1,K2);
-
-    n = (length+15) / 16;       /* n is number of rounds */
-
-    if ( n == 0 )
-	{
-        n = 1;
-        flag = 0;
-    } else {
-		if ( (length%16) == 0 ) { /* last block is a complete block */
-            flag = 1;
-        } else { /* last block is not complete block */
-            flag = 0;
-        }
-
-    }
-
-    if ( flag ) { /* last block is complete block */
-        xor_128(&input[16*(n-1)],K1,M_last);
-    } else {
-        padding(&input[16*(n-1)],padded,length%16);
-        xor_128(padded,K2,M_last);
-    }
-    AES_KEY aes;
-    AES_set_encrypt_key(key, 128, &aes);
-
-    for ( i=0; i<16; i++ ) X[i] = 0;
-    for ( i=0; i<n-1; i++ )
-    {
-        xor_128(X,&input[16*i],Y); /* Y := Mi (+) X  */
-        AES_encrypt(Y, X, &aes); /* X := AES-128(KEY, Y); */
-    }
-
-    xor_128(X,M_last,Y);
-    AES_encrypt(Y, X, &aes);
-
-    for ( i=0; i<16; i++ ) {
-        mac[i] = X[i];
-    }
-}
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/cmac.h b/src/sdl12/SRB2PSP/psp-prxsign/cmac.h
deleted file mode 100644
index 563045841770a6c236e41d897199bce757ba2894..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/cmac.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- ---------------------------------------------------------------------------
- Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
-
- LICENSE TERMS
-
- The redistribution and use of this software (with or without changes)
- is allowed without the payment of fees or royalties provided that:
-
-  1. source code distributions include the above copyright notice, this
-     list of conditions and the following disclaimer;
-
-  2. binary distributions include the above copyright notice, this list
-     of conditions and the following disclaimer in their documentation;
-
-  3. the name of the copyright holder is not used to endorse products
-     built using this software without specific written permission.
-
- DISCLAIMER
-
- This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
- and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue Date: 6/10/2008
-*/
-
-#ifndef CMAC_AES_H
-#define CMAC_AES_H
-
-#include <string.h>
-#include <openssl/aes.h>
-
-void xor_128(unsigned char *a, unsigned char *b, unsigned char *out);
-void generate_subkey(unsigned char *key, unsigned char *K1, unsigned char *K2);
-void AES_CMAC(unsigned char *key, unsigned char *input, int length, unsigned char *mac);
-
-#endif
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h b/src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h
deleted file mode 100644
index 76c921ef06ceb3f51a347750e85992cfd037bc40..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __kirk_header__
-#define __kirk_header__
-
-static unsigned int size_kirk_header = 272;
-static unsigned char kirk_header[] __attribute__((aligned(16))) = {
-	0x2a, 0x4f, 0x3c, 0x49, 0x8a, 0x73, 0x4e, 0xd1, 0xf4, 0x55, 0x93, 0x0b, 0x9b, 0x69, 0xdc, 0x65,
-	0x73, 0x22, 0x69, 0xd3, 0x73, 0x96, 0x7a, 0x60, 0x66, 0x8c, 0x88, 0xcf, 0x2f, 0x83, 0x58, 0xbc,
-	0xb2, 0x00, 0x0a, 0x11, 0x72, 0x43, 0xc5, 0xde, 0xef, 0xbb, 0x2c, 0xbf, 0x97, 0x79, 0x6b, 0x9c,
-	0x10, 0x1e, 0x7c, 0x57, 0x0e, 0xdb, 0x1d, 0x61, 0x6e, 0xb5, 0xf9, 0x3d, 0x35, 0xe9, 0x5c, 0xd8,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x33, 0x55, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x7e, 0x50, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x22, 0x74, 0x69, 0x66, 0x70, 0x73,
-	0x70, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x33, 0x55, 0x00, 0x50, 0x34, 0x55, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x40, 0x67, 0x3d, 0x00, 0x50, 0x55, 0x0a, 0x01, 0x10, 0x00, 0x40, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x4c, 0x6b, 0x3d, 0x00, 0xcc, 0xbb, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
-};
-
-#endif
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/main.c b/src/sdl12/SRB2PSP/psp-prxsign/main.c
deleted file mode 100644
index a970ae6c1f7d50a12572c16ebe13b1e3f2da9b38..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/main.c
+++ /dev/null
@@ -1,190 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/aes.h>
-#include <openssl/sha.h>
-#include <elf.h>
-#include "cmac.h"
-#include "kirk_header.h"
-#include "psp_header.h"
-
-typedef unsigned char byte;
-
-typedef struct {
-	byte key[16];
-	byte ckey[16];
-	byte head_hash[16];
-	byte data_hash[16];
-	byte unused[32];
-	int unk1; // 1
-	int unk2; // 0
-	int unk3[2];
-	int datasize;
-	int dataoffset;
-	int unk4[6];
-} kirk1head_t;
-
-// secret kirk command 1 key
-byte kirk_key[] = {
-	0x98, 0xc9, 0x40, 0x97, 0x5c, 0x1d, 0x10, 0xe8, 0x7f, 0xe6, 0x0e, 0xa3, 0xfd, 0x03, 0xa8, 0xba
-};
-
-int main(int argc, char **argv)
-{
-	int i, relrem, size, fullsize, blocks, datasize;
-	size_t j;
-	kirk1head_t kirk;
-	byte iv[16];
-	byte cmac[32];
-	byte subk[32];
-	byte psph[0x150];
-	byte *datablob;
-	byte *filebuff;
-	FILE *f;
-	AES_KEY aesKey;
-	Elf32_Ehdr *ehdr;
-	Elf32_Shdr *shdr;
-	Elf32_Rel *relo;
-
-	if(argc < 3) {
-		printf("Usage: %s unsigned.prx signed.prx\n", argv[0]);
-		return 1;
-	}
-
-	// clean kirk header, use modified PRXdecrypter to get it
-	/*f = fopen(argv[1], "rb");
-	if(!f) {
-		printf("failed to open %s\n", argv[1]);
-		return 1;
-	}
-	fread(&kirk, 1, sizeof(kirk1head_t), f);
-	fclose(f);*/
-	//memcpy(&kirk, kirk_header, size_kirk_header);
-	memcpy(&kirk, kirk_header, sizeof(kirk1head_t));
-
-	datasize = kirk.datasize;
-	if(datasize % 16) datasize += 16 - (datasize % 16);
-
-	// original ~PSP header
-	/*f = fopen(argv[2], "rb");
-	if(!f) {
-		free(datablob);
-		printf("failed to open %s\n", argv[2]);
-		return 1;
-	}
-	fread(psph, 1, 0x150, f);
-	fclose(f);*/
-	memcpy(&psph, psp_header, size_psp_header);
-
-	// file to encrypt
-	f = fopen(argv[1], "rb");
-	if(!f) {
-		printf("psp-prxsign: Unable to open PRX\n");
-		return 1;
-	}
-	fseek(f, 0, SEEK_END);
-	size = ftell(f);
-	if(size > datasize - 16) {
-		fclose(f);
-		printf("psp-prxsign: PRX is too large\n");
-		return 1;
-	}
-	printf("%s : %i\n", argv[1], size);
-	fseek(f, 0, SEEK_SET);
-
-	fullsize = datasize + 0x30 + kirk.dataoffset;
-
-	// datablob holds everything needed to calculate data HASH
-	datablob = malloc(fullsize);
-	if(!datablob) {
-		fclose(f);
-		printf("psp-prxsign: Failed to allocate memory for blob\n");
-		return 1;
-	}
-	memset(datablob, 0, fullsize);
-	memcpy(datablob, &kirk.unk1, 0x30);
-	memcpy(datablob + 0x30, psph, kirk.dataoffset);
-	filebuff = datablob + 0x30 + kirk.dataoffset;
-
-	int whocares = fread(filebuff, 1, size, f);
-	(void)whocares;
-	fclose(f);
-
-	// remove relocations type 7
-	relrem = 0;
-	ehdr = (void *)filebuff;
-	if(!memcmp(ehdr->e_ident, ELFMAG, 4) && ehdr->e_shnum) {
-		shdr = (void *)(filebuff + ehdr->e_shoff);
-		for(i = 0; i < ehdr->e_shnum; i++) {
-			if(shdr[i].sh_type == 0x700000A0) {
-				relo = (void *)(filebuff + shdr[i].sh_offset);
-				for(j = 0; j < shdr[i].sh_size / sizeof(Elf32_Rel); j++) {
-					if((relo[j].r_info & 0xFF) == 7) {
-						relo[j].r_info = 0;
-						relrem++;
-					}
-				}
-			}
-		}
-	}
-	//printf("%i relocations type 7 removed\ncalculating ...\n", relrem);
-
-	// get AES/CMAC key
-	AES_set_decrypt_key(kirk_key, 128, &aesKey);
-	memset(iv, 0, 16);
-	AES_cbc_encrypt(kirk.key, kirk.key, 32, &aesKey, iv, AES_DECRYPT);
-
-	// check header hash, optional
-	// if you take correct kirk header, hash is always correct
-/*	AES_CMAC(kirk.ckey, datablob, 0x30, cmac);
-	if(memcmp(cmac, kirk.head_hash, 16)) {
-		free(datablob);
-		printf("header hash invalid\n");
-		return 1;
-	}
-*/
-
-	// encrypt input file
-	AES_set_encrypt_key(kirk.key, 128, &aesKey);
-	memset(iv, 0, 16);
-	AES_cbc_encrypt(filebuff, filebuff, datasize, &aesKey, iv, AES_ENCRYPT);
-
-	// make CMAC correct
-	generate_subkey(kirk.ckey, subk, subk + 16);
-	AES_set_encrypt_key(kirk.ckey, 128, &aesKey);
-	blocks = fullsize / 16;
-	memset(cmac, 0, 16);
-	for(i = 0; i < blocks - 1; i++) {
-		xor_128(cmac, &datablob[16 * i], cmac + 16);
-		AES_encrypt(cmac + 16, cmac, &aesKey);
-	}
-
-	AES_set_decrypt_key(kirk.ckey, 128, &aesKey);
-	AES_decrypt(kirk.data_hash, iv, &aesKey);
-	xor_128(cmac, iv, iv);
-	xor_128(iv, subk, &datablob[16 * (blocks-1)]);
-	// check it, optional
-	// it works, this is only if you want to change something
-/*	AES_CMAC(kirk.ckey, datablob, fullsize, cmac);
-	if(memcmp(cmac, kirk.data_hash, 16)) {
-		fclose(f);
-		free(datablob);
-		printf("data hash calculation error\n");
-		return 1;
-	}
-*/
-	f = fopen(argv[2], "wb");
-	if(!f) {
-		free(datablob);
-		printf("psp-prxsign: Failed to write signed PRX\n");
-		return 1;
-	}
-	//printf("saving ...\n");
-	// save ~PSP header
-	fwrite(psph, 1, 0x150, f);
-	// save encrypted file
-	fwrite(filebuff, 1, fullsize - 0x30 - kirk.dataoffset, f);
-	fclose(f);
-	free(datablob);
-	//printf("everything done\n");
-	return 0;
-}
diff --git a/src/sdl12/SRB2PSP/psp-prxsign/psp_header.h b/src/sdl12/SRB2PSP/psp-prxsign/psp_header.h
deleted file mode 100644
index 7faef832c9ed78732cdae4ffeff35d972622ec05..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2PSP/psp-prxsign/psp_header.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __psp_header__
-#define __psp_header__
-
-static unsigned int size_psp_header = 336;
-static unsigned char psp_header[] __attribute__((aligned(16))) = {
-	0x7e, 0x50, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x01, 0x01, 0x22, 0x74, 0x69, 0x66, 0x70, 0x73,
-	0x70, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x33, 0x55, 0x00, 0x50, 0x34, 0x55, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x40, 0x67, 0x3d, 0x00, 0x50, 0x55, 0x0a, 0x01, 0x10, 0x00, 0x40, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x4c, 0x6b, 0x3d, 0x00, 0xcc, 0xbb, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
-	0x90, 0x82, 0x4c, 0x48, 0xa3, 0x53, 0xb2, 0x1b, 0x13, 0x95, 0x2f, 0xf1, 0x0b, 0x90, 0x9c, 0x11,
-	0x61, 0x40, 0x20, 0x67, 0xf8, 0xdb, 0xfc, 0x95, 0x5c, 0xbe, 0x8c, 0x80, 0xf3, 0x92, 0x03, 0x01,
-	0xb0, 0xbe, 0xf5, 0xf8, 0xa1, 0xaf, 0xaf, 0xa8, 0x38, 0x26, 0x63, 0x09, 0x26, 0x0e, 0xb7, 0xd5,
-	0x00, 0x33, 0x55, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x5c, 0x3e, 0x03, 0x22, 0xe5, 0x7d, 0xb9, 0xd1, 0x13, 0x67, 0x97, 0xa3, 0x5b, 0xd8, 0x77, 0x1f,
-	0xf0, 0x05, 0xf3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x4a, 0xd7, 0x37,
-	0xc2, 0x8f, 0x15, 0x43, 0x33, 0x93, 0x4d, 0x5b, 0xc0, 0x6e, 0xe4, 0x00, 0xc6, 0x0a, 0x71, 0x11,
-	0x98, 0xb6, 0xc3, 0xb7, 0x59, 0x66, 0x21, 0xa8, 0x65, 0xf6, 0x53, 0xa9, 0x7a, 0x48, 0x17, 0xb6,
-};
-
-#endif
diff --git a/src/sdl12/SRB2Pandora/Makefile.cfg b/src/sdl12/SRB2Pandora/Makefile.cfg
deleted file mode 100644
index c7f0f8449c67995c3486fc2fc8639e76be859f61..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2Pandora/Makefile.cfg
+++ /dev/null
@@ -1,39 +0,0 @@
-# Quick Pandora target to make a compliant SRB2 PND file.
-
-PNDNAME=SRB2.pnd
-PNDDIR=$(BIN)/pnd
-ICON=sdl/SRB2Pandora/icon.png
-PXML=sdl/SRB2Pandora/PXML.xml
-
-SED=sed
-CAT=cat
-CP=cp
-XARGS=xargs
-FOR=for
-WGET=wget -P $(PNDDIR) -c -nc
-
-SHXARGS:=$(XARGS)
-SHSED:=$(SED)
-
-ifndef ECHO
-	CP:=@$(CP)
-	CAT:=@$(CAT)
-	SED:=@$(SED)
-	XARGS:=@$(XARGS)
-	FOR:=@(FOR)
-endif
-
-$(BIN)/$(PNDNAME): $(BIN)/$(EXENAME)
-	@echo Linking $(PNDNAME)...
-	$(MKDIR) $(PNDDIR)
-	$(CP) $(BIN)/$(EXENAME) $(PNDDIR)
-	$(CP) $(ICON) $(PNDDIR)
-	$(CP) $(PXML) $(PNDDIR)
-ifdef WITHDATA
-	$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) 's/\.srb/\.wad/' | $(SHXARGS) -n 1 basename); do \
-		$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
-	done
-endif
-	$(MKISOFS) -l -r -o $@ $(PNDDIR)
-	$(CAT) $(PXML) >> $@
-	$(REMOVE) -r $(PNDDIR)
diff --git a/src/sdl12/SRB2Pandora/PXML.xml b/src/sdl12/SRB2Pandora/PXML.xml
deleted file mode 100644
index 33a9587dbd7081cece3ad7804ab1db3d728685d4..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2Pandora/PXML.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<PXML xmlns="http://openpandora.org/namespaces/PXML">
-  <application id="srb2.pandora.v20" appdata="srb2">
-  <title lang="en_US">Sonic Robo Blast 2</title>
-  <title lang="ja_JA">ソニック・ロボ・ブラスト・2</title>
-  <description lang="en_US">A 3D Sonic fangame with a huge fanbase developing custom content, including characters, levels, and even large-scale modifications</description>
-  <version major="2" minor="0" release="6" build="1" />
-  <exec command="lsdlsrb2" background="true" standalone="true" x11="ignore"/>
-  <author name="Sonic Team Junior" website="http://www.srb2.org/" email="stjr@srb2.org"/>
-  <icon src="icon.png"/>
-  <categories>
-  <category name="Game">
-  <subcategory name="ActionGame" />
-  </category>
-  </categories>
-  </application>
-</PXML>
diff --git a/src/sdl12/SRB2Pandora/icon.png b/src/sdl12/SRB2Pandora/icon.png
deleted file mode 100644
index 63af73ac3a4e3046783312465aec2d985172f726..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2Pandora/icon.png and /dev/null differ
diff --git a/src/sdl12/SRB2WII/Makefile.cfg b/src/sdl12/SRB2WII/Makefile.cfg
deleted file mode 100644
index 1b186304218b85b9d9cd2c703d969f87863a7a3d..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2WII/Makefile.cfg
+++ /dev/null
@@ -1,124 +0,0 @@
-#
-# Makefile.cfg for SRB2Wii native using libogc
-#
-
-# Check if DEVKITPPC is set in the environment. If so, continue with compilation.
-.SUFFIXES:
-
-ifeq ($(strip $(DEVKITPPC)),)
-$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
-endif
-
-# Set compiler flags
-
-SRB2NAME?=srb2wii
-EXENAME?=$(SRB2NAME).elf
-DBGNAME?=$(SRB2NAME).elf.debug
-DOLNAME?=$(SRB2NAME).dol
-
-ICONPNG?=sdl/SRB2WII/icon.png
-METAXML?=sdl/SRB2WII/meta.xml
-
-APPDIR=apps/$(SRB2NAME)
-ZIPNAME=$(SRB2NAME).zip
-
-ELF2DOL=$(DEVKITPPC)/bin/elf2dol
-WIILOADEXE=$(DEVKITPPC)/bin/wiiload
-ZIP=zip -r -9
-WGET=wget -P srb2wii -c -nc
-SED=sed
-XARGS=xargs
-SHXARGS:=$(XARGS)
-SHSED:=$(SED)
-FOR=for
-
-ifndef ECHO
-	ELF2DOL:=@$(ELF2DOL)
-	WIILOADEXE:=@$(WIILOADEXE)
-	ZIP:=@$(ZIP)
-	SED:=@$(SED)
-	XARGS:=@$(XARGS)
-	FOR:=@$(FOR)
-endif
-
-# Disable same warning flags
-WFLAGS+=-Wno-shadow -Wno-char-subscripts -Wno-old-style-definition -Wno-unsuffixed-float-constants
-
-# newlib has no support for networking
-NONET=1
-
-# use pkgconfig for PKG
-PNG_PKGCONFIG=libpng
-
-# use absolute paths because changing PATH variable breaks distcc
-PREFIX := $(DEVKITPPC)/bin/$(PREFIX)
-
-# FIXME: DevkitPPC and ready-compiled SDL Wii require these things to be in a silly order
-# libogc/DevkitPro required stuff
-LIBOGC := $(DEVKITPRO)/libogc
-LIBOGC_INC := $(LIBOGC)/include
-LIBOGC_LIB := $(LIBOGC)/lib
-
-PORTLIBS := $(DEVKITPRO)/portlibs/ppc
-PORTLIBS_INC := $(PORTLIBS)/include
-PORTLIBS_LIB := $(PORTLIBS)/lib
-
-SDL_CPPFLAGS := -I$(LIBOGC_INC)/SDL
-SDL_LIB := $(DEVKITPRO)/libogc/lib/wii
-INCLUDE := -I$(LIBOGC_INC) $(SDL_CPPFLAGS) -I$(PORTLIBS_INC)
-
-PKG_CONFIG_PATH := $(PORTLIBS)/lib/pkgconfig
-PKG_BROKEN_SWTICH := --static --define-variable=DEVKITPRO=$(DEVKITPRO)
-PNG_PKGCONFIG := $(PKG_CONFIG_PATH)/libpng.pc $(PKG_BROKEN_SWTICH)
-ZLIB_PKGCONFIG := $(PKG_CONFIG_PATH)/zlib.pc $(PKG_BROKEN_SWTICH)
-
-ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags)
-ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs)
-
-ifdef RDB
-	LIBS+=-ldb
-	OPTS+=-DREMOTE_DEBUGGING=$(RDB)
-endif
-
-LIBS+= -L$(SDL_LIB)
-ifndef NOMIXER
-	LD=$(CXX)
-	LIBS+=-lSDL_mixer -lvorbisidec -lsmpeg
-endif
-LIBS+=-lSDL
-
-LIBS+=$(ZLIB_LDFLAGS) -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard -L$(LIBOGC_LIB)
-
-MACHDEP = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float
-OPTS+=-DWII -D_WII -DUNIXCOMMON
-CFLAGS+=-D__BIG_ENDIAN__ -g -O3 -fsigned-char $(MACHDEP) $(INCLUDE)
-CXXFLAGS+=$(CFLAGS)
-LDFLAGS+=-g $(MACHDEP) -Wl,-Map,$(notdir $@).map
-
-SDL_CONFIG=/bin/true
-SDL_CFLAGS=
-SDL_LDFLAGS=
-
-$(BIN)/$(DOLNAME): $(BIN)/$(EXENAME)
-	@echo Linking $(DOLNAME)...
-	$(ELF2DOL) $(BIN)/$(EXENAME) $(BIN)/$(DOLNAME)
-	@echo Creating /apps/$(SRB2NAME)...
-	$(MKDIR) $(APPDIR)
-	$(CP) $(BIN)/$(DOLNAME) $(APPDIR)/boot.dol
-	$(CP) $(ICONPNG) $(APPDIR)
-	$(CP) $(METAXML) $(APPDIR)
-ifdef WITHDATA
-	$(MKDIR) srb2wii
-	$(FOR) datafile in $(shell echo $(D_FILES) | $(SHSED) -e 's/\.srb/\.wad/' -e 's/music.dta//' | $(SHXARGS) -n 1 basename); do \
-		$(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$datafile; \
-	done
-	# downsampled music.dta specially for SRB2Wii
-	$(WGET) http://repos.srb2.org/srb2ports/music.dta
-	$(ZIP) $(BIN)/$(ZIPNAME) $(APPDIR) srb2wii
-else
-	$(ZIP) $(BIN)/$(ZIPNAME) $(APPDIR)
-endif
-	$(REMOVE) -r $(APPDIR)
-
-run: $(BIN)/$(EXENAME)
-	$(WIILOADEXE) $(BIN)/$(DBGNAME)
diff --git a/src/sdl12/SRB2WII/icon.png b/src/sdl12/SRB2WII/icon.png
deleted file mode 100644
index d22324bc6a9e51dac5c2e82cb2d78ca73d277c23..0000000000000000000000000000000000000000
Binary files a/src/sdl12/SRB2WII/icon.png and /dev/null differ
diff --git a/src/sdl12/SRB2WII/meta.xml b/src/sdl12/SRB2WII/meta.xml
deleted file mode 100644
index 843176d3af290f931139e3695b015533357642a4..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2WII/meta.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<app version="1">
-  <name>SRB2Wii</name>
-  <coder>Callum</coder>
-  <version>2.0.6</version>
-  <release_date>20101207</release_date>
-  <short_description>A 3D Sonic fangame</short_description>
-  <long_description>Sonic Robo Blast 2 is a 3D fangame by a small group called
-Sonic Team Junior, using the Doom engine as a base.
-The game has been worked on for almost 11 years so far, and
-it is still being very much developed today, with a huge
-fanbase developing custom content, including characters,
-levels, and even large-scale modifications that play out
-a brand new adventure.
-Based on the Doom II engine, SRB2's system requirements
-are very low, even the oldest computers can play it at a
-decent speed.</long_description>
-</app>
diff --git a/src/sdl12/SRB2XBOX/Makefile.cfg b/src/sdl12/SRB2XBOX/Makefile.cfg
deleted file mode 100644
index 56966d438c0b5b54f59d2498aaec57c2c038d53f..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2XBOX/Makefile.cfg
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Makefile.cfg for SRB2/XBOX
-#
-
-#
-#hmmm, the XBOX
-#
-
-	NOHW=1    #No working OpenGL right now
-	NOHS=1    #No HWSound right now
-	NOASM=1   #No Fast code
-	NONET=1   #No network code
-	NOMD5=1   #No Slow MD5
-	NOPNG=1   #No Screenshot
-	#SDLMAIN=1 #SDLMain!
-
-ifndef OPENXDK
-	OPENXDK=/usr/local/openxdk
-endif
-
-	CXBE=$(OPENXDK)/bin/cxbe
-
-ifdef ECHO
-	CXBE:=@$(CXBE)
-endif
-
-ifndef NOHW
-	OPTS+=-DMINI_GL_COMPATIBILITY
-endif
-
-	BUILTLM=-fno-builtin
-	CFLAGS+=-D_XBOX -std=gnu99 -ffreestanding $(BUILTLM) -fno-exceptions
-	CFLAGS+=-I$(OPENXDK)/i386-pc-xbox/include -I$(OPENXDK)/include
-	OPTS+=-nostdlib -mno-cygwin -march=i386
-	LDFLAGS+=-nostdlib -Wl,--file-alignment,0x20 -Wl,--section-alignment,0x20 -shared -Wl,--entry,_WinMainCRTStartup -Wl,--strip-all -L$(OPENXDK)/i386-pc-xbox/lib -L$(OPENXDK)/lib
-	LIBS=-lg -lc -lm
-	SDL_CFLAGS?=-I$(OPENXDK)/include/SDL
-	SDL_LDFLAGS?=-lSDL -lopenxdk -lhal -lc -lhal -lusb -lhal -lc -lxboxkrnl
-
-	i_system_o+=$(OBJDIR)/xboxhelp.o
-
-	# name of the exefile
-	EXENAME?=SRB2XBOX.EXE
-	BINNAME?=default.xbe
diff --git a/src/sdl12/SRB2XBOX/xboxhelp.c b/src/sdl12/SRB2XBOX/xboxhelp.c
deleted file mode 100644
index 9de01712f9b5f03a66d8bb1bf3f8a26fe4be0817..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2XBOX/xboxhelp.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2004 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// DESCRIPTION:
-//      stub and replacement "ANSI" C functions for use under OpenXDK
-//
-//-----------------------------------------------------------------------------
-
-#include "../../doomdef.h"
-#include "xboxhelp.h"
-#ifdef __GNUC__
-#include <unistd.h>
-#else
-#include <stdlib.h>
-#endif
-
-char *getcwd(char *_buf, size_t _size )
-{
-	(void)_buf;
-	(void)_size;
-	return _buf;
-}
-
-#ifdef _MSC_VER
-int mkdir(const char *path)
-{
-	(void)path;
-	return 0;
-}
-#elif 0 //__GNUC__?
-int mkdir(const char *path, mode_t _mode)
-{
-	(void)path;
-	(void)_mode;
-	return 0;
-}
-#endif
-
-int chdir (const char *__path )
-{
-	(void)__path;
-	return 0;
-}
-
-time_t time(time_t *T)
-{
-	long returntime = 0;
-	(void)T;
-/*
-	SYSTEMTIME st;
-	FILETIME stft;
-	INT64 ftli;
-	if (!T) return returntime;
-	GetSystemTime(&st);
-	SystemTimeToFileTime(&st,&stft);
-	CopyMemory(&ftli,&stft,sizeof (LARGE_INTEGER));
-	returntime = (long)ftli;
-	*T = returntime;
-*/
-	return returntime;
-}
-
-#ifdef _MSC_VER
-#include <RtcApi.h>
-void __cdecl _RTC_Initialize(void)
-{
-}
-char *getenv(const char *__env)
-{
-	__env = NULL;
-	return NULL;
-}
-
-int putenv(const char *__env)
-{
-	__env = NULL;
-	return 0;
-}
-#endif
diff --git a/src/sdl12/SRB2XBOX/xboxhelp.h b/src/sdl12/SRB2XBOX/xboxhelp.h
deleted file mode 100644
index 97ef0a3be16b53162f4c45d9a2e3e941fcefaee3..0000000000000000000000000000000000000000
--- a/src/sdl12/SRB2XBOX/xboxhelp.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#if defined (_MSC_VER)
-int access(const char *path, int amode);
-char *getcwd(char *_buf, size_t _size );
-int mkdir(const char *path);
-int chdir (const char *__path );
-#endif
diff --git a/src/sdl12/Srb2SDL-vc10.vcxproj b/src/sdl12/Srb2SDL-vc10.vcxproj
deleted file mode 100644
index 958cd7d02877eac200c0baee40ec625a093f60a5..0000000000000000000000000000000000000000
--- a/src/sdl12/Srb2SDL-vc10.vcxproj
+++ /dev/null
@@ -1,1464 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectName>Srb2SDL</ProjectName>
-    <ProjectGuid>{61BA7D3C-F77D-4D31-B718-1177FE482CF2}</ProjectGuid>
-    <RootNamespace>Srb2SDL</RootNamespace>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseOfMfc>false</UseOfMfc>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\bin\VC10\$(Platform)\$(Configuration)\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL12_PREFIX)\include;$(SDL12_MIXER_PREFIX)\include;$(FMOD3_PREFIX)api\inc;$(IncludePath)</IncludePath>
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SDL12_PREFIX)\lib;$(SDL12_MIXER_PREFIX)\lib;$(LibraryPath)</LibraryPath>
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SDL12_PREFIX)\lib\x64;$(SDL12_MIXER_PREFIX)\lib\x64;$(LibraryPath)</LibraryPath>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <PreBuildEvent>
-      <Message>Getting revision number from the SCM system</Message>
-      <Command>"$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).."</Command>
-    </PreBuildEvent>
-    <Midl>
-      <TypeLibraryName>.\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
-      <ProgramDataBaseFileName>$(IntDir)Srb2SDL.pdb</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-      <CompileAs>CompileAsC</CompileAs>
-      <DisableSpecificWarnings>4121;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)srb2sdl.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>$(OutDir)srb2sdl.pdb</ProgramDatabaseFile>
-      <SubSystem>Console</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>$(OutDir)Srb2sdl.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <PreBuildEvent>
-      <Message>Getting revision number from the SCM system</Message>
-      <Command>"$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).."</Command>
-    </PreBuildEvent>
-    <Midl>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
-      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
-      <ProgramDataBaseFileName>$(IntDir)Srb2SDL.pdb</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level4</WarningLevel>
-      <TreatWarningAsError>true</TreatWarningAsError>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsC</CompileAs>
-      <DisableSpecificWarnings>4121;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)srb2sdl.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>$(OutDir)srb2sdl.pdb</ProgramDatabaseFile>
-      <SubSystem>Console</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>$(OutDir)Srb2sdl.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <PreBuildEvent>
-      <Message>Getting revision number from the SCM system</Message>
-      <Command>"$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).."</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>Win32</TargetEnvironment>
-      <TypeLibraryName>.\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
-      <Optimization>Disabled</Optimization>
-      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <OmitFramePointers>true</OmitFramePointers>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
-      <ProgramDataBaseFileName>$(IntDir)Srb2SDL.pdb</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsC</CompileAs>
-      <DisableSpecificWarnings>4121;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)srb2sdl.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>$(OutDir)srb2sdl.pdb</ProgramDatabaseFile>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>$(OutDir)Srb2sdl.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <PreBuildEvent>
-      <Message>Getting revision number from the SCM system</Message>
-      <Command>"$(ProjectDir)..\..\comptime.bat" "$(ProjectDir).."</Command>
-    </PreBuildEvent>
-    <Midl>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MkTypLibCompatible>true</MkTypLibCompatible>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <TargetEnvironment>X64</TargetEnvironment>
-      <TypeLibraryName>.\..\..\bin\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb</TypeLibraryName>
-      <HeaderFileName>
-      </HeaderFileName>
-    </Midl>
-    <ClCompile>
-      <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
-      <Optimization>Disabled</Optimization>
-      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <OmitFramePointers>true</OmitFramePointers>
-      <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
-      <PrecompiledHeaderOutputFile>.\..\..\objs\VC10\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
-      <ProgramDataBaseFileName>$(IntDir)Srb2SDL.pdb</ProgramDataBaseFileName>
-      <BrowseInformation>true</BrowseInformation>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <CompileAs>CompileAsC</CompileAs>
-      <DisableSpecificWarnings>4121;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Link>
-      <AdditionalDependencies>SDL.lib;SDL_mixer.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <OutputFile>$(OutDir)srb2sdl.exe</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <ProgramDatabaseFile>$(OutDir)srb2sdl.pdb</ProgramDatabaseFile>
-      <SubSystem>Windows</SubSystem>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>$(OutDir)Srb2sdl.bsc</OutputFile>
-    </Bscmake>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\blua\lapi.c" />
-    <ClCompile Include="..\blua\lauxlib.c" />
-    <ClCompile Include="..\blua\lbaselib.c" />
-    <ClCompile Include="..\blua\lcode.c" />
-    <ClCompile Include="..\blua\ldebug.c" />
-    <ClCompile Include="..\blua\ldo.c" />
-    <ClCompile Include="..\blua\ldump.c" />
-    <ClCompile Include="..\blua\lfunc.c" />
-    <ClCompile Include="..\blua\lgc.c" />
-    <ClCompile Include="..\blua\linit.c" />
-    <ClCompile Include="..\blua\llex.c" />
-    <ClCompile Include="..\blua\lmem.c" />
-    <ClCompile Include="..\blua\lobject.c" />
-    <ClCompile Include="..\blua\lopcodes.c" />
-    <ClCompile Include="..\blua\lparser.c" />
-    <ClCompile Include="..\blua\lstate.c" />
-    <ClCompile Include="..\blua\lstring.c" />
-    <ClCompile Include="..\blua\lstrlib.c" />
-    <ClCompile Include="..\blua\ltable.c" />
-    <ClCompile Include="..\blua\ltablib.c" />
-    <ClCompile Include="..\blua\ltm.c" />
-    <ClCompile Include="..\blua\lundump.c" />
-    <ClCompile Include="..\blua\lvm.c" />
-    <ClCompile Include="..\blua\lzio.c" />
-    <ClCompile Include="..\b_bot.c" />
-    <ClCompile Include="..\m_cond.c" />
-    <ClCompile Include="dosstr.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="endtxt.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\filesrch.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="hwsym_sdl.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_cdmus.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_main.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_net.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_sound.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_system.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="i_video.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="IMG_xpm.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="ogl_sdl.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\r_opengl\r_opengl.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="SDL_main\SDL_win32_main.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\win32\win_dbg.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="filter\filters.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="filter\hq2x.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="filter\lq2x.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\comptime.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\d_clisrv.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\d_main.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\d_net.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\d_netcmd.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\d_netfil.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\dehacked.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\z_zone.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\f_finale.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\f_wipe.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\g_game.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\g_input.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\am_map.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\command.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\console.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hu_stuff.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\st_stuff.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\y_inter.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw3sound.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_bsp.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_cache.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_draw.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_light.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_main.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_md2.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\hardware\hw_trick.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\i_tcp.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\mserv.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_argv.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_bbox.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_cheat.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_fixed.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_menu.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_misc.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_queue.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\m_random.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\string.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\info.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_ceilng.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_enemy.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_fab.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_floor.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_inter.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_lights.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_map.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_maputl.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_mobj.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_polyobj.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_saveg.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_setup.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_sight.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_spec.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_telept.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_tick.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\p_user.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\tables.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_bsp.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_data.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_draw.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_draw16.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_draw8.c">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_main.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_plane.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_segs.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_sky.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_splats.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\r_things.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\screen.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\v_video.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\s_sound.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\sounds.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\lzf.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\md5.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-    <ClCompile Include="..\w_wad.c">
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\blua\lapi.h" />
-    <ClInclude Include="..\blua\lauxlib.h" />
-    <ClInclude Include="..\blua\lcode.h" />
-    <ClInclude Include="..\blua\ldebug.h" />
-    <ClInclude Include="..\blua\ldo.h" />
-    <ClInclude Include="..\blua\lfunc.h" />
-    <ClInclude Include="..\blua\lgc.h" />
-    <ClInclude Include="..\blua\llex.h" />
-    <ClInclude Include="..\blua\llimits.h" />
-    <ClInclude Include="..\blua\lmem.h" />
-    <ClInclude Include="..\blua\lobject.h" />
-    <ClInclude Include="..\blua\lopcodes.h" />
-    <ClInclude Include="..\blua\lparser.h" />
-    <ClInclude Include="..\blua\lstate.h" />
-    <ClInclude Include="..\blua\lstring.h" />
-    <ClInclude Include="..\blua\ltable.h" />
-    <ClInclude Include="..\blua\ltm.h" />
-    <ClInclude Include="..\blua\lua.h" />
-    <ClInclude Include="..\blua\luaconf.h" />
-    <ClInclude Include="..\blua\lualib.h" />
-    <ClInclude Include="..\blua\lundump.h" />
-    <ClInclude Include="..\blua\lvm.h" />
-    <ClInclude Include="..\blua\lzio.h" />
-    <ClInclude Include="..\b_bot.h" />
-    <ClInclude Include="..\m_cond.h" />
-    <ClInclude Include="endtxt.h" />
-    <ClInclude Include="..\filesrch.h" />
-    <ClInclude Include="hwsym_sdl.h" />
-    <ClInclude Include="ogl_sdl.h" />
-    <ClInclude Include="..\hardware\r_opengl\r_opengl.h" />
-    <ClInclude Include="sdlmain.h" />
-    <ClInclude Include="..\win32\win_dbg.h" />
-    <ClInclude Include="..\win32\win_main.h" />
-    <ClInclude Include="filter\filters.h" />
-    <ClInclude Include="filter\hq2x.h" />
-    <ClInclude Include="filter\interp.h" />
-    <ClInclude Include="filter\lq2x.h" />
-    <ClInclude Include="..\p5prof.h" />
-    <ClInclude Include="..\d_clisrv.h" />
-    <ClInclude Include="..\d_event.h" />
-    <ClInclude Include="..\d_main.h" />
-    <ClInclude Include="..\d_net.h" />
-    <ClInclude Include="..\d_netcmd.h" />
-    <ClInclude Include="..\d_netfil.h" />
-    <ClInclude Include="..\d_player.h" />
-    <ClInclude Include="..\d_think.h" />
-    <ClInclude Include="..\d_ticcmd.h" />
-    <ClInclude Include="..\dehacked.h" />
-    <ClInclude Include="..\doomdata.h" />
-    <ClInclude Include="..\doomdef.h" />
-    <ClInclude Include="..\doomstat.h" />
-    <ClInclude Include="..\doomtype.h" />
-    <ClInclude Include="..\z_zone.h" />
-    <ClInclude Include="..\f_finale.h" />
-    <ClInclude Include="..\g_game.h" />
-    <ClInclude Include="..\g_input.h" />
-    <ClInclude Include="..\g_state.h" />
-    <ClInclude Include="..\am_map.h" />
-    <ClInclude Include="..\command.h" />
-    <ClInclude Include="..\console.h" />
-    <ClInclude Include="..\hu_stuff.h" />
-    <ClInclude Include="..\st_stuff.h" />
-    <ClInclude Include="..\y_inter.h" />
-    <ClInclude Include="..\hardware\hw3dsdrv.h" />
-    <ClInclude Include="..\hardware\hw3sound.h" />
-    <ClInclude Include="..\hardware\hw_data.h" />
-    <ClInclude Include="..\hardware\hw_defs.h" />
-    <ClInclude Include="..\hardware\hw_dll.h" />
-    <ClInclude Include="..\hardware\hw_drv.h" />
-    <ClInclude Include="..\hardware\hw_glide.h" />
-    <ClInclude Include="..\hardware\hw_glob.h" />
-    <ClInclude Include="..\hardware\hw_light.h" />
-    <ClInclude Include="..\hardware\hw_main.h" />
-    <ClInclude Include="..\hardware\hw_md2.h" />
-    <ClInclude Include="..\hardware\hws_data.h" />
-    <ClInclude Include="..\byteptr.h" />
-    <ClInclude Include="..\i_joy.h" />
-    <ClInclude Include="..\i_net.h" />
-    <ClInclude Include="..\i_sound.h" />
-    <ClInclude Include="..\i_system.h" />
-    <ClInclude Include="..\i_tcp.h" />
-    <ClInclude Include="..\i_video.h" />
-    <ClInclude Include="..\keys.h" />
-    <ClInclude Include="..\mserv.h" />
-    <ClInclude Include="..\m_argv.h" />
-    <ClInclude Include="..\m_bbox.h" />
-    <ClInclude Include="..\m_cheat.h" />
-    <ClInclude Include="..\m_dllist.h" />
-    <ClInclude Include="..\m_fixed.h" />
-    <ClInclude Include="..\m_menu.h" />
-    <ClInclude Include="..\m_misc.h" />
-    <ClInclude Include="..\m_queue.h" />
-    <ClInclude Include="..\m_random.h" />
-    <ClInclude Include="..\m_swap.h" />
-    <ClInclude Include="..\info.h" />
-    <ClInclude Include="..\p_local.h" />
-    <ClInclude Include="..\p_maputl.h" />
-    <ClInclude Include="..\p_mobj.h" />
-    <ClInclude Include="..\p_polyobj.h" />
-    <ClInclude Include="..\p_pspr.h" />
-    <ClInclude Include="..\p_saveg.h" />
-    <ClInclude Include="..\p_setup.h" />
-    <ClInclude Include="..\p_spec.h" />
-    <ClInclude Include="..\p_tick.h" />
-    <ClInclude Include="..\tables.h" />
-    <ClInclude Include="..\r_bsp.h" />
-    <ClInclude Include="..\r_data.h" />
-    <ClInclude Include="..\r_defs.h" />
-    <ClInclude Include="..\r_draw.h" />
-    <ClInclude Include="..\r_local.h" />
-    <ClInclude Include="..\r_main.h" />
-    <ClInclude Include="..\r_plane.h" />
-    <ClInclude Include="..\r_segs.h" />
-    <ClInclude Include="..\r_sky.h" />
-    <ClInclude Include="..\r_splats.h" />
-    <ClInclude Include="..\r_state.h" />
-    <ClInclude Include="..\r_things.h" />
-    <ClInclude Include="..\screen.h" />
-    <ClInclude Include="..\v_video.h" />
-    <ClInclude Include="..\s_sound.h" />
-    <ClInclude Include="..\sounds.h" />
-    <ClInclude Include="..\lzf.h" />
-    <ClInclude Include="..\md5.h" />
-    <ClInclude Include="..\w_wad.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="SDL_icon.xpm" />
-    <CustomBuild Include="..\tmap.nas">
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-    </CustomBuild>
-    <CustomBuild Include="..\tmap_mmx.nas">
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-    </CustomBuild>
-    <CustomBuild Include="..\tmap_vc.nas">
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling %(Filename).nas with NASM...</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">nasm -g -o $(IntDir)%(Filename).obj -f win32 "%(FullPath)"</Command>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
-    </CustomBuild>
-    <None Include="..\..\doc\copying" />
-    <None Include="..\..\doc\faq.txt" />
-    <None Include="..\..\readme.txt" />
-    <None Include="..\..\doc\source.txt" />
-    <None Include="..\win32\Srb2win.ico" />
-  </ItemGroup>
-  <ItemGroup>
-    <ResourceCompile Include="..\win32\Srb2win.rc">
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-    </ResourceCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\libs\libpng-src\projects\visualc10\libpng.vcxproj">
-      <Project>{72b01aca-7a1a-4f7b-acef-2607299cf052}</Project>
-      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-    </ProjectReference>
-    <ProjectReference Include="..\..\libs\zlib\projects\visualc10\zlib.vcxproj">
-      <Project>{73a5729c-7323-41d4-ab48-8a03c9f81603}</Project>
-      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
diff --git a/src/sdl12/Srb2SDL-vc9.vcproj b/src/sdl12/Srb2SDL-vc9.vcproj
deleted file mode 100644
index d2a268f8d44f501b141ffa4de48eea5fed1e5f32..0000000000000000000000000000000000000000
--- a/src/sdl12/Srb2SDL-vc9.vcproj
+++ /dev/null
@@ -1,5845 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="Srb2SDL"
-	ProjectGUID="{61BA7D3C-F77D-4D31-B718-1177FE482CF2}"
-	RootNamespace="Srb2SDL"
-	TargetFrameworkVersion="0"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\..\..\bin\VC9\$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory=".\..\..\objs\VC9\$(PlatformName)\$(ConfigurationName)\SDL"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				Description="Getting revision number from the SCM system"
-				CommandLine="&quot;$(ProjectDir)..\..\comptime.bat&quot; &quot;$(ProjectDir)..&quot;"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\..\..\bin\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				AssemblerListingLocation="$(IntDir)\"
-				ProgramDataBaseFileName="$(IntDir)\Srb2SDL.pdb"
-				BrowseInformation="1"
-				WarningLevel="4"
-				WarnAsError="true"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-				CompileAs="1"
-				DisableSpecificWarnings="4121"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="SDL.lib SDL_mixer.lib ws2_32.lib"
-				OutputFile="$(OutDir)\srb2sdl.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)\srb2sdl.pdb"
-				SubSystem="1"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(OutDir)\Srb2sdl.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory=".\..\..\bin\VC9\$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory=".\..\..\objs\VC9\$(PlatformName)\$(ConfigurationName)\SDL"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				Description="Getting revision number from the SCM system"
-				CommandLine="&quot;$(ProjectDir)..\..\comptime.bat&quot; &quot;$(ProjectDir)..&quot;"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\..\bin\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				AssemblerListingLocation="$(IntDir)\"
-				ProgramDataBaseFileName="$(IntDir)\Srb2SDL.pdb"
-				BrowseInformation="1"
-				WarningLevel="4"
-				WarnAsError="true"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-				DisableSpecificWarnings="4121"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="SDL.lib SDL_mixer.lib ws2_32.lib"
-				OutputFile="$(OutDir)\srb2sdl.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)\srb2sdl.pdb"
-				SubSystem="1"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(OutDir)\Srb2sdl.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\..\..\bin\VC9\$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory=".\..\..\objs\VC9\$(PlatformName)\$(ConfigurationName)\SDL"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				Description="Getting revision number from the SCM system"
-				CommandLine="&quot;$(ProjectDir)..\..\comptime.bat&quot; &quot;$(ProjectDir)..&quot;"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\..\..\bin\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/MP"
-				Optimization="4"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				OmitFramePointers="true"
-				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
-				AssemblerListingLocation="$(IntDir)\"
-				ProgramDataBaseFileName="$(IntDir)\Srb2SDL.pdb"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-				DisableSpecificWarnings="4121"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="SDL.lib SDL_mixer.lib ws2_32.lib"
-				OutputFile="$(OutDir)\srb2sdl.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)\srb2sdl.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(OutDir)\Srb2sdl.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory=".\..\..\bin\VC9\$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory=".\..\..\objs\VC9\$(PlatformName)\$(ConfigurationName)\SDL"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-				Description="Getting revision number from the SCM system"
-				CommandLine="&quot;$(ProjectDir)..\..\comptime.bat&quot; &quot;$(ProjectDir)..&quot;"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\..\..\bin\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/MP"
-				Optimization="4"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				OmitFramePointers="true"
-				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
-				AssemblerListingLocation="$(IntDir)\"
-				ProgramDataBaseFileName="$(IntDir)\Srb2SDL.pdb"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-				CompileAs="1"
-				DisableSpecificWarnings="4121"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="SDL.lib SDL_mixer.lib ws2_32.lib"
-				OutputFile="$(OutDir)\srb2sdl.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)\srb2sdl.pdb"
-				SubSystem="2"
-				RandomizedBaseAddress="1"
-				DataExecutionPrevention="0"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(OutDir)\Srb2sdl.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="SDLapp"
-			>
-			<File
-				RelativePath="dosstr.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="endtxt.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="endtxt.h"
-				>
-			</File>
-			<File
-				RelativePath="..\filesrch.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\filesrch.h"
-				>
-			</File>
-			<File
-				RelativePath="hwsym_sdl.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="hwsym_sdl.h"
-				>
-			</File>
-			<File
-				RelativePath="i_cdmus.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="i_main.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="i_net.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="i_sound.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="i_system.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="i_video.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="IMG_xpm.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="ogl_sdl.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="ogl_sdl.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\r_opengl\r_opengl.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\r_opengl\r_opengl.h"
-				>
-			</File>
-			<File
-				RelativePath="SDL_icon.xpm"
-				>
-			</File>
-			<File
-				RelativePath="SDL_main\SDL_win32_main.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="sdlmain.h"
-				>
-			</File>
-			<File
-				RelativePath="..\win32\Srb2win.rc"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-						AdditionalIncludeDirectories="\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-						AdditionalIncludeDirectories="\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-						AdditionalIncludeDirectories="\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions=""
-						AdditionalIncludeDirectories="\Users\alam\svn\srb2mods\SRB2\branches\ALAM\src\win32"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\win32\win_dbg.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\win32\win_dbg.h"
-				>
-			</File>
-			<File
-				RelativePath="..\win32\win_main.h"
-				>
-			</File>
-			<Filter
-				Name="filter"
-				>
-				<File
-					RelativePath="filter\filters.c"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="filter\filters.h"
-					>
-				</File>
-				<File
-					RelativePath="filter\hq2x.c"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="filter\hq2x.h"
-					>
-				</File>
-				<File
-					RelativePath="filter\interp.h"
-					>
-				</File>
-				<File
-					RelativePath="filter\lq2x.c"
-					>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="filter\lq2x.h"
-					>
-				</File>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="A_Asm"
-			>
-			<File
-				RelativePath="..\p5prof.h"
-				>
-			</File>
-			<File
-				RelativePath="..\tmap.nas"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\tmap_mmx.nas"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\tmap_vc.nas"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Compiling $(InputName).nas with NASM..."
-						CommandLine="nasm -g -o $(IntDir)/$(InputName).obj -f win32 &quot;$(InputPath)&quot;&#x0D;&#x0A;"
-						Outputs="$(IntDir)/$(InputName).obj"
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="D_Doom"
-			>
-			<File
-				RelativePath="..\comptime.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_clisrv.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_clisrv.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_event.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_main.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_main.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_net.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_net.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_netcmd.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_netcmd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_netfil.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\d_netfil.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_player.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_think.h"
-				>
-			</File>
-			<File
-				RelativePath="..\d_ticcmd.h"
-				>
-			</File>
-			<File
-				RelativePath="..\dehacked.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\dehacked.h"
-				>
-			</File>
-			<File
-				RelativePath="..\doomdata.h"
-				>
-			</File>
-			<File
-				RelativePath="..\doomdef.h"
-				>
-			</File>
-			<File
-				RelativePath="..\doomstat.h"
-				>
-			</File>
-			<File
-				RelativePath="..\doomtype.h"
-				>
-			</File>
-			<File
-				RelativePath="..\z_zone.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\z_zone.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="F_Frame"
-			>
-			<File
-				RelativePath="..\f_finale.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\f_finale.h"
-				>
-			</File>
-			<File
-				RelativePath="..\f_wipe.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="G_Game"
-			>
-			<File
-				RelativePath="..\g_game.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\g_game.h"
-				>
-			</File>
-			<File
-				RelativePath="..\g_input.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\g_input.h"
-				>
-			</File>
-			<File
-				RelativePath="..\g_state.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="H_Hud"
-			>
-			<File
-				RelativePath="..\am_map.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\am_map.h"
-				>
-			</File>
-			<File
-				RelativePath="..\command.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\command.h"
-				>
-			</File>
-			<File
-				RelativePath="..\console.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\console.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hu_stuff.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hu_stuff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\st_stuff.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\st_stuff.h"
-				>
-			</File>
-			<File
-				RelativePath="..\y_inter.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\y_inter.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Hw_Hardware"
-			>
-			<File
-				RelativePath="..\hardware\hw3dsdrv.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw3sound.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw3sound.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_bsp.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_cache.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_data.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_defs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_dll.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_draw.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_drv.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_glide.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_glob.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_light.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_light.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_main.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_main.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_md2.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_md2.h"
-				>
-			</File>
-			<File
-				RelativePath="..\hardware\hw_trick.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\hardware\hws_data.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="I_Interface"
-			>
-			<File
-				RelativePath="..\byteptr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_addrinfo.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\i_addrinfo.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\i_joy.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_net.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_sound.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_system.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_tcp.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\i_tcp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\i_video.h"
-				>
-			</File>
-			<File
-				RelativePath="..\keys.h"
-				>
-			</File>
-			<File
-				RelativePath="..\mserv.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\mserv.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="M_Misc"
-			>
-			<File
-				RelativePath="..\m_argv.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_argv.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_bbox.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_bbox.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_cheat.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_cheat.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_cond.c"
-				>
-			</File>
-			<File
-				RelativePath="..\m_cond.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_dllist.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_fixed.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_fixed.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_menu.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_menu.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_misc.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_misc.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_queue.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_queue.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_random.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\m_random.h"
-				>
-			</File>
-			<File
-				RelativePath="..\m_swap.h"
-				>
-			</File>
-			<File
-				RelativePath="..\string.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="P_Play"
-			>
-			<File
-				RelativePath="..\info.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\info.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_ceilng.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_enemy.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_fab.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_floor.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_inter.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_lights.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_local.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_map.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_maputl.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_maputl.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_mobj.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_mobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_polyobj.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_polyobj.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_pspr.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_saveg.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_saveg.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_setup.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_setup.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_sight.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_spec.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_spec.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_telept.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_tick.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\p_tick.h"
-				>
-			</File>
-			<File
-				RelativePath="..\p_user.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\tables.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\tables.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="R_Rend"
-			>
-			<File
-				RelativePath="..\r_bsp.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_bsp.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_data.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_data.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_defs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_draw.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_draw.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_draw16.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_draw8.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					ExcludedFromBuild="true"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_local.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_main.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_main.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_plane.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_plane.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_segs.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_segs.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_sky.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_sky.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_splats.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_splats.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_state.h"
-				>
-			</File>
-			<File
-				RelativePath="..\r_things.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\r_things.h"
-				>
-			</File>
-			<File
-				RelativePath="..\screen.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\screen.h"
-				>
-			</File>
-			<File
-				RelativePath="..\v_video.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\v_video.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="S_Sounds"
-			>
-			<File
-				RelativePath="..\s_sound.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\s_sound.h"
-				>
-			</File>
-			<File
-				RelativePath="..\sounds.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\sounds.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="W_Wad"
-			>
-			<File
-				RelativePath="..\lzf.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\lzf.h"
-				>
-			</File>
-			<File
-				RelativePath="..\md5.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\md5.h"
-				>
-			</File>
-			<File
-				RelativePath="..\w_wad.c"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\w_wad.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Docs"
-			>
-			<File
-				RelativePath="..\..\doc\copying"
-				>
-			</File>
-			<File
-				RelativePath="..\..\doc\faq.txt"
-				>
-			</File>
-			<File
-				RelativePath="..\..\readme.txt"
-				>
-			</File>
-			<File
-				RelativePath="..\..\doc\source.txt"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="B_Bot"
-			>
-			<File
-				RelativePath="..\b_bot.c"
-				>
-			</File>
-			<File
-				RelativePath="..\b_bot.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="LUA"
-			>
-			<File
-				RelativePath="..\fastcmp.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\lua_baselib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_consolelib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_hook.h"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_hooklib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_infolib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_libs.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\lua_maplib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_mathlib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_mobjlib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_playerlib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_script.c"
-				>
-			</File>
-			<File
-				RelativePath="..\lua_script.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\lua_thinkerlib.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="BLUA"
-			>
-			<File
-				RelativePath="..\blua\lapi.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lapi.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lauxlib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lauxlib.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lbaselib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lcode.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lcode.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\ldebug.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ldebug.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\ldo.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ldo.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\ldump.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lfunc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lfunc.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lgc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lgc.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\linit.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\llex.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\llex.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\llimits.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lmem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lmem.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lobject.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lobject.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lopcodes.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lopcodes.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lparser.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lparser.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lstate.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lstate.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lstring.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lstring.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lstrlib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ltable.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ltable.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\ltablib.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ltm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\ltm.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lua.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\luaconf.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lualib.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lundump.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lundump.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lvm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lvm.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\blua\lzio.c"
-				>
-			</File>
-			<File
-				RelativePath="..\blua\lzio.h"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<File
-			RelativePath="..\win32\Srb2win.ico"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
diff --git a/src/sdl12/Srb2SDL.dsp b/src/sdl12/Srb2SDL.dsp
deleted file mode 100644
index 879113ca2f0d7c6f8a71e7e709303224046cb91f..0000000000000000000000000000000000000000
--- a/src/sdl12/Srb2SDL.dsp
+++ /dev/null
@@ -1,1057 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Srb2SDL" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Srb2SDL - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "Srb2SDL.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "Srb2SDL.mak" CFG="Srb2SDL - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "Srb2SDL - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Srb2SDL - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "Srb2SDL - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "..\..\bin\VC\Release\SDL"
-# PROP Intermediate_Dir "..\..\objs\VC\Release\SDL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-MTL=midl.exe
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "SDLMAIN" /D "NO_STDIO_REDIRECT" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-# SUBTRACT RSC /x
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /o"..\..\objs\SDL\Release\SRB2.bsc"
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /pdb:"C:\srb2demo2\srb2sdl.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdl.exe"
-# SUBTRACT LINK32 /profile /pdb:none /incremental:yes
-
-!ELSEIF  "$(CFG)" == "Srb2SDL - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "..\..\bin\VC\Debug\SDL"
-# PROP Intermediate_Dir "..\..\objs\VC\Debug\SDL"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-MTL=midl.exe
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /W4 /WX /Gm /GX /ZI /Od /Op /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "USE_WGL_SWAP" /D "DIRECTFULLSCREEN" /D "HAVE_SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-# SUBTRACT RSC /x
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /o"..\..\objs\SDL\Debug\SRB2.bsc"
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 SDL.lib SDL_mixer.lib user32.lib advapi32.lib ws2_32.lib /nologo /subsystem:console /pdb:"C:\srb2demo2\srb2sdldebug.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2sdldebug.exe" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF 
-
-# Begin Target
-
-# Name "Srb2SDL - Win32 Release"
-# Name "Srb2SDL - Win32 Debug"
-# Begin Group "SDLapp"
-
-# PROP Default_Filter ""
-# Begin Group "filter"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\filter\filters.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\filters.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\hq2x.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\hq2x.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\interp.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\lq2x.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\filter\lq2x.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\dosstr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\endtxt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\endtxt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\filesrch.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\filesrch.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\hwsym_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\hwsym_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_cdmus.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_net.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_sound.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_system.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\i_video.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\IMG_xpm.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\ogl_sdl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ogl_sdl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\r_opengl\r_opengl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\r_opengl\r_opengl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SDL_icon.xpm
-# End Source File
-# Begin Source File
-
-SOURCE=.\SDL_main\SDL_win32_main.c
-
-!IF  "$(CFG)" == "Srb2SDL - Win32 Release"
-
-!ELSEIF  "$(CFG)" == "Srb2SDL - Win32 Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\sdlmain.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\Srb2win.rc
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\win_dbg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\win_dbg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\win32\win_main.h
-# End Source File
-# End Group
-# Begin Group "A_Asm"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\p5prof.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\tmap.nas
-
-!IF  "$(CFG)" == "Srb2SDL - Win32 Release"
-
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-IntDir=.\..\..\objs\VC\Release\SDL
-InputPath=..\tmap.nas
-InputName=tmap
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "Srb2SDL - Win32 Debug"
-
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-IntDir=.\..\..\objs\VC\Debug\SDL
-InputPath=..\tmap.nas
-InputName=tmap
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\tmap_mmx.nas
-
-!IF  "$(CFG)" == "Srb2SDL - Win32 Release"
-
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-IntDir=.\..\..\objs\VC\Release\SDL
-InputPath=..\tmap_mmx.nas
-InputName=tmap_mmx
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "Srb2SDL - Win32 Debug"
-
-# PROP Ignore_Default_Tool 1
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-
-IntDir=.\..\..\objs\VC\Debug\SDL
-InputPath=..\tmap_mmx.nas
-InputName=tmap_mmx
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\tmap_vc.nas
-
-!IF  "$(CFG)" == "Srb2SDL - Win32 Release"
-
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-IntDir=.\..\..\objs\VC\Release\SDL
-InputPath=..\tmap_vc.nas
-InputName=tmap_vc
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "Srb2SDL - Win32 Debug"
-
-# Begin Custom Build - Compiling $(InputName).nas with NASM...
-IntDir=.\..\..\objs\VC\Debug\SDL
-InputPath=..\tmap_vc.nas
-InputName=tmap_vc
-
-"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath)
-
-# End Custom Build
-
-!ENDIF 
-
-# End Source File
-# End Group
-# Begin Group "D_Doom"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\comptime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_clisrv.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_clisrv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_event.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_net.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_net.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_netcmd.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_netcmd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_netfil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_netfil.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_player.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_think.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\d_ticcmd.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\dehacked.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\dehacked.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\doomdata.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\doomdef.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\doomstat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\doomtype.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\z_zone.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\z_zone.h
-# End Source File
-# End Group
-# Begin Group "F_Frame"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\f_finale.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\f_finale.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\f_wipe.c
-# End Source File
-# End Group
-# Begin Group "G_Game"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\g_game.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\g_game.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\g_input.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\g_input.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\g_state.h
-# End Source File
-# End Group
-# Begin Group "H_Hud"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\am_map.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\am_map.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\command.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\command.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\console.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\console.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hu_stuff.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hu_stuff.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\st_stuff.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\st_stuff.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\y_inter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\y_inter.h
-# End Source File
-# End Group
-# Begin Group "Hw_Hardware"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\hardware\hw3dsdrv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw3sound.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw3sound.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_bsp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_cache.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_data.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_dll.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_draw.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_drv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_glide.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_glob.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_light.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_light.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_md2.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_md2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hw_trick.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\hardware\hws_data.h
-# End Source File
-# End Group
-# Begin Group "I_Interface"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\byteptr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_joy.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_net.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_sound.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_system.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_tcp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_tcp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\i_video.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\keys.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\mserv.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\mserv.h
-# End Source File
-# End Group
-# Begin Group "M_Misc"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\m_argv.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_argv.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_bbox.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_bbox.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_cheat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_cheat.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_dllist.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_fixed.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_fixed.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_menu.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_menu.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_misc.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_misc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_queue.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_queue.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_random.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_random.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\m_swap.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\string.c
-# End Source File
-# End Group
-# Begin Group "P_Play"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\info.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_ceilng.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_enemy.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_fab.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_floor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_inter.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_lights.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_local.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_map.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_maputl.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_maputl.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_mobj.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_mobj.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_polyobj.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_polyobj.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_pspr.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_saveg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_saveg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_setup.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_setup.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_sight.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_spec.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_spec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_telept.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_tick.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_tick.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\p_user.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\tables.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\tables.h
-# End Source File
-# End Group
-# Begin Group "R_Rend"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\r_bsp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_bsp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_data.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_draw.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_draw.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_draw16.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_draw8.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_local.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_main.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_main.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_plane.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_plane.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_segs.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_segs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_sky.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_sky.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_splats.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_splats.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_state.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_things.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\r_things.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\screen.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\screen.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\v_video.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\v_video.h
-# End Source File
-# End Group
-# Begin Group "S_Sounds"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\s_sound.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\s_sound.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\sounds.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\sounds.h
-# End Source File
-# End Group
-# Begin Group "W_Wad"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\lzf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lzf.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\w_wad.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\w_wad.h
-# End Source File
-# End Group
-# Begin Group "Docs"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\doc\copying
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\doc\faq.txt
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\readme.txt
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\doc\source.txt
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\win32\Srb2win.ico
-# End Source File
-# End Target
-# End Project
diff --git a/src/sdl12/Srb2SDL.dsw b/src/sdl12/Srb2SDL.dsw
deleted file mode 100644
index 4f8f7bdce3b9de5b568c5371e4dd07d0d71f7131..0000000000000000000000000000000000000000
--- a/src/sdl12/Srb2SDL.dsw
+++ /dev/null
@@ -1,74 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Srb2SDL"=.\Srb2SDL.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name libpng
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name zlib
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libpng"="..\..\libs\libpng-src\projects\visualc6\libpng.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name zlib
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "s_openal"=..\hardware\s_openal\s_openal.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/src/sdl12/Srb2SDL.ico b/src/sdl12/Srb2SDL.ico
deleted file mode 100644
index 700276fd4b9ac2810a6981eb054921f3708c702b..0000000000000000000000000000000000000000
Binary files a/src/sdl12/Srb2SDL.ico and /dev/null differ
diff --git a/src/sdl12/dosstr.c b/src/sdl12/dosstr.c
deleted file mode 100644
index f9bbee9b4cf39e9ba7392e0a63e37c027d6d6f5e..0000000000000000000000000000000000000000
--- a/src/sdl12/dosstr.c
+++ /dev/null
@@ -1,38 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// This file is in the public domain.
-// (Re)written by Graue in 2006.
-//
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief String uppercasing/lowercasing functions for non-DOS non-Win32
-///        systems
-
-#include "../doomtype.h"
-
-#ifndef HAVE_DOSSTR_FUNCS
-
-#include <ctype.h>
-
-int strupr(char *n)
-{
-	while (*n != '\0')
-	{
-		*n = toupper(*n);
-		n++;
-	}
-	return 1;
-}
-
-int strlwr(char *n)
-{
-	while (*n != '\0')
-	{
-		*n = tolower(*n);
-		n++;
-	}
-	return 1;
-}
-
-#endif
diff --git a/src/sdl12/endtxt.c b/src/sdl12/endtxt.c
deleted file mode 100644
index 1d7756b4de067a25e044adf1a47e3c8955510212..0000000000000000000000000000000000000000
--- a/src/sdl12/endtxt.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Function to write the SRB2 end message text
- *
- * Copyright (C) 1998 by Udo Munk <udo@umserver.umnet.de>
- *
- * This code is provided AS IS and there are no guarantees, none.
- * Feel free to share and modify.
- */
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Support to show ENDOOM text
-///
-/// Loads the lump ENDOOM, set up the console to print
-/// out the colors and text
-
-#include <stdio.h>
-#include <stdlib.h>
-
-// need this 19990118 by Kin
-#include "../doomdef.h"
-#include "../w_wad.h"
-#include "../z_zone.h"
-#include "endtxt.h"
-/**	\brief	The ShowEndTxt function
-
-
-  Prints out the ENDOOM the way DOOM.EXE/DOOM2.EXE did for Win32 or Linux/GNU
-
-	\return	void
-
-
-*/
-
-void ShowEndTxt(void)
-{
-#if !(defined (_WIN32_WCE) || defined (_XBOX) || defined (_arch_dreamcast))
-	INT32 i;
-	UINT16 j, att = 0;
-	INT32 nlflag = 1;
-#ifdef _WIN32
-	HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-	DWORD mode, bytesWritten;
-	CONSOLE_SCREEN_BUFFER_INFO backupcon;
-	COORD resizewin = {80,-1};
-	CHAR let = 0;
-#endif
-	UINT16 *ptext;
-	void *data;
-	lumpnum_t endoomnum = W_GetNumForName("ENDOOM");
-	//char *col;
-
-	/* if the xterm has more then 80 columns we need to add nl's */
-	/* doesn't work, COLUMNS is not in the environment at this time ???
-	col = I_getenv("COLUMNS");
-	if (col) {
-		if (atoi(col) > 80)
-			nlflag++;
-	}
-	*/
-
-	/* get the lump with the text */
-	data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE);
-
-#ifdef _WIN32
-	if (co == INVALID_HANDLE_VALUE || GetFileType(co) != FILE_TYPE_CHAR || !GetConsoleMode(co, &mode)) // test if it a good handle
-	{
-		Z_Free(data);
-		return;
-	}
-
-	backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case
-	GetConsoleScreenBufferInfo(co, &backupcon); //Store old state
-	resizewin.Y = backupcon.dwSize.Y;
-	if (backupcon.dwSize.X < resizewin.X)
-		SetConsoleScreenBufferSize(co, resizewin);
-
-	for (i=1; i<=80*25; i++) // print 80x25 text and deal with the attributes too
-	{
-		j = (UINT16)(*ptext >> 8); // attribute first
-		let = (char)(*ptext & 0xff); // text second
-		if (j != att) // attribute changed?
-		{
-			att = j; // save current attribute
-			SetConsoleTextAttribute(co, j); //set fg and bg color for buffer
-		}
-
-		WriteConsoleA(co, &let,  1, &bytesWritten, NULL); // now the text
-
-		if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl?
-		{
-			att = backupcon.wAttributes;
-			SetConsoleTextAttribute(co, att); // all attributes off
-			WriteConsoleA(co, "\n",  1, &bytesWritten, NULL); // newline to console
-		}
-		ptext++;
-	}
-	SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off
-#else
-	/* print 80x25 text and deal with the attributes too */
-	for (i=1; i<=80*25; i++) {
-		/* attribute first */
-		/* attribute changed? */
-		if ((j = *ptext >> 8) != att) {
-			/* save current attribute */
-			att = j;
-			/* set new attribute, forground color first */
-			printf("\033[");
-			switch (j & 0x0f) {
-			case 0:		/* black */
-				printf("30");
-				break;
-			case 1:		/* blue */
-				printf("34");
-				break;
-			case 2:		/* green */
-				printf("32");
-				break;
-			case 3:		/* cyan */
-				printf("36");
-				break;
-			case 4:		/* red */
-				printf("31");
-				break;
-			case 5:		/* magenta */
-				printf("35");
-				break;
-			case 6:		/* brown */
-				printf("33");
-				break;
-			case 7:		/* bright grey */
-				printf("37");
-				break;
-			case 8:		/* dark grey */
-				printf("1;30");
-				break;
-			case 9:		/* bright blue */
-				printf("1;34");
-				break;
-			case 10:	/* bright green */
-				printf("1;32");
-				break;
-			case 11:	/* bright cyan */
-				printf("1;36");
-				break;
-			case 12:	/* bright red */
-				printf("1;31");
-				break;
-			case 13:	/* bright magenta */
-				printf("1;35");
-				break;
-			case 14:	/* yellow */
-				printf("1;33");
-				break;
-			case 15:	/* white */
-				printf("1;37");
-				break;
-			}
-			printf("m");
-			/* now background color */
-			printf("\033[");
-			switch ((j >> 4) & 0x0f) {
-			case 0:		/* black */
-				printf("40");
-				break;
-			case 1:		/* blue */
-				printf("44");
-				break;
-			case 2:		/* green */
-				printf("42");
-				break;
-			case 3:		/* cyan */
-				printf("46");
-				break;
-			case 4:		/* red */
-				printf("41");
-				break;
-			case 5:		/* magenta */
-				printf("45");
-				break;
-			case 6:		/* brown */
-				printf("43");
-				break;
-			case 7:		/* bright grey */
-				printf("47");
-				break;
-			case 8:		/* dark grey */
-				printf("1;40");
-				break;
-			case 9:		/* bright blue */
-				printf("1;44");
-				break;
-			case 10:	/* bright green */
-				printf("1;42");
-				break;
-			case 11:	/* bright cyan */
-				printf("1;46");
-				break;
-			case 12:	/* bright red */
-				printf("1;41");
-				break;
-			case 13:	/* bright magenta */
-				printf("1;45");
-				break;
-			case 14:	/* yellow */
-				printf("1;43");
-				break;
-			case 15:	/* white */
-				printf("1;47");
-				break;
-			}
-			printf("m");
-		}
-
-		/* now the text */
-		printf("%c",*ptext++ & 0xff);
-
-		/* do we need a nl? */
-		if (nlflag)
-		{
-			if (!(i % 80))
-			{
-				printf("\033[0m");
-				att = 0;
-				printf("\n");
-			}
-		}
-	}
-	/* all attributes off */
-	printf("\033[0m");
-#endif
-	if (nlflag)
-		printf("\n");
-
-	Z_Free(data);
-#endif
-}
diff --git a/src/sdl12/endtxt.h b/src/sdl12/endtxt.h
deleted file mode 100644
index 41f8e51adc2c1f12af6df13ba7f949176d63e4c0..0000000000000000000000000000000000000000
--- a/src/sdl12/endtxt.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Support to show ENDOOM text
-
-#ifndef __ENDTXT__
-#define __ENDTXT__
-
-void ShowEndTxt (void);
-
-#endif
diff --git a/src/sdl12/filter/filters.c b/src/sdl12/filter/filters.c
deleted file mode 100644
index 1b2346e8e8554a9c7b094caf6531b3e3f950a12b..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/filters.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-#include <math.h>
-#include "filters.h"
-
-//Alam_GBC: C file based on sms_sdl's filter.c
-
-/* 2X SAI Filter */
-static Uint32 colorMask = 0xF7DEF7DE;
-static Uint32 lowPixelMask = 0x08210821;
-static Uint32 qcolorMask = 0xE79CE79C;
-static Uint32 qlowpixelMask = 0x18631863;
-static Uint32 redblueMask = 0xF81F;
-static Uint32 greenMask = 0x7E0;
-
-SDL_Surface *filter_2x(SDL_Surface *src, SDL_Rect *srcclp, filter_2 filter)
-{
-	return filter_2xe(src,srcclp,filter,0,0,0);
-}
-
-SDL_Surface *filter_2xe(SDL_Surface *src, SDL_Rect *srcclp, filter_2 filter,Uint8 R, Uint8 G, Uint8 B)
-{
-	SDL_Surface *srcfilter = NULL;
-	SDL_Rect dstclp = {0,3,0,0};
-	SDL_Surface *dstfilter = NULL;
-	Uint32 Fillcolor = 0;
-	if(!src || !filter) return NULL; // Need src and filter
-	if(srcclp) // size by clp
-	{
-		dstclp.w = srcclp->w; //clp's width
-		dstclp.h = srcclp->h; //clp's height
-	}
-	else // size by src
-	{
-		dstclp.w = (Uint16)src->w; //src's width
-		dstclp.h = (Uint16)src->h; //src's height
-	}
-	if(filter == hq2x32 || filter == lq2x32) // src 0888 surface
-		srcfilter = SDL_CreateRGBSurface(SDL_SWSURFACE,dstclp.w,dstclp.h+6,32,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-	else // src 565 surface
-		srcfilter = SDL_CreateRGBSurface(SDL_SWSURFACE,dstclp.w,dstclp.h+6,16,0x0000F800,0x000007E0,0x0000001F,0x00);
-	if(!srcfilter) return NULL; //No Memory?
-	Fillcolor = SDL_MapRGB(srcfilter->format,R,G,B); //Choose color
-	SDL_FillRect(srcfilter,NULL,Fillcolor); //fill it
-	if(filter == filter_hq2x || filter == hq2x32 || filter == lq2x32) // dst 0888 surface
-		dstfilter = SDL_CreateRGBSurface(SDL_SWSURFACE,dstclp.w*2,dstclp.h*2,32,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-	else // dst 565 surface
-		dstfilter = SDL_CreateRGBSurface(SDL_SWSURFACE,dstclp.w*2,dstclp.h*2,16,0x0000F800,0x000007E0,0x0000001F,0x00);
-	if(!dstfilter || SDL_BlitSurface(src,srcclp,srcfilter,&dstclp) == -1) // No dstfilter or Blit failed
-	{
-		SDL_FreeSurface(srcfilter); // Free memory
-		return NULL; //No Memory?
-	}
-	else // have dstfilter ready and srcfilter done
-	{
-		SDL_FillRect(dstfilter,NULL,Fillcolor); //fill it too
-		filter(FILTER(srcfilter,dstfilter)); //filtering
-		SDL_FreeSurface(srcfilter); //almost
-	}
-	return dstfilter; //done
-}
-
-
-int filter_init_2xsai(SDL_PixelFormat *BitFormat)
-{
-	if (!BitFormat || BitFormat->BytesPerPixel != 2 ||BitFormat->Amask != 0x0)
-	{
-		return 0;
-	}
-	else if (BitFormat->Rmask == 0xF800 && BitFormat->Gmask == 0x7E0
-		&& BitFormat->Bmask == 0x1F && BitFormat->BitsPerPixel == 16) //565
-	{
-		colorMask = 0xF7DEF7DE;
-		lowPixelMask = 0x08210821;
-		qcolorMask = 0xE79CE79C;
-		qlowpixelMask = 0x18631863;
-		redblueMask = 0xF81F;
-		greenMask = 0x7E0;
-	}
-	else if (BitFormat->Rmask == 0x7C00 && BitFormat->Gmask == 0x3E0
-		&& BitFormat->Bmask == 0x1F && BitFormat->BitsPerPixel == 15) //555
-	{
-		colorMask = 0x7BDE7BDE;
-		lowPixelMask = 0x04210421;
-		qcolorMask = 0x739C739C;
-		qlowpixelMask = 0x0C630C63;
-		redblueMask = 0x7C1F;
-		greenMask = 0x3E0;
-	}
-	else
-	{
-		return 0;
-	}
-#ifdef MMX
-	if(BitFormat->Gmask == 0x7E0) Init_2xSaIMMX(565);
-	else Init_2xSaIMMX(555);
-#endif
-	return 1;
-}
-
-
-FUNCINLINE static ATTRINLINE int GetResult1 (Uint32 A, Uint32 B, Uint32 C, Uint32 D, Uint32 E)
-{
-  int x = 0;
-  int y = 0;
-  int r = 0;
-  (void)E;
-
-  if (A == C)
-	x += 1;
-  else if (B == C)
-	  y += 1;
-  if (A == D)
-    x += 1;
-  else if (B == D)
-	  y += 1;
-  if (x <= 1)
-	  r += 1;
-  if (y <= 1)
-	  r -= 1;
-  return r;
-}
-
-FUNCINLINE static ATTRINLINE int GetResult2 (Uint32 A, Uint32 B, Uint32 C, Uint32 D, Uint32 E)
-{
-  int x = 0;
-  int y = 0;
-  int r = 0;
-  (void)E;
-
-  if (A == C)
-	  x += 1;
-  else if (B == C)
-    y += 1;
-  if (A == D)
-    x += 1;
-  else if (B == D)
-    y += 1;
-  if (x <= 1)
-    r -= 1;
-  if (y <= 1)
-    r += 1;
-  return r;
-}
-
-FUNCINLINE static ATTRINLINE int GetResult (Uint32 A, Uint32 B, Uint32 C, Uint32 D)
-{
-  int x = 0;
-  int y = 0;
-  int r = 0;
-
-  if (A == C)
-    x += 1;
-  else if (B == C)
-    y += 1;
-  if (A == D)
-    x += 1;
-  else if (B == D)
-    y += 1;
-  if (x <= 1)
-    r += 1;
-  if (y <= 1)
-    r -= 1;
-  return r;
-}
-
-FUNCINLINE static ATTRINLINE Uint32 INTERPOLATE (Uint32 A, Uint32 B)
-{
-  if (A != B)
-  {
-    return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) +
-		(A & B & lowPixelMask));
-  }
-  else
-	  return A;
-}
-
-FUNCINLINE static ATTRINLINE Uint32 Q_INTERPOLATE (Uint32 A, Uint32 B, Uint32 C, Uint32 D)
-{
-  register Uint32 x = ((A & qcolorMask) >> 2) +
-	((B & qcolorMask) >> 2) +
-	((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
-  register Uint32 y = (A & qlowpixelMask) +
-	(B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask);
-  y = (y >> 2) & qlowpixelMask;
-  return x + y;
-}
-
-#define BLUE_MASK565 0x001F001F
-#define RED_MASK565 0xF800F800
-#define GREEN_MASK565 0x07E007E0
-
-#define BLUE_MASK555 0x001F001F
-#define RED_MASK555 0x7C007C00
-#define GREEN_MASK555 0x03E003E0
-
-void filter_super2xsai(Uint8 *srcPtr, Uint32 srcPitch,
-		  Uint8 *dstPtr, Uint32 dstPitch,
-		 int width, int height)
-{
-	Uint16 *bP;
-    Uint8  *dP;
-    Uint32 inc_bP;
-    Uint32 Nextline = srcPitch >> 1;
-
-	Uint32 finish;
-	inc_bP = 1;
-
-	for (; height; height--)
-	{
-	    bP = (Uint16 *) srcPtr;
-	    dP = (Uint8 *) dstPtr;
-
-	    for (finish = width; finish; finish -= inc_bP)
-	    {
-		Uint32 color4, color5, color6;
-		Uint32 color1, color2, color3;
-		Uint32 colorA0, colorA1, colorA2, colorA3,
-		    colorB0, colorB1, colorB2, colorB3, colorS1, colorS2;
-		Uint32 product1a, product1b, product2a, product2b;
-
-//---------------------------------------    B1 B2
-//                                         4  5  6 S2
-//                                         1  2  3 S1
-//                                           A1 A2
-
-		colorB0 = *(bP - Nextline - 1);
-		colorB1 = *(bP - Nextline);
-		colorB2 = *(bP - Nextline + 1);
-		colorB3 = *(bP - Nextline + 2);
-
-		color4 = *(bP - 1);
-		color5 = *(bP);
-		color6 = *(bP + 1);
-		colorS2 = *(bP + 2);
-
-		color1 = *(bP + Nextline - 1);
-		color2 = *(bP + Nextline);
-		color3 = *(bP + Nextline + 1);
-		colorS1 = *(bP + Nextline + 2);
-
-		colorA0 = *(bP + Nextline + Nextline - 1);
-		colorA1 = *(bP + Nextline + Nextline);
-		colorA2 = *(bP + Nextline + Nextline + 1);
-		colorA3 = *(bP + Nextline + Nextline + 2);
-
-//--------------------------------------
-		if (color2 == color6 && color5 != color3)
-		{
-		    product2b = product1b = color2;
-		}
-		else if (color5 == color3 && color2 != color6)
-		{
-		    product2b = product1b = color5;
-		}
-		else if (color5 == color3 && color2 == color6)
-		{
-		    register int r = 0;
-
-		    r += GetResult (color6, color5, color1, colorA1);
-		    r += GetResult (color6, color5, color4, colorB1);
-		    r += GetResult (color6, color5, colorA2, colorS1);
-		    r += GetResult (color6, color5, colorB2, colorS2);
-
-		    if (r > 0)
-			product2b = product1b = color6;
-		    else if (r < 0)
-			product2b = product1b = color5;
-		    else
-		    {
-			product2b = product1b = INTERPOLATE (color5, color6);
-		    }
-		}
-		else
-		{
-		    if (color6 == color3 && color3 == colorA1
-			    && color2 != colorA2 && color3 != colorA0)
-			product2b =
-			    Q_INTERPOLATE (color3, color3, color3, color2);
-		    else if (color5 == color2 && color2 == colorA2
-			     && colorA1 != color3 && color2 != colorA3)
-			product2b =
-			    Q_INTERPOLATE (color2, color2, color2, color3);
-		    else
-			product2b = INTERPOLATE (color2, color3);
-
-		    if (color6 == color3 && color6 == colorB1
-			    && color5 != colorB2 && color6 != colorB0)
-			product1b =
-			    Q_INTERPOLATE (color6, color6, color6, color5);
-		    else if (color5 == color2 && color5 == colorB2
-			     && colorB1 != color6 && color5 != colorB3)
-			product1b =
-			    Q_INTERPOLATE (color6, color5, color5, color5);
-		    else
-			product1b = INTERPOLATE (color5, color6);
-		}
-
-		if (color5 == color3 && color2 != color6 && color4 == color5
-			&& color5 != colorA2)
-		    product2a = INTERPOLATE (color2, color5);
-		else
-		    if (color5 == color1 && color6 == color5
-			&& color4 != color2 && color5 != colorA0)
-		    product2a = INTERPOLATE (color2, color5);
-		else
-		    product2a = color2;
-
-		if (color2 == color6 && color5 != color3 && color1 == color2
-			&& color2 != colorB2)
-		    product1a = INTERPOLATE (color2, color5);
-		else
-		    if (color4 == color2 && color3 == color2
-			&& color1 != color5 && color2 != colorB0)
-		    product1a = INTERPOLATE (color2, color5);
-		else
-		    product1a = color5;
-
-#ifdef LSB_FIRST
-		product1a = product1a | (product1b << 16);
-		product2a = product2a | (product2b << 16);
-#else
-    product1a = (product1a << 16) | product1b;
-    product2a = (product2a << 16) | product2b;
-#endif
-		*((Uint32 *) dP) = product1a;
-		*((Uint32 *) (dP + dstPitch)) = product2a;
-
-		bP += inc_bP;
-		dP += sizeof (Uint32);
-	    }			// end of for ( finish= width etc..)
-
-	    srcPtr   += srcPitch;
-	    dstPtr   += dstPitch * 2;
-	}			// endof: for (; height; height--)
-}
-
-void filter_supereagle(Uint8 *srcPtr, Uint32 srcPitch, /* Uint8 *deltaPtr,  */
-		 Uint8 *dstPtr, Uint32 dstPitch, int width, int height)
-{
-    Uint8  *dP;
-    Uint16 *bP;
-    Uint32 inc_bP;
-
-
-
-	Uint32 finish;
-	Uint32 Nextline = srcPitch >> 1;
-
-	inc_bP = 1;
-
-	for (; height ; height--)
-	{
-	    bP = (Uint16 *) srcPtr;
-	    dP = dstPtr;
-	    for (finish = width; finish; finish -= inc_bP)
-	    {
-		Uint32 color4, color5, color6;
-		Uint32 color1, color2, color3;
-		Uint32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2;
-		Uint32 product1a, product1b, product2a, product2b;
-		colorB1 = *(bP - Nextline);
-		colorB2 = *(bP - Nextline + 1);
-
-		color4 = *(bP - 1);
-		color5 = *(bP);
-		color6 = *(bP + 1);
-		colorS2 = *(bP + 2);
-
-		color1 = *(bP + Nextline - 1);
-		color2 = *(bP + Nextline);
-		color3 = *(bP + Nextline + 1);
-		colorS1 = *(bP + Nextline + 2);
-
-		colorA1 = *(bP + Nextline + Nextline);
-		colorA2 = *(bP + Nextline + Nextline + 1);
-		// --------------------------------------
-		if (color2 == color6 && color5 != color3)
-		{
-		    product1b = product2a = color2;
-		    if ((color1 == color2) || (color6 == colorB2))
-		    {
-			product1a = INTERPOLATE (color2, color5);
-			product1a = INTERPOLATE (color2, product1a);
-//                       product1a = color2;
-		    }
-		    else
-		    {
-			product1a = INTERPOLATE (color5, color6);
-		    }
-
-		    if ((color6 == colorS2) || (color2 == colorA1))
-		    {
-			product2b = INTERPOLATE (color2, color3);
-			product2b = INTERPOLATE (color2, product2b);
-//                       product2b = color2;
-		    }
-		    else
-		    {
-			product2b = INTERPOLATE (color2, color3);
-		    }
-		}
-		else if (color5 == color3 && color2 != color6)
-		{
-		    product2b = product1a = color5;
-
-		    if ((colorB1 == color5) || (color3 == colorS1))
-		    {
-			product1b = INTERPOLATE (color5, color6);
-			product1b = INTERPOLATE (color5, product1b);
-//                       product1b = color5;
-		    }
-		    else
-		    {
-			product1b = INTERPOLATE (color5, color6);
-		    }
-
-		    if ((color3 == colorA2) || (color4 == color5))
-		    {
-			product2a = INTERPOLATE (color5, color2);
-			product2a = INTERPOLATE (color5, product2a);
-//                       product2a = color5;
-		    }
-		    else
-		    {
-			product2a = INTERPOLATE (color2, color3);
-		    }
-
-		}
-		else if (color5 == color3 && color2 == color6)
-		{
-		    register int r = 0;
-
-		    r += GetResult (color6, color5, color1, colorA1);
-		    r += GetResult (color6, color5, color4, colorB1);
-		    r += GetResult (color6, color5, colorA2, colorS1);
-		    r += GetResult (color6, color5, colorB2, colorS2);
-
-		    if (r > 0)
-		    {
-			product1b = product2a = color2;
-			product1a = product2b = INTERPOLATE (color5, color6);
-		    }
-		    else if (r < 0)
-		    {
-			product2b = product1a = color5;
-			product1b = product2a = INTERPOLATE (color5, color6);
-		    }
-		    else
-		    {
-			product2b = product1a = color5;
-			product1b = product2a = color2;
-		    }
-		}
-		else
-		{
-		    product2b = product1a = INTERPOLATE (color2, color6);
-		    product2b =
-			Q_INTERPOLATE (color3, color3, color3, product2b);
-		    product1a =
-			Q_INTERPOLATE (color5, color5, color5, product1a);
-
-		    product2a = product1b = INTERPOLATE (color5, color3);
-		    product2a =
-			Q_INTERPOLATE (color2, color2, color2, product2a);
-		    product1b =
-			Q_INTERPOLATE (color6, color6, color6, product1b);
-
-//                    product1a = color5;
-//                    product1b = color6;
-//                    product2a = color2;
-//                    product2b = color3;
-		}
-#ifdef LSB_FIRST
-		product1a = product1a | (product1b << 16);
-		product2a = product2a | (product2b << 16);
-#else
-    product1a = (product1a << 16) | product1b;
-    product2a = (product2a << 16) | product2b;
-#endif
-
-		*((Uint32 *) dP) = product1a;
-		*((Uint32 *) (dP + dstPitch)) = product2a;
-
-		bP += inc_bP;
-		dP += sizeof (Uint32);
-	    }			// end of for ( finish= width etc..)
-	    srcPtr += srcPitch;
-	    dstPtr += dstPitch * 2;
-	}			// endof: for (height; height; height--)
-}
-
-void filter_2xsai (Uint8 *srcPtr, Uint32 srcPitch,
-	     Uint8 *dstPtr, Uint32 dstPitch, int width, int height)
-{
-    Uint8  *dP;
-    Uint16 *bP;
-    Uint32 inc_bP;
-
-
-	Uint32 finish;
-	Uint32 Nextline = srcPitch >> 1;
-	inc_bP = 1;
-
-
-	for (; height; height--)
-	{
-	    bP = (Uint16 *) srcPtr;
-	    dP = dstPtr;
-
-	    for (finish = width; finish; finish -= inc_bP)
-	    {
-
-		register Uint32 colorA, colorB;
-		Uint32 colorC, colorD,
-		    colorE, colorF, colorG, colorH,
-		    colorI, colorJ, colorK, colorL,
-
-		    colorM, colorN, colorO, colorP;
-		Uint32 product, product1, product2;
-
-//---------------------------------------
-// Map of the pixels:                    I|E F|J
-//                                       G|A B|K
-//                                       H|C D|L
-//                                       M|N O|P
-		colorI = *(bP - Nextline - 1);
-		colorE = *(bP - Nextline);
-		colorF = *(bP - Nextline + 1);
-		colorJ = *(bP - Nextline + 2);
-
-		colorG = *(bP - 1);
-		colorA = *(bP);
-		colorB = *(bP + 1);
-		colorK = *(bP + 2);
-
-		colorH = *(bP + Nextline - 1);
-		colorC = *(bP + Nextline);
-		colorD = *(bP + Nextline + 1);
-		colorL = *(bP + Nextline + 2);
-
-		colorM = *(bP + Nextline + Nextline - 1);
-		colorN = *(bP + Nextline + Nextline);
-		colorO = *(bP + Nextline + Nextline + 1);
-		colorP = *(bP + Nextline + Nextline + 2);
-
-		if ((colorA == colorD) && (colorB != colorC))
-		{
-		    if (((colorA == colorE) && (colorB == colorL)) ||
-			    ((colorA == colorC) && (colorA == colorF)
-			     && (colorB != colorE) && (colorB == colorJ)))
-		    {
-			product = colorA;
-		    }
-		    else
-		    {
-			product = INTERPOLATE (colorA, colorB);
-		    }
-
-		    if (((colorA == colorG) && (colorC == colorO)) ||
-			    ((colorA == colorB) && (colorA == colorH)
-			     && (colorG != colorC) && (colorC == colorM)))
-		    {
-			product1 = colorA;
-		    }
-		    else
-		    {
-			product1 = INTERPOLATE (colorA, colorC);
-		    }
-		    product2 = colorA;
-		}
-		else if ((colorB == colorC) && (colorA != colorD))
-		{
-		    if (((colorB == colorF) && (colorA == colorH)) ||
-			    ((colorB == colorE) && (colorB == colorD)
-			     && (colorA != colorF) && (colorA == colorI)))
-		    {
-			product = colorB;
-		    }
-		    else
-		    {
-			product = INTERPOLATE (colorA, colorB);
-		    }
-
-		    if (((colorC == colorH) && (colorA == colorF)) ||
-			    ((colorC == colorG) && (colorC == colorD)
-			     && (colorA != colorH) && (colorA == colorI)))
-		    {
-			product1 = colorC;
-		    }
-		    else
-		    {
-			product1 = INTERPOLATE (colorA, colorC);
-		    }
-		    product2 = colorB;
-		}
-		else if ((colorA == colorD) && (colorB == colorC))
-		{
-		    if (colorA == colorB)
-		    {
-			product = colorA;
-			product1 = colorA;
-			product2 = colorA;
-		    }
-		    else
-		    {
-			register int r = 0;
-
-			product1 = INTERPOLATE (colorA, colorC);
-			product = INTERPOLATE (colorA, colorB);
-
-			r +=
-			    GetResult1 (colorA, colorB, colorG, colorE,
-					colorI);
-			r +=
-			    GetResult2 (colorB, colorA, colorK, colorF,
-					colorJ);
-			r +=
-			    GetResult2 (colorB, colorA, colorH, colorN,
-					colorM);
-			r +=
-			    GetResult1 (colorA, colorB, colorL, colorO,
-					colorP);
-
-			if (r > 0)
-			    product2 = colorA;
-			else if (r < 0)
-			    product2 = colorB;
-			else
-			{
-			    product2 =
-				Q_INTERPOLATE (colorA, colorB, colorC,
-					       colorD);
-			}
-		    }
-		}
-		else
-		{
-		    product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD);
-
-		    if ((colorA == colorC) && (colorA == colorF)
-			    && (colorB != colorE) && (colorB == colorJ))
-		    {
-			product = colorA;
-		    }
-		    else
-			if ((colorB == colorE) && (colorB == colorD)
-			    && (colorA != colorF) && (colorA == colorI))
-		    {
-			product = colorB;
-		    }
-		    else
-		    {
-			product = INTERPOLATE (colorA, colorB);
-		    }
-
-		    if ((colorA == colorB) && (colorA == colorH)
-			    && (colorG != colorC) && (colorC == colorM))
-		    {
-			product1 = colorA;
-		    }
-		    else
-			if ((colorC == colorG) && (colorC == colorD)
-			    && (colorA != colorH) && (colorA == colorI))
-		    {
-			product1 = colorC;
-		    }
-		    else
-		    {
-			product1 = INTERPOLATE (colorA, colorC);
-		    }
-		}
-#ifdef LSB_FIRST
-		product = colorA | (product << 16);
-		product1 = product1 | (product2 << 16);
-#else
-    product = (colorA << 16) | product;
-    product1 = (product1 << 16) | product2;
-#endif
-		*((Uint32 *) dP) = product;
-		*((Uint32 *) (dP + dstPitch)) = product1;
-
-		bP += inc_bP;
-		dP += sizeof (Uint32);
-	    }			// end of for ( finish= width etc..)
-
-	    srcPtr += srcPitch;
-	    dstPtr += dstPitch * 2;
-	}			// endof: for (height; height; height--)
-}
-
-#if 0
-static inline Uint32 Bilinear(Uint32 A, Uint32 B, Uint32 x)
-{
-    unsigned long areaA, areaB;
-    unsigned long result;
-
-    if (A == B)
-	return A;
-
-    areaB = (x >> 11) & 0x1f;	// reduce 16 bit fraction to 5 bits
-    areaA = 0x20 - areaB;
-
-    A = (A & redblueMask) | ((A & greenMask) << 16);
-    B = (B & redblueMask) | ((B & greenMask) << 16);
-
-    result = ((areaA * A) + (areaB * B)) >> 5;
-
-    return (result & redblueMask) | ((result >> 16) & greenMask);
-
-}
-
-static inline Uint32 Bilinear4 (Uint32 A, Uint32 B, Uint32 C, Uint32 D, Uint32 x,
-			 Uint32 y)
-{
-    unsigned long areaA, areaB, areaC, areaD;
-    unsigned long result, xy;
-
-    x = (x >> 11) & 0x1f;
-    y = (y >> 11) & 0x1f;
-    xy = (x * y) >> 5;
-
-    A = (A & redblueMask) | ((A & greenMask) << 16);
-    B = (B & redblueMask) | ((B & greenMask) << 16);
-    C = (C & redblueMask) | ((C & greenMask) << 16);
-    D = (D & redblueMask) | ((D & greenMask) << 16);
-
-    areaA = 0x20 + xy - x - y;
-    areaB = x - xy;
-    areaC = y - xy;
-    areaD = xy;
-
-    result = ((areaA * A) + (areaB * B) + (areaC * C) + (areaD * D)) >> 5;
-
-    return (result & redblueMask) | ((result >> 16) & greenMask);
-}
-#endif
-
-
-void filter_advmame2x(Uint8 *srcPtr, Uint32 srcPitch,
-                      Uint8 *dstPtr, Uint32 dstPitch,
-							        int width, int height)
-{
-	unsigned int nextlineSrc = srcPitch / sizeof(short);
-	short *p = (short *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(short);
-	short *q = (short *)dstPtr;
-
-	while(height--) {
-    int i = 0, j = 0;
-		for(i = 0; i < width; ++i, j += 2) {
-			short B = *(p + i - nextlineSrc);
-			short D = *(p + i - 1);
-			short E = *(p + i);
-			short F = *(p + i + 1);
-			short H = *(p + i + nextlineSrc);
-
-			*(q + j) = (short)(D == B && B != F && D != H ? D : E);
-			*(q + j + 1) = (short)(B == F && B != D && F != H ? F : E);
-			*(q + j + nextlineDst) = (short)(D == H && D != B && H != F ? D : E);
-			*(q + j + nextlineDst + 1) = (short)(H == F && D != H && B != F ? F : E);
-		}
-		p += nextlineSrc;
-		q += nextlineDst << 1;
-	}
-}
-
-
-void filter_tv2x(Uint8 *srcPtr, Uint32 srcPitch,
-                 Uint8 *dstPtr, Uint32 dstPitch,
-                 int width, int height)
-{
-  unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-	Uint16 *p = (Uint16 *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-	Uint16 *q = (Uint16 *)dstPtr;
-
-	while(height--) {
-    int i = 0, j = 0;
-		for(; i < width; ++i, j += 2) {
-			Uint16 p1 = *(p + i);
-      Uint32 pi;
-
-			pi = (((p1 & redblueMask) * 7) >> 3) & redblueMask;
-			pi |= (((p1 & greenMask) * 7) >> 3) & greenMask;
-
-      *(q + j) = (Uint16)p1;
-      *(q + j + 1) = (Uint16)p1;
-			*(q + j + nextlineDst) = (Uint16)pi;
-			*(q + j + nextlineDst + 1) = (Uint16)pi;
-	  }
-	  p += nextlineSrc;
-	  q += nextlineDst << 1;
-	}
-}
-
-void filter_normal2x(Uint8 *srcPtr, Uint32 srcPitch,
-               Uint8 *dstPtr, Uint32 dstPitch,
-               int width, int height)
-{
-	unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-	Uint16 *p = (Uint16 *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-	Uint16 *q = (Uint16 *)dstPtr;
-
-	while(height--) {
-	int i = 0, j = 0;
-		for(; i < width; ++i, j += 2) {
-			Uint16 color = *(p + i);
-
-			*(q + j) = color;
-			*(q + j + 1) = color;
-			*(q + j + nextlineDst) = color;
-			*(q + j + nextlineDst + 1) = color;
-		}
-		p += nextlineSrc;
-		q += nextlineDst << 1;
-	}
-}
-
-void filter_scan50(Uint8 *srcPtr, Uint32 srcPitch,
-                   Uint8 *dstPtr, Uint32 dstPitch,
-                   int width, int height)
-{
-
-  unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-	Uint16 *p = (Uint16 *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-	Uint16 *q = (Uint16 *)dstPtr;
-
-  while(height--) {
-    int i = 0, j = 0;
-    for(; i < width; ++i, j += 2) {
-	    Uint16 p1 = *(p + i);
-	    Uint16 p2 = *(p + i + nextlineSrc);
-	    // 0111 1011 1110 1111 == 0x7BEF
-      Uint16 pm = (Uint16)(((p1 + p2) >> 2) & 0x7BEF);
-
-      *(q + j) = p1;
-      *(q + j + 1) = p1;
-			*(q + j + nextlineDst) = pm;
-			*(q + j + nextlineDst + 1) = pm;
-
-    }
-		p += nextlineSrc;
-		q += nextlineDst << 1;
-  }
-}
-
-
-void filter_scan100(Uint8 *srcPtr, Uint32 srcPitch,
-                    Uint8 *dstPtr, Uint32 dstPitch,
-                    int width, int height)
-{
-  unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-	Uint16 *p = (Uint16 *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-	Uint16 *q = (Uint16 *)dstPtr;
-
-  while(height--) {
-    int i = 0, j = 0;
-    for(; i < width; ++i, j += 2) {
-      *(q + j) = *(q + j + 1) = *(p + i);
-    }
-		p += nextlineSrc;
-		q += nextlineDst << 1;
-  }
-}
-
-
-FUNCINLINE static ATTRINLINE Uint16 DOT_16(Uint16 c, int j, int i) {
-  static const Uint16 dotmatrix[16] = {
-	  0x01E0, 0x0007, 0x3800, 0x0000,
-	  0x39E7, 0x0000, 0x39E7, 0x0000,
-	  0x3800, 0x0000, 0x01E0, 0x0007,
-	  0x39E7, 0x0000, 0x39E7, 0x0000
-  };
-  return (Uint16)(c - ((c >> 2) & *(dotmatrix + ((j & 3) << 2) + (i & 3))));
-}
-
-void filter_dotmatrix(Uint8 *srcPtr, Uint32 srcPitch,
-                      Uint8 *dstPtr, Uint32 dstPitch,
-					            int width, int height)
-{
-	unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-	Uint16 *p = (Uint16 *)srcPtr;
-
-	unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-	Uint16 *q = (Uint16 *)dstPtr;
-
-  int i, ii, j, jj;
-	for(j = 0, jj = 0; j < height; ++j, jj += 2) {
-		for(i = 0, ii = 0; i < width; ++i, ii += 2) {
-			Uint16 c = *(p + i);
-			*(q + ii) = DOT_16(c, jj, ii);
-			*(q + ii + 1) = DOT_16(c, jj, ii + 1);
-			*(q + ii + nextlineDst) = DOT_16(c, jj + 1, ii);
-			*(q + ii + nextlineDst + 1) = DOT_16(c, jj + 1, ii + 1);
-		}
-		p += nextlineSrc;
-		q += nextlineDst << 1;
-	}
-}
-
-
-void filter_bilinear(Uint8 *srcPtr, Uint32 srcPitch,
-                     Uint8 *dstPtr, Uint32 dstPitch,
-                     int width, int height)
-{
-  unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-  Uint16 *p = (Uint16 *)srcPtr;
-  unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-  Uint16 *q = (Uint16 *)dstPtr;
-
-  while(height--) {
-    int i, ii;
-    for(i = 0, ii = 0; i < width; ++i, ii += 2) {
-      Uint16 A = *(p + i);
-      Uint16 B = *(p + i + 1);
-      Uint16 C = *(p + i + nextlineSrc);
-      Uint16 D = *(p + i + nextlineSrc + 1);
-      *(q + ii) = A;
-      *(q + ii + 1) = (Uint16)INTERPOLATE(A, B);
-      *(q + ii + nextlineDst) = (Uint16)INTERPOLATE(A, C);
-      *(q + ii + nextlineDst + 1) = (Uint16)Q_INTERPOLATE(A, B, C, D);
-    }
-    p += nextlineSrc;
-    q += nextlineDst << 1;
-  }
-}
-
-
-// NEED_OPTIMIZE
-static void MULT(Uint16 c, float* r, float* g, float* b, float alpha) {
-  *r += alpha * ((c & RED_MASK565  ) >> 11);
-  *g += alpha * ((c & GREEN_MASK565) >>  5);
-  *b += alpha * ((c & BLUE_MASK565 ) >>  0);
-}
-
-static Uint16 MAKE_RGB565(float r, float g, float b) {
-  return (Uint16)
-  (((((Uint8)r) << 11) & RED_MASK565  ) |
-  ((((Uint8)g) <<  5) & GREEN_MASK565) |
-  ((((Uint8)b) <<  0) & BLUE_MASK565 ));
-}
-
-FUNCINLINE static ATTRINLINE float CUBIC_WEIGHT(float x) {
-  // P(x) = { x, x>0 | 0, x<=0 }
-  // P(x + 2) ^ 3 - 4 * P(x + 1) ^ 3 + 6 * P(x) ^ 3 - 4 * P(x - 1) ^ 3
-  double r = 0.;
-  if(x + 2 > 0) r +=      pow(x + 2, 3);
-  if(x + 1 > 0) r += -4 * pow(x + 1, 3);
-  if(x     > 0) r +=  6 * pow(x    , 3);
-  if(x - 1 > 0) r += -4 * pow(x - 1, 3);
-  return (float)r / 6;
-}
-
-void filter_bicubic(Uint8 *srcPtr, Uint32 srcPitch,
-                    Uint8 *dstPtr, Uint32 dstPitch,
-                    int width, int height)
-{
-  unsigned int nextlineSrc = srcPitch / sizeof(Uint16);
-  Uint16 *p = (Uint16 *)srcPtr;
-  unsigned int nextlineDst = dstPitch / sizeof(Uint16);
-  Uint16 *q = (Uint16 *)dstPtr;
-  int dx = width << 1, dy = height << 1;
-  float fsx = (float)width / dx;
-	float fsy = (float)height / dy;
-	float v = 0.0f;
-	int j = 0;
-	for(; j < dy; ++j) {
-	  float u = 0.0f;
-	  int iv = (int)v;
-    float decy = v - iv;
-    int i = 0;
-	  for(; i < dx; ++i) {
-		  int iu = (int)u;
-		  float decx = u - iu;
-      float r, g, b;
-      int m;
-      r = g = b = 0.;
-      for(m = -1; m <= 2; ++m) {
-        float r1 = CUBIC_WEIGHT(decy - m);
-        int n;
-        for(n = -1; n <= 2; ++n) {
-          float r2 = CUBIC_WEIGHT(n - decx);
-          Uint16* pIn = p + (iu  + n) + (iv + m) * nextlineSrc;
-          MULT(*pIn, &r, &g, &b, r1 * r2);
-        }
-      }
-      *(q + i) = MAKE_RGB565(r, g, b);
-      u += fsx;
-	  }
-    q += nextlineDst;
-	  v += fsy;
-  }
-}
diff --git a/src/sdl12/filter/filters.h b/src/sdl12/filter/filters.h
deleted file mode 100644
index c4a84b4c9a0f38aab30b686f8d16d87fc1b22add..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/filters.h
+++ /dev/null
@@ -1,212 +0,0 @@
-#ifndef __FILTERS_H__
-#define __FILTERS_H__
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4514 4214 4244)
-#endif
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-typedef enum {
-  FILTER_2XSAI  = 0,
-  FILTER_SUPER2XSAI,
-  FILTER_SUPEREAGLE,
-  FILTER_ADVMAME2X ,
-  FILTER_TV2X      ,
-  FILTER_NORMAL2X  ,
-  FILTER_BILINEAR  ,
-  FILTER_DOTMATRIX ,
-  FILTER_NUM       ,
-} t_filter;
-
-typedef void (*filter_2)(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-SDL_Surface *filter_2x(SDL_Surface *src, SDL_Rect *srcclp, filter_2 filter);
-SDL_Surface *filter_2xe(SDL_Surface *src, SDL_Rect *srcclp, filter_2 filter,Uint8 R, Uint8 G, Uint8 B);
-//Alam_GBC: Header file based on sms_sdl's filter.h
-//Note: need 3 lines at the bottom and top?
-
-//int filter_init_2xsai(SDL_PixelFormat *BitFormat);
-#define FILTER(src,dst) (Uint8 *)(src->pixels)+src->pitch*3, (Uint32)src->pitch, (Uint8 *)dst->pixels, (Uint32)dst->pitch, src->w, src->h-6
-#define SDLFILTER(src,dst) (Uint8 *)src->pixels, (Uint32)src->pitch, (Uint8 *)dst->pixels, (Uint32)dst->pitch, src->w, src->h
-int filter_init_2xsai(SDL_PixelFormat *BitFormat); //unless?
-void filter_scan50(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_scan100(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch,  int width, int height);
-
-void filter_2xsai(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_super2xsai(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_supereagle(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_advmame2x(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_tv2x(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_normal2x(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_bilinear(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_dotmatrix(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void filter_bicubic(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void lq2x16(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void hq2x16(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-
-void filter_hq2x(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void lq2x32(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-void hq2x32(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height);
-
-#ifdef FILTERS
-typedef struct filter_s {  filter_2 filter; int bpp; } filter_t;
-#define NUMFILTERS 13
-static filter_t filtermode[NUMFILTERS+1] = {
-	{NULL             ,  0}, //None
-	{filter_normal2x  , 16}, //2xNormal
-	{filter_advmame2x , 16}, //AdvMAME2x
-	{filter_tv2x      , 16}, //TV2x
-	{filter_bilinear  , 16}, //Bilinear
-	{filter_dotmatrix , 16}, //DotMatrix
-	{lq2x16           , 16}, //16LQ2x
-	{hq2x16           , 16}, //16HQ2x
-	{lq2x32           , 32}, //32LQ2x
-	{hq2x32           , 32}, //32HQ2x
-// {filter_bicubic   , 16}, //Slow Bicubic
-	// BAD
-	{filter_2xsai     , 16}, //2xSAI
-	{filter_super2xsai, 16}, //Super2xSAI
-	{filter_supereagle, 16}, //SuperEagle
-};
-CV_PossibleValue_t CV_Filters[] = {{ 0, "None"}, { 1, "2xNormal"},
- { 2, "AdvMAME2x"}, { 3, "TV2x"},       { 4, "Bilinear"}  , { 5, "DotMatrix"},
- { 6, "16LQ2x"},    { 7, "16HQ2x"},     { 8, "32LQ2x"}    , { 9, "32HQ2x"},
- {10, "2xSAI"},     {11, "Super2xSAI"}, {12, "SuperEagle"}, {0, NULL},};
-static void Filterchange(void);
-consvar_t cv_filter = {"filter", "None", CV_CALL|CV_NOINIT, CV_Filters,Filterchange,0,NULL,NULL,0,0,NULL};
-static filter_2 blitfilter = NULL;
-static SDL_Surface *preSurface = NULL;
-static SDL_Surface *f2xSurface = NULL;
-
-static void Filterchange(void)
-{
-	if(blitfilter) // only filtering?
-	{
-		int i=0;
-		for(;i < NUMFILTERS; i++)//find old filter
-		{
-			if(filtermode[i].filter == blitfilter) //Found it
-				break; //Stop
-		}
-		if(i < NUMFILTERS && filtermode[i].bpp == filtermode[cv_filter.value].bpp) //Easy to swap?
-			blitfilter = filtermode[cv_filter.value].filter; // Swap with new filter
-	}
-}
-
-FUNCINLINE static ATTRINLINE void FilterBlit(SDL_Surface *froSurface)
-{
-	if(froSurface && blitfilter && preSurface && f2xSurface)
-	{
-		SDL_Rect dstclp = {0,3,0,0};
-		int lockedpre = 0, lockedf2x = 0, blitpre = 0;
-		blitpre = SDL_BlitSurface(froSurface,NULL,preSurface,&dstclp);
-		if(SDL_MUSTLOCK(preSurface)) lockedpre = SDL_LockSurface(preSurface);
-		if(SDL_MUSTLOCK(f2xSurface)) lockedf2x = SDL_LockSurface(f2xSurface);
-		if(lockedpre == 0 && preSurface->pixels && lockedf2x == 0 && f2xSurface->pixels && blitpre == 0)
-		{
-			blitfilter(FILTER(preSurface,f2xSurface));
-			if(SDL_MUSTLOCK(preSurface)) SDL_UnlockSurface(preSurface);
-			if(SDL_MUSTLOCK(f2xSurface)) SDL_UnlockSurface(f2xSurface);
-		}
-	}
-	else
-	{
-		blitfilter = NULL;
-		if(preSurface) SDL_FreeSurface(preSurface);
-		preSurface = NULL;
-		if(f2xSurface) SDL_FreeSurface(f2xSurface);
-		f2xSurface = NULL;
-	}
-}
-
-FUNCINLINE static ATTRINLINE int Setupf2x(int width, int height, int bpp)
-{
-	blitfilter = NULL;
-	if(preSurface) SDL_FreeSurface(preSurface);
-	preSurface = NULL;
-	if(f2xSurface) SDL_FreeSurface(f2xSurface);
-	f2xSurface = NULL;
-	if( !(width%2) && !(height%2) && width >= BASEVIDWIDTH*2 && height >=  BASEVIDHEIGHT*2 && cv_filter.value
-	 && cv_filter.value <= NUMFILTERS && filtermode[cv_filter.value].filter && filtermode[cv_filter.value].bpp)
-	{
-		int hwidth  =  width/2 + 6;
-		int heighth = height/2 + 6;
-		int hbpp = filtermode[cv_filter.value].bpp;
-		switch(hbpp)
-		{
-			case 8:
-				preSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,hwidth,heighth, 8,0x00000000,0x00000000,0x00000000,0x00);
-				f2xSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, width,height , 8,0x00000000,0x00000000,0x00000000,0x00);
-			case 15:
-				preSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,hwidth,heighth,15,0x00007C00,0x000003E0,0x0000001F,0x00);
-				f2xSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, width,height ,15,0x00007C00,0x000003E0,0x0000001F,0x00);
-				break;
-			case 16:
-				preSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,hwidth,heighth,16,0x0000F800,0x000007E0,0x0000001F,0x00);
-				f2xSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, width,height ,16,0x0000F800,0x000007E0,0x0000001F,0x00);
-				break;
-			case 24:
-				preSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,hwidth,heighth,24,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-				f2xSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, width,height ,24,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-				break;
-			case 32:
-				preSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,hwidth,heighth,32,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-				f2xSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, width,height ,32,0x00FF0000,0x0000FF00,0x000000FF,0x00);
-				break;
-			default:
-				//I_Error("Filter help");
-				break;
-		}
-		if(preSurface && f2xSurface)
-		{
-			blitfilter = filtermode[cv_filter.value].filter;
-			if(bpp < hbpp) bpp = hbpp;
-		}
-		else
-		{
-			if(preSurface) SDL_FreeSurface(preSurface);
-			preSurface = NULL;
-			if(f2xSurface) SDL_FreeSurface(f2xSurface);
-			f2xSurface = NULL;
-		}
-	}
-	return bpp;
-}
-#else
-
-#ifdef __GNUC__ // __attribute__ ((X))
-#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-#define FUNCINLINE __attribute__((always_inline))
-#endif
-#define FUNCNOINLINE __attribute__((noinline))
-#elif defined(_MSC_VER)
-#define inline __inline
-#define ATTRNORETURN   __declspec(noreturn)
-#define ATTRINLINE __forceinline
-#if _MSC_VER > 1200
-#define ATTRNOINLINE __declspec(noinline)
-#endif
-#endif
-
-
-
-#ifndef FUNCINLINE
-#define FUNCINLINE
-#endif
-#ifndef FUNCNOINLINE
-#define FUNCNOINLINE
-#endif
-#ifndef ATTRINLINE
-#define ATTRINLINE inline
-#endif
-#ifndef ATTRNOINLINE
-#define ATTRNOINLINE
-#endif
-
-#endif
-
-#endif
diff --git a/src/sdl12/filter/hq2x.c b/src/sdl12/filter/hq2x.c
deleted file mode 100644
index acdbcb168b1f2600f00a9ef4f7eb737faf861317..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/hq2x.c
+++ /dev/null
@@ -1,3125 +0,0 @@
-//hq2x filter demo program
-//----------------------------------------------------------
-//Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
-
-//This program is free software; you can redistribute it and/or
-//modify it under the terms of the GNU Lesser General Public
-//License as published by the Free Software Foundation; either
-//version 2.1 of the License, or (at your option) any later version.
-//
-//This program is distributed in the hope that it will be useful,
-//but WITHOUT ANY WARRANTY; without even the implied warranty of
-//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-//Lesser General Public License for more details.
-//
-//You should have received a copy of the GNU Lesser General Public
-//License along with this program; if not, write to the Free Software
-//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-#include "filters.h"
-#include <math.h>
-#ifdef __GNUC__
-#include <stdlib.h>
-#endif
-
-
-#if (defined(__GNUC__) && defined(__i386__)) || (defined(_MSC_VER) && defined(_X86_))
-#define HQ2XASM
-#endif
-
-#ifdef _MSC_VER
-//#define HQ2XMMXASM
-#endif
-
-static int   LUT16to32[65536];
-static int   RGBtoYUV[65536];
-#ifdef HQ2XMMXASM
-#include "SDL_cpuinfo.h"
-static SDL_bool hasMMX = 0;
-const Sint64 reg_blank = 0;
-const Sint64 const3    = 0x0000000300030003;
-const Sint64 const5    = 0x0000000500050005;
-const Sint64 const6    = 0x0000000600060006;
-const Sint64 const14   = 0x0000000E000E000E;
-const Sint64 tr3eshold = 0x0000000000300706;
-#endif
-static int   YUV1, YUV2;
-const  int   Ymask = 0x00FF0000;
-const  int   Umask = 0x0000FF00;
-const  int   Vmask = 0x000000FF;
-const  int   trY   = 0x00300000;
-const  int   trU   = 0x00000700;
-const  int   trV   = 0x00000006;
-
-FUNCINLINE static ATTRINLINE void Interp1(Uint8 * pc, int c1, int c2)
-{
-#ifdef HQ2XASM
-  //*((int*)pc) = (c1*3+c2)/4;
-#ifdef __GNUC__
-  int c3 = c1;
-  __asm__("shl $2, %1; add %2, %1; sub %3, %1; shr $2, %1":"=d"(*((int*)pc)):"d"(c1),"r"(c2),"r"(c3):"memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    mov        edx, c1
-    shl        edx, 2
-    add        edx, c2
-    sub        edx, c1
-    shr        edx, 2
-    mov        [eax], edx
-  }
-#endif
-#else
-  *((int*)pc) = (c1*3+c2) >> 2;
-#endif
-}
-
-FUNCINLINE static ATTRINLINE void Interp2(Uint8 * pc, int c1, int c2, int c3)
-{
-#ifdef HQ2XASM
-//  *((int*)pc) = (c1*2+c2+c3) >> 2;
-#ifdef __GNUC__
-  __asm__("shl $1, %1; add %2, %1; add %3, %1; shr $2, %1":"=d"(*((int*)pc)):"d"(c1),"r"(c2),"r"(c3):"memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    mov        edx, c1
-    shl        edx, 1
-    add        edx, c2
-    add        edx, c3
-    shr        edx, 2
-    mov        [eax], edx
-  }
-#endif
-#else
-  *((int*)pc) = (c1*2+c2+c3) >> 2;
-#endif
-}
-
-#if 0
-static inline void Interp5(Uint8 * pc, int c1, int c2)
-{
-#ifdef HQ2XASM
-  //*((int*)pc) = (c1+c2)/2;
-#ifdef __GNUC__
-  __asm__("add %2, %1; shr $1, %1":"=d"(*((int*)pc)):"d"(c1),"r"(c2):"memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    mov        edx, c1
-    add        edx, c2
-    shr        edx, 1
-    mov        [eax], edx
-  }
-#endif
-#else
-  *((int*)pc) = (c1+c2) >> 1;
-#endif
-}
-#endif
-
-FUNCINLINE static ATTRINLINE void Interp6(Uint8 * pc, int c1, int c2, int c3)
-{
-#ifdef HQ2XMMXASM
- //*((int*)pc) = (c1*5+c2*2+c3)/8;
- if(hasMMX)
-#ifdef __GNUC__
-  __asm__("movd %1, %%mm1; movd %2, %%mm2, movd %3, %%mm3; punpcklbw $_reg_blank, %%mm1; punpcklbw $_reg_blank, %%mm2; punpcklbw $_reg_blank, %%mm3; pmullw $_const5, %%mm1; psllw $1, %%mm2; paddw %%mm3, %%mm1; paddw %%mm2, %%mm1; psrlw $3, %%mm1; packuswb $_reg_blank, %%mm1; movd %%mm1, %0" : "=r"(*((int*)pc)) : "r" (c1),"r" (c2),"r" (c3) : "memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    movd       mm1, c1
-    movd       mm2, c2
-    movd       mm3, c3
-    punpcklbw  mm1, reg_blank
-    punpcklbw  mm2, reg_blank
-    punpcklbw  mm3, reg_blank
-    pmullw     mm1, const5
-    psllw      mm2, 1
-    paddw      mm1, mm3
-    paddw      mm1, mm2
-    psrlw      mm1, 3
-    packuswb   mm1, reg_blank
-    movd       [eax], mm1
-  }
-#endif
- else
-#endif
-  *((int*)pc) = ((((c1 & 0x00FF00)*5 + (c2 & 0x00FF00)*2 + (c3 & 0x00FF00) ) & 0x0007F800) +
-                 (((c1 & 0xFF00FF)*5 + (c2 & 0xFF00FF)*2 + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
-}
-
-FUNCINLINE static ATTRINLINE void Interp7(Uint8 * pc, int c1, int c2, int c3)
-{
-#ifdef HQ2XMMXASM
- //*((int*)pc) = (c1*6+c2+c3)/8;
- if(hasMMX)
-#ifdef __GNUC__
-  __asm__("movd %1, %%mm1; movd %2, %%mm2, movd %3, %%mm3; punpcklbw $_reg_blank, %%mm1; punpcklbw $_reg_blank, %%mm2; punpcklbw $_reg_blank, %%mm3; pmull2 $_const6, %%mm1; padw %%mm3, %%mm2; paddw %%mm2, %%mm1; psrlw $3, %%mm1; packuswb $_reg_blank, %%mm1; movd %%mm1, %0 " : "=r" (*((int*)pc)): "r"(c1), "r"(c2), "r"(c3) : "memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    movd       mm1, c1
-    movd       mm2, c2
-    movd       mm3, c3
-    punpcklbw  mm1, reg_blank
-    punpcklbw  mm2, reg_blank
-    punpcklbw  mm3, reg_blank
-    pmullw     mm1, const6
-    paddw      mm2, mm3
-    paddw      mm1, mm2
-    psrlw      mm1, 3
-    packuswb   mm1, reg_blank
-    movd       [eax], mm1
-  }
-#endif
- else
-#endif
-  *((int*)pc) = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x0007F800) +
-                 (((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
-}
-
-FUNCINLINE static ATTRINLINE void Interp9(Uint8 * pc, int c1, int c2, int c3)
-{
-#ifdef HQ2XMMXASM
- //*((int*)pc) = (c1*2+(c2+c3)*3)/8;
- if(hasMMX)
-#ifdef __GNUC__
-  __asm__("movd %1, %%mm1; movd %2, %%mm2, movd %3, %%mm3; punpcklbw $_reg_blank, %%mm1; punpcklbw $_reg_blank, %%mm2; punpcklbw $_reg_blank, %%mm3; psllw $1, %%mm1; paddw %%mm3, %%mm2; pmullw $_const3, %%mm2; padw %%mm2, %%mm1; psrlw $3, %%mm1; packuswb $_reg_blank, %%mm1; movd %%mm1, %0;" : "=r"(*((int*)pc)) : "r" (c1),"r" (c2),"r" (c3) : "memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    movd       mm1, c1
-    movd       mm2, c2
-    movd       mm3, c3
-    punpcklbw  mm1, reg_blank
-    punpcklbw  mm2, reg_blank
-    punpcklbw  mm3, reg_blank
-    psllw      mm1, 1
-    paddw      mm2, mm3
-    pmullw     mm2, const3
-    paddw      mm1, mm2
-    psrlw      mm1, 3
-    packuswb   mm1, reg_blank
-    movd       [eax], mm1
-  }
-#endif
- else
-#endif
-  *((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*3 ) & 0x0007F800) +
-                 (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*3 ) & 0x07F807F8)) >> 3;
-}
-
-FUNCINLINE static ATTRINLINE void Interp10(Uint8 * pc, int c1, int c2, int c3)
-{
-#ifdef HQ2XMMXASM
- //*((int*)pc) = (c1*14+c2+c3)/16;
- if(hasMMX)
-#ifdef __GNUC__
-  __asm__("movd %1, %%mm1; movd %2, %%mm2, movd %3, %%mm3; punpcklbw $_reg_blank, %%mm1; punpcklbw $_reg_blank, %%mm2; punpcklbw $_reg_blank, %%mm3; pmullw $_const14, %%mm1; paddw %%mm3, %%mm2; paddw %%mm2, %%mm1; psrlw $4, %%mm1; packuswb $_req_blank, %%mm1; movd %%mm1, %0;" : "=r"(*((int*)pc)) : "r" (c1),"r" (c2),"r" (c3) : "memory");
-#else
-  __asm
-  {
-    mov        eax, pc
-    movd       mm1, c1
-    movd       mm2, c2
-    movd       mm3, c3
-    punpcklbw  mm1, reg_blank
-    punpcklbw  mm2, reg_blank
-    punpcklbw  mm3, reg_blank
-    pmullw     mm1, const14
-    paddw      mm2, mm3
-    paddw      mm1, mm2
-    psrlw      mm1, 4
-    packuswb   mm1, reg_blank
-    movd       [eax], mm1
-  }
-#endif
- else
-#endif
-  *((int*)pc) = ((((c1 & 0x00FF00)*14 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x000FF000) +
-                 (((c1 & 0xFF00FF)*14 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x0FF00FF0)) >> 4;
-}
-#define PIXEL00_0     *((int*)(pOut)) = c[5];
-#define PIXEL00_10    Interp1(pOut, c[5], c[1]);
-#define PIXEL00_11    Interp1(pOut, c[5], c[4]);
-#define PIXEL00_12    Interp1(pOut, c[5], c[2]);
-#define PIXEL00_20    Interp2(pOut, c[5], c[4], c[2]);
-#define PIXEL00_21    Interp2(pOut, c[5], c[1], c[2]);
-#define PIXEL00_22    Interp2(pOut, c[5], c[1], c[4]);
-#define PIXEL00_60    Interp6(pOut, c[5], c[2], c[4]);
-#define PIXEL00_61    Interp6(pOut, c[5], c[4], c[2]);
-#define PIXEL00_70    Interp7(pOut, c[5], c[4], c[2]);
-#define PIXEL00_90    Interp9(pOut, c[5], c[4], c[2]);
-#define PIXEL00_100   Interp10(pOut, c[5], c[4], c[2]);
-#define PIXEL01_0     *((int*)(pOut+4)) = c[5];
-#define PIXEL01_10    Interp1(pOut+4, c[5], c[3]);
-#define PIXEL01_11    Interp1(pOut+4, c[5], c[2]);
-#define PIXEL01_12    Interp1(pOut+4, c[5], c[6]);
-#define PIXEL01_20    Interp2(pOut+4, c[5], c[2], c[6]);
-#define PIXEL01_21    Interp2(pOut+4, c[5], c[3], c[6]);
-#define PIXEL01_22    Interp2(pOut+4, c[5], c[3], c[2]);
-#define PIXEL01_60    Interp6(pOut+4, c[5], c[6], c[2]);
-#define PIXEL01_61    Interp6(pOut+4, c[5], c[2], c[6]);
-#define PIXEL01_70    Interp7(pOut+4, c[5], c[2], c[6]);
-#define PIXEL01_90    Interp9(pOut+4, c[5], c[2], c[6]);
-#define PIXEL01_100   Interp10(pOut+4, c[5], c[2], c[6]);
-#define PIXEL10_0     *((int*)(pOut+BpL)) = c[5];
-#define PIXEL10_10    Interp1(pOut+BpL, c[5], c[7]);
-#define PIXEL10_11    Interp1(pOut+BpL, c[5], c[8]);
-#define PIXEL10_12    Interp1(pOut+BpL, c[5], c[4]);
-#define PIXEL10_20    Interp2(pOut+BpL, c[5], c[8], c[4]);
-#define PIXEL10_21    Interp2(pOut+BpL, c[5], c[7], c[4]);
-#define PIXEL10_22    Interp2(pOut+BpL, c[5], c[7], c[8]);
-#define PIXEL10_60    Interp6(pOut+BpL, c[5], c[4], c[8]);
-#define PIXEL10_61    Interp6(pOut+BpL, c[5], c[8], c[4]);
-#define PIXEL10_70    Interp7(pOut+BpL, c[5], c[8], c[4]);
-#define PIXEL10_90    Interp9(pOut+BpL, c[5], c[8], c[4]);
-#define PIXEL10_100   Interp10(pOut+BpL, c[5], c[8], c[4]);
-#define PIXEL11_0     *((int*)(pOut+BpL+4)) = c[5];
-#define PIXEL11_10    Interp1(pOut+BpL+4, c[5], c[9]);
-#define PIXEL11_11    Interp1(pOut+BpL+4, c[5], c[6]);
-#define PIXEL11_12    Interp1(pOut+BpL+4, c[5], c[8]);
-#define PIXEL11_20    Interp2(pOut+BpL+4, c[5], c[6], c[8]);
-#define PIXEL11_21    Interp2(pOut+BpL+4, c[5], c[9], c[8]);
-#define PIXEL11_22    Interp2(pOut+BpL+4, c[5], c[9], c[6]);
-#define PIXEL11_60    Interp6(pOut+BpL+4, c[5], c[8], c[6]);
-#define PIXEL11_61    Interp6(pOut+BpL+4, c[5], c[6], c[8]);
-#define PIXEL11_70    Interp7(pOut+BpL+4, c[5], c[6], c[8]);
-#define PIXEL11_90    Interp9(pOut+BpL+4, c[5], c[6], c[8]);
-#define PIXEL11_100   Interp10(pOut+BpL+4, c[5], c[6], c[8]);
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4035)
-#endif
-
-FUNCINLINE static ATTRINLINE int Diff(Uint32 w1, Uint32 w2)
-{
-#ifdef HQ2XMMXASM
- if(hasMMX)
- {
-#ifdef __GNUC__
-  int diffresult = 0;
-  if(w1 != w2)
-   __asm__("movd %3+%1*4, %%mm1; movq %%mm1, %%mm5; movd %3+%2*4, %%mm2; psubusb %%mm2, %%mm1; psubusb %%mm5, %%mm2; por %%mm2, %%mm1; psubusb $_treshold, %%mm1; movd %%mm1, %0" : "=c" (diffresult):"d" (w1),"q" (w2),"c" (RGBtoYUV) : "memory");
-  return diffresult;
-#else
-  __asm
-  {
-    xor     eax,eax
-    mov     ebx,w1
-    mov     edx,w2
-    cmp     ebx,edx
-    je      FIN
-    mov     ecx,offset RGBtoYUV
-    movd    mm1,[ecx + ebx*4]
-    movq    mm5,mm1
-    movd    mm2,[ecx + edx*4]
-    psubusb mm1,mm2
-    psubusb mm2,mm5
-    por     mm1,mm2
-    psubusb mm1,treshold
-    movd    eax,mm1
-FIN:
-  }// returns result in eax register
-#endif
- }
- else
-#endif
- {
-  YUV1 = RGBtoYUV[w1];
-  YUV2 = RGBtoYUV[w2];
-  return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
-           ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
-           ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
- }
-}
-
-
-#ifdef _MSC_VER
-#pragma warning(default: 4035)
-#endif
-
-
-static void hq2x_32( Uint8 * pIn, Uint8 * pOut, int Xres, int Yres, int BpL )
-{
-  int  i, j, k;
-  int  prevline, nextline;
-  int  w[10];
-  int  c[10];
-
-  //   +----+----+----+
-  //   |    |    |    |
-  //   | w1 | w2 | w3 |
-  //   +----+----+----+
-  //   |    |    |    |
-  //   | w4 | w5 | w6 |
-  //   +----+----+----+
-  //   |    |    |    |
-  //   | w7 | w8 | w9 |
-  //   +----+----+----+
-
-  for (j=0; j<Yres; j++)
-  {
-    if (j>0)      prevline = -Xres*2; else prevline = 0;
-    if (j<Yres-1) nextline =  Xres*2; else nextline = 0;
-
-    for (i=0; i<Xres; i++)
-    {
-      int pattern = 0;
-      int flag = 1;
-
-      w[2] = *((Uint16*)(pIn + prevline));
-      w[5] = *((Uint16*)pIn);
-      w[8] = *((Uint16*)(pIn + nextline));
-
-      if (i>0)
-      {
-        w[1] = *((Uint16*)(pIn + prevline - 2));
-        w[4] = *((Uint16*)(pIn - 2));
-        w[7] = *((Uint16*)(pIn + nextline - 2));
-      }
-      else
-      {
-        w[1] = w[2];
-        w[4] = w[5];
-        w[7] = w[8];
-      }
-
-      if (i<Xres-1)
-      {
-        w[3] = *((Uint16*)(pIn + prevline + 2));
-        w[6] = *((Uint16*)(pIn + 2));
-        w[9] = *((Uint16*)(pIn + nextline + 2));
-      }
-      else
-      {
-        w[3] = w[2];
-        w[6] = w[5];
-        w[9] = w[8];
-      }
-
-#ifdef HQ2XMMXASM
-      if(hasMMX)
-      {
-        if ( Diff(w[5],w[1]) ) pattern |= 0x0001;
-        if ( Diff(w[5],w[2]) ) pattern |= 0x0002;
-        if ( Diff(w[5],w[3]) ) pattern |= 0x0004;
-        if ( Diff(w[5],w[4]) ) pattern |= 0x0008;
-        if ( Diff(w[5],w[6]) ) pattern |= 0x0010;
-        if ( Diff(w[5],w[7]) ) pattern |= 0x0020;
-        if ( Diff(w[5],w[8]) ) pattern |= 0x0040;
-        if ( Diff(w[5],w[9]) ) pattern |= 0x0080;
-      }
-      else
-#endif
-      {
-        YUV1 = RGBtoYUV[w[5]];
-
-        for (k=1; k<=9; k++)
-        {
-          if (k==5) continue;
-
-          if ( w[k] != w[5] )
-          {
-            YUV2 = RGBtoYUV[w[k]];
-            if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
-                 ( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
-                 ( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
-              pattern |= flag;
-          }
-          flag <<= 1;
-        }
-      }
-
-      for (k=1; k<=9; k++)
-        c[k] = LUT16to32[w[k]];
-
-      switch (pattern)
-      {
-        case 0:
-        case 1:
-        case 4:
-        case 32:
-        case 128:
-        case 5:
-        case 132:
-        case 160:
-        case 33:
-        case 129:
-        case 36:
-        case 133:
-        case 164:
-        case 161:
-        case 37:
-        case 165:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 2:
-        case 34:
-        case 130:
-        case 162:
-        {
-          PIXEL00_22
-          PIXEL01_21
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 16:
-        case 17:
-        case 48:
-        case 49:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 64:
-        case 65:
-        case 68:
-        case 69:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_21
-          PIXEL11_22
-          break;
-        }
-        case 8:
-        case 12:
-        case 136:
-        case 140:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 3:
-        case 35:
-        case 131:
-        case 163:
-        {
-          PIXEL00_11
-          PIXEL01_21
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 6:
-        case 38:
-        case 134:
-        case 166:
-        {
-          PIXEL00_22
-          PIXEL01_12
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 20:
-        case 21:
-        case 52:
-        case 53:
-        {
-          PIXEL00_20
-          PIXEL01_11
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 144:
-        case 145:
-        case 176:
-        case 177:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          PIXEL10_20
-          PIXEL11_12
-          break;
-        }
-        case 192:
-        case 193:
-        case 196:
-        case 197:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_21
-          PIXEL11_11
-          break;
-        }
-        case 96:
-        case 97:
-        case 100:
-        case 101:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_12
-          PIXEL11_22
-          break;
-        }
-        case 40:
-        case 44:
-        case 168:
-        case 172:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          PIXEL10_11
-          PIXEL11_20
-          break;
-        }
-        case 9:
-        case 13:
-        case 137:
-        case 141:
-        {
-          PIXEL00_12
-          PIXEL01_20
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 18:
-        case 50:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 80:
-        case 81:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 72:
-        case 76:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 10:
-        case 138:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 66:
-        {
-          PIXEL00_22
-          PIXEL01_21
-          PIXEL10_21
-          PIXEL11_22
-          break;
-        }
-        case 24:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 7:
-        case 39:
-        case 135:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 148:
-        case 149:
-        case 180:
-        {
-          PIXEL00_20
-          PIXEL01_11
-          PIXEL10_20
-          PIXEL11_12
-          break;
-        }
-        case 224:
-        case 228:
-        case 225:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 41:
-        case 169:
-        case 45:
-        {
-          PIXEL00_12
-          PIXEL01_20
-          PIXEL10_11
-          PIXEL11_20
-          break;
-        }
-        case 22:
-        case 54:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 208:
-        case 209:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 104:
-        case 108:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 11:
-        case 139:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 19:
-        case 51:
-        {
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL00_11
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL00_60
-            PIXEL01_90
-          }
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 146:
-        case 178:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-            PIXEL11_12
-          }
-          else
-          {
-            PIXEL01_90
-            PIXEL11_61
-          }
-          PIXEL10_20
-          break;
-        }
-        case 84:
-        case 85:
-        {
-          PIXEL00_20
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL01_11
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL01_60
-            PIXEL11_90
-          }
-          PIXEL10_21
-          break;
-        }
-        case 112:
-        case 113:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL10_12
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL10_61
-            PIXEL11_90
-          }
-          break;
-        }
-        case 200:
-        case 204:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-            PIXEL11_11
-          }
-          else
-          {
-            PIXEL10_90
-            PIXEL11_60
-          }
-          break;
-        }
-        case 73:
-        case 77:
-        {
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL00_12
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL00_61
-            PIXEL10_90
-          }
-          PIXEL01_20
-          PIXEL11_22
-          break;
-        }
-        case 42:
-        case 170:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-            PIXEL10_11
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL10_60
-          }
-          PIXEL01_21
-          PIXEL11_20
-          break;
-        }
-        case 14:
-        case 142:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-            PIXEL01_12
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL01_61
-          }
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 67:
-        {
-          PIXEL00_11
-          PIXEL01_21
-          PIXEL10_21
-          PIXEL11_22
-          break;
-        }
-        case 70:
-        {
-          PIXEL00_22
-          PIXEL01_12
-          PIXEL10_21
-          PIXEL11_22
-          break;
-        }
-        case 28:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 152:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 194:
-        {
-          PIXEL00_22
-          PIXEL01_21
-          PIXEL10_21
-          PIXEL11_11
-          break;
-        }
-        case 98:
-        {
-          PIXEL00_22
-          PIXEL01_21
-          PIXEL10_12
-          PIXEL11_22
-          break;
-        }
-        case 56:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 25:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 26:
-        case 31:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 82:
-        case 214:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 88:
-        case 248:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 74:
-        case 107:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 27:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_10
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 86:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_21
-          PIXEL11_10
-          break;
-        }
-        case 216:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          PIXEL10_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 106:
-        {
-          PIXEL00_10
-          PIXEL01_21
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 30:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 210:
-        {
-          PIXEL00_22
-          PIXEL01_10
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 120:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_10
-          break;
-        }
-        case 75:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          PIXEL10_10
-          PIXEL11_22
-          break;
-        }
-        case 29:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          PIXEL10_22
-          PIXEL11_21
-          break;
-        }
-        case 198:
-        {
-          PIXEL00_22
-          PIXEL01_12
-          PIXEL10_21
-          PIXEL11_11
-          break;
-        }
-        case 184:
-        {
-          PIXEL00_21
-          PIXEL01_22
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 99:
-        {
-          PIXEL00_11
-          PIXEL01_21
-          PIXEL10_12
-          PIXEL11_22
-          break;
-        }
-        case 57:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 71:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_21
-          PIXEL11_22
-          break;
-        }
-        case 156:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 226:
-        {
-          PIXEL00_22
-          PIXEL01_21
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 60:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 195:
-        {
-          PIXEL00_11
-          PIXEL01_21
-          PIXEL10_21
-          PIXEL11_11
-          break;
-        }
-        case 102:
-        {
-          PIXEL00_22
-          PIXEL01_12
-          PIXEL10_12
-          PIXEL11_22
-          break;
-        }
-        case 153:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 58:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 83:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 92:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 202:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          PIXEL01_21
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          PIXEL11_11
-          break;
-        }
-        case 78:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          PIXEL11_22
-          break;
-        }
-        case 154:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 114:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 89:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 90:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 55:
-        case 23:
-        {
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL00_11
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL00_60
-            PIXEL01_90
-          }
-          PIXEL10_20
-          PIXEL11_21
-          break;
-        }
-        case 182:
-        case 150:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-            PIXEL11_12
-          }
-          else
-          {
-            PIXEL01_90
-            PIXEL11_61
-          }
-          PIXEL10_20
-          break;
-        }
-        case 213:
-        case 212:
-        {
-          PIXEL00_20
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL01_11
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL01_60
-            PIXEL11_90
-          }
-          PIXEL10_21
-          break;
-        }
-        case 241:
-        case 240:
-        {
-          PIXEL00_20
-          PIXEL01_22
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL10_12
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL10_61
-            PIXEL11_90
-          }
-          break;
-        }
-        case 236:
-        case 232:
-        {
-          PIXEL00_21
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-            PIXEL11_11
-          }
-          else
-          {
-            PIXEL10_90
-            PIXEL11_60
-          }
-          break;
-        }
-        case 109:
-        case 105:
-        {
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL00_12
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL00_61
-            PIXEL10_90
-          }
-          PIXEL01_20
-          PIXEL11_22
-          break;
-        }
-        case 171:
-        case 43:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-            PIXEL10_11
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL10_60
-          }
-          PIXEL01_21
-          PIXEL11_20
-          break;
-        }
-        case 143:
-        case 15:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-            PIXEL01_12
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL01_61
-          }
-          PIXEL10_22
-          PIXEL11_20
-          break;
-        }
-        case 124:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_10
-          break;
-        }
-        case 203:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          PIXEL10_10
-          PIXEL11_11
-          break;
-        }
-        case 62:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 211:
-        {
-          PIXEL00_11
-          PIXEL01_10
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 118:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_12
-          PIXEL11_10
-          break;
-        }
-        case 217:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          PIXEL10_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 110:
-        {
-          PIXEL00_10
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 155:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_10
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 188:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 185:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 61:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 157:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 103:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_12
-          PIXEL11_22
-          break;
-        }
-        case 227:
-        {
-          PIXEL00_11
-          PIXEL01_21
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 230:
-        {
-          PIXEL00_22
-          PIXEL01_12
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 199:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_21
-          PIXEL11_11
-          break;
-        }
-        case 220:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 158:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 234:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          PIXEL01_21
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_11
-          break;
-        }
-        case 242:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 59:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 121:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 87:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 79:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          PIXEL11_22
-          break;
-        }
-        case 122:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 94:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 218:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 91:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 229:
-        {
-          PIXEL00_20
-          PIXEL01_20
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 167:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_20
-          PIXEL11_20
-          break;
-        }
-        case 173:
-        {
-          PIXEL00_12
-          PIXEL01_20
-          PIXEL10_11
-          PIXEL11_20
-          break;
-        }
-        case 181:
-        {
-          PIXEL00_20
-          PIXEL01_11
-          PIXEL10_20
-          PIXEL11_12
-          break;
-        }
-        case 186:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 115:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 93:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 206:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          PIXEL11_11
-          break;
-        }
-        case 205:
-        case 201:
-        {
-          PIXEL00_12
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_10
-          }
-          else
-          {
-            PIXEL10_70
-          }
-          PIXEL11_11
-          break;
-        }
-        case 174:
-        case 46:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_10
-          }
-          else
-          {
-            PIXEL00_70
-          }
-          PIXEL01_12
-          PIXEL10_11
-          PIXEL11_20
-          break;
-        }
-        case 179:
-        case 147:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_10
-          }
-          else
-          {
-            PIXEL01_70
-          }
-          PIXEL10_20
-          PIXEL11_12
-          break;
-        }
-        case 117:
-        case 116:
-        {
-          PIXEL00_20
-          PIXEL01_11
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_10
-          }
-          else
-          {
-            PIXEL11_70
-          }
-          break;
-        }
-        case 189:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 231:
-        {
-          PIXEL00_11
-          PIXEL01_12
-          PIXEL10_12
-          PIXEL11_11
-          break;
-        }
-        case 126:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_10
-          break;
-        }
-        case 219:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_10
-          PIXEL10_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 125:
-        {
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL00_12
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL00_61
-            PIXEL10_90
-          }
-          PIXEL01_11
-          PIXEL11_10
-          break;
-        }
-        case 221:
-        {
-          PIXEL00_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL01_11
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL01_60
-            PIXEL11_90
-          }
-          PIXEL10_10
-          break;
-        }
-        case 207:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-            PIXEL01_12
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL01_61
-          }
-          PIXEL10_10
-          PIXEL11_11
-          break;
-        }
-        case 238:
-        {
-          PIXEL00_10
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-            PIXEL11_11
-          }
-          else
-          {
-            PIXEL10_90
-            PIXEL11_60
-          }
-          break;
-        }
-        case 190:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-            PIXEL11_12
-          }
-          else
-          {
-            PIXEL01_90
-            PIXEL11_61
-          }
-          PIXEL10_11
-          break;
-        }
-        case 187:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-            PIXEL10_11
-          }
-          else
-          {
-            PIXEL00_90
-            PIXEL10_60
-          }
-          PIXEL01_10
-          PIXEL11_12
-          break;
-        }
-        case 243:
-        {
-          PIXEL00_11
-          PIXEL01_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL10_12
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL10_61
-            PIXEL11_90
-          }
-          break;
-        }
-        case 119:
-        {
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL00_11
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL00_60
-            PIXEL01_90
-          }
-          PIXEL10_12
-          PIXEL11_10
-          break;
-        }
-        case 237:
-        case 233:
-        {
-          PIXEL00_12
-          PIXEL01_20
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          PIXEL11_11
-          break;
-        }
-        case 175:
-        case 47:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          PIXEL01_12
-          PIXEL10_11
-          PIXEL11_20
-          break;
-        }
-        case 183:
-        case 151:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_20
-          PIXEL11_12
-          break;
-        }
-        case 245:
-        case 244:
-        {
-          PIXEL00_20
-          PIXEL01_11
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 250:
-        {
-          PIXEL00_10
-          PIXEL01_10
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 123:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_10
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_10
-          break;
-        }
-        case 95:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_10
-          PIXEL11_10
-          break;
-        }
-        case 222:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 252:
-        {
-          PIXEL00_21
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 249:
-        {
-          PIXEL00_12
-          PIXEL01_22
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 235:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_21
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          PIXEL11_11
-          break;
-        }
-        case 111:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_22
-          break;
-        }
-        case 63:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_11
-          PIXEL11_21
-          break;
-        }
-        case 159:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_22
-          PIXEL11_12
-          break;
-        }
-        case 215:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_21
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 246:
-        {
-          PIXEL00_22
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 254:
-        {
-          PIXEL00_10
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 253:
-        {
-          PIXEL00_12
-          PIXEL01_11
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 251:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          PIXEL01_10
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 239:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          PIXEL01_12
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          PIXEL11_11
-          break;
-        }
-        case 127:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_20
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_20
-          }
-          PIXEL11_10
-          break;
-        }
-        case 191:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_11
-          PIXEL11_12
-          break;
-        }
-        case 223:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_20
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_10
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_20
-          }
-          break;
-        }
-        case 247:
-        {
-          PIXEL00_11
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          PIXEL10_12
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-        case 255:
-        {
-          if (Diff(w[4], w[2]))
-          {
-            PIXEL00_0
-          }
-          else
-          {
-            PIXEL00_100
-          }
-          if (Diff(w[2], w[6]))
-          {
-            PIXEL01_0
-          }
-          else
-          {
-            PIXEL01_100
-          }
-          if (Diff(w[8], w[4]))
-          {
-            PIXEL10_0
-          }
-          else
-          {
-            PIXEL10_100
-          }
-          if (Diff(w[6], w[8]))
-          {
-            PIXEL11_0
-          }
-          else
-          {
-            PIXEL11_100
-          }
-          break;
-        }
-      }
-      pIn+=2;
-      pOut+=8;
-    }
-    pOut+=BpL;
-  }
-}
-
-FUNCINLINE static ATTRINLINE void InitLUTs(void)
-{
-  int i, j, k, r, g, b, Y, u, v;
-
-#ifdef HQ2XMMXASM
-  hasMMX = SDL_HasMMX();
-#endif
-
-  for (i=0; i<65536; i++)
-    LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
-
-  for (i=0; i<32; i++)
-  for (j=0; j<64; j++)
-  for (k=0; k<32; k++)
-  {
-    r = i << 3;
-    g = j << 2;
-    b = k << 3;
-    Y = (r + g + b) >> 2;
-    u = 128 + ((r - b) >> 2);
-    v = 128 + ((-r + 2*g -b)>>3);
-    RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
-  }
-}
-
-void filter_hq2x(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr, Uint32 dstPitch, int width, int height)
-{
-	static Uint8 doneLUT = 1;
-	(void)srcPitch;
-	if(doneLUT) InitLUTs();
-	else doneLUT = 0;
-	hq2x_32( srcPtr, dstPtr, width, height, dstPitch );
-}
diff --git a/src/sdl12/filter/hq2x.h b/src/sdl12/filter/hq2x.h
deleted file mode 100644
index 49c0b268700655bcbaa69c968ff3d044779793a5..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/hq2x.h
+++ /dev/null
@@ -1,1824 +0,0 @@
-case 0 :
-case 1 :
-case 4 :
-case 5 :
-case 32 :
-case 33 :
-case 36 :
-case 37 :
-case 128 :
-case 129 :
-case 132 :
-case 133 :
-case 160 :
-case 161 :
-case 164 :
-case 165 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I211(4, 1, 5);
-  P2 = I211(4, 3, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 2 :
-case 34 :
-case 130 :
-case 162 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I211(4, 3, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 3 :
-case 35 :
-case 131 :
-case 163 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I211(4, 3, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 6 :
-case 38 :
-case 134 :
-case 166 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P2 = I211(4, 3, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 7 :
-case 39 :
-case 135 :
-case 167 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 5);
-  P2 = I211(4, 3, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 8 :
-case 12 :
-case 136 :
-case 140 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-} break;
-case 9 :
-case 13 :
-case 137 :
-case 141 :
-{
-  P0 = I31(4, 1);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-} break;
-case 10 :
-case 138 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 11 :
-case 139 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 14 :
-case 142 :
-{
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-    P1 = I31(4, 5);
-  } else {
-    P0 = I332(1, 3, 4);
-    P1 = I521(4, 1, 5);
-  }
-} break;
-case 15 :
-case 143 :
-{
-  P2 = I31(4, 6);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = IC(4);
-    P1 = I31(4, 5);
-  } else {
-    P0 = I332(1, 3, 4);
-    P1 = I521(4, 1, 5);
-  }
-} break;
-case 16 :
-case 17 :
-case 48 :
-case 49 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-} break;
-case 18 :
-case 50 :
-{
-  P0 = I31(4, 0);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 19 :
-case 51 :
-{
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P0 = I31(4, 3);
-    P1 = I31(4, 2);
-  } else {
-    P0 = I521(4, 1, 3);
-    P1 = I332(1, 5, 4);
-  }
-} break;
-case 20 :
-case 21 :
-case 52 :
-case 53 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 1);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-} break;
-case 22 :
-case 54 :
-{
-  P0 = I31(4, 0);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 23 :
-case 55 :
-{
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P0 = I31(4, 3);
-    P1 = IC(4);
-  } else {
-    P0 = I521(4, 1, 3);
-    P1 = I332(1, 5, 4);
-  }
-} break;
-case 24 :
-case 66 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 25 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 26 :
-case 31 :
-case 95 :
-{
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 27 :
-case 75 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 28 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 29 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 30 :
-case 86 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 40 :
-case 44 :
-case 168 :
-case 172 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 41 :
-case 45 :
-case 169 :
-case 173 :
-{
-  P0 = I31(4, 1);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 7);
-  P3 = I211(4, 5, 7);
-} break;
-case 42 :
-case 170 :
-{
-  P1 = I31(4, 2);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-    P2 = I31(4, 7);
-  } else {
-    P0 = I332(1, 3, 4);
-    P2 = I521(4, 3, 7);
-  }
-} break;
-case 43 :
-case 171 :
-{
-  P1 = I31(4, 2);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = IC(4);
-    P2 = I31(4, 7);
-  } else {
-    P0 = I332(1, 3, 4);
-    P2 = I521(4, 3, 7);
-  }
-} break;
-case 46 :
-case 174 :
-{
-  P1 = I31(4, 5);
-  P2 = I31(4, 7);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-} break;
-case 47 :
-case 175 :
-{
-  P1 = I31(4, 5);
-  P2 = I31(4, 7);
-  P3 = I211(4, 5, 7);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 56 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-} break;
-case 57 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-} break;
-case 58 :
-{
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 59 :
-{
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 60 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-} break;
-case 61 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-} break;
-case 62 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 63 :
-{
-  P2 = I31(4, 7);
-  P3 = I31(4, 8);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 64 :
-case 65 :
-case 68 :
-case 69 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 67 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 70 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 71 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 8);
-} break;
-case 72 :
-case 76 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-} break;
-case 73 :
-case 77 :
-{
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P0 = I31(4, 1);
-    P2 = I31(4, 6);
-  } else {
-    P0 = I521(4, 3, 1);
-    P2 = I332(3, 7, 4);
-  }
-} break;
-case 74 :
-case 107 :
-case 123 :
-{
-  P1 = I31(4, 2);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 78 :
-{
-  P1 = I31(4, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-} break;
-case 79 :
-{
-  P1 = I31(4, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 80 :
-case 81 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 82 :
-case 214 :
-case 222 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 83 :
-{
-  P0 = I31(4, 3);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 84 :
-case 85 :
-{
-  P0 = I211(4, 1, 3);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P1 = I31(4, 1);
-    P3 = I31(4, 8);
-  } else {
-    P1 = I521(4, 5, 1);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 87 :
-{
-  P0 = I31(4, 3);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 88 :
-case 248 :
-case 250 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 89 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-} break;
-case 90 :
-{
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 91 :
-{
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 92 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-} break;
-case 93 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-} break;
-case 94 :
-{
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 96 :
-case 97 :
-case 100 :
-case 101 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-} break;
-case 98 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-} break;
-case 99 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-} break;
-case 102 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-} break;
-case 103 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-} break;
-case 104 :
-case 108 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-} break;
-case 105 :
-case 109 :
-{
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P0 = I31(4, 1);
-    P2 = IC(4);
-  } else {
-    P0 = I521(4, 3, 1);
-    P2 = I332(3, 7, 4);
-  }
-} break;
-case 106 :
-case 120 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-} break;
-case 110 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-} break;
-case 111 :
-{
-  P1 = I31(4, 5);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 112 :
-case 113 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  if (MDR) {
-    P2 = I31(4, 3);
-    P3 = I31(4, 8);
-  } else {
-    P2 = I521(4, 7, 3);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 114 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 115 :
-{
-  P0 = I31(4, 3);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 116 :
-case 117 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 1);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-} break;
-case 118 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 119 :
-{
-  P2 = I31(4, 3);
-  P3 = I31(4, 8);
-  if (MUR) {
-    P0 = I31(4, 3);
-    P1 = IC(4);
-  } else {
-    P0 = I521(4, 1, 3);
-    P1 = I332(1, 5, 4);
-  }
-} break;
-case 121 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-} break;
-case 122 :
-{
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = I31(4, 8);
-  } else {
-    P3 = I611(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 124 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-} break;
-case 125 :
-{
-  P1 = I31(4, 1);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P0 = I31(4, 1);
-    P2 = IC(4);
-  } else {
-    P0 = I521(4, 3, 1);
-    P2 = I332(3, 7, 4);
-  }
-} break;
-case 126 :
-{
-  P0 = I31(4, 0);
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 127 :
-{
-  P3 = I31(4, 8);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 144 :
-case 145 :
-case 176 :
-case 177 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 7);
-} break;
-case 146 :
-case 178 :
-{
-  P0 = I31(4, 0);
-  P2 = I211(4, 3, 7);
-  if (MUR) {
-    P1 = I31(4, 2);
-    P3 = I31(4, 7);
-  } else {
-    P1 = I332(1, 5, 4);
-    P3 = I521(4, 5, 7);
-  }
-} break;
-case 147 :
-case 179 :
-{
-  P0 = I31(4, 3);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 7);
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 148 :
-case 149 :
-case 180 :
-case 181 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 1);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 7);
-} break;
-case 150 :
-case 182 :
-{
-  P0 = I31(4, 0);
-  P2 = I211(4, 3, 7);
-  if (MUR) {
-    P1 = IC(4);
-    P3 = I31(4, 7);
-  } else {
-    P1 = I332(1, 5, 4);
-    P3 = I521(4, 5, 7);
-  }
-} break;
-case 151 :
-case 183 :
-{
-  P0 = I31(4, 3);
-  P2 = I211(4, 3, 7);
-  P3 = I31(4, 7);
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 152 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-} break;
-case 153 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-} break;
-case 154 :
-{
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 155 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 156 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-} break;
-case 157 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-} break;
-case 158 :
-{
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 159 :
-{
-  P2 = I31(4, 6);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 184 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-} break;
-case 185 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-} break;
-case 186 :
-{
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 187 :
-{
-  P1 = I31(4, 2);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = IC(4);
-    P2 = I31(4, 7);
-  } else {
-    P0 = I332(1, 3, 4);
-    P2 = I521(4, 3, 7);
-  }
-} break;
-case 188 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-} break;
-case 189 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-} break;
-case 190 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 7);
-  if (MUR) {
-    P1 = IC(4);
-    P3 = I31(4, 7);
-  } else {
-    P1 = I332(1, 5, 4);
-    P3 = I521(4, 5, 7);
-  }
-} break;
-case 191 :
-{
-  P2 = I31(4, 7);
-  P3 = I31(4, 7);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 192 :
-case 193 :
-case 196 :
-case 197 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-} break;
-case 194 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-} break;
-case 195 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-} break;
-case 198 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-} break;
-case 199 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 5);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-} break;
-case 200 :
-case 204 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  if (MDL) {
-    P2 = I31(4, 6);
-    P3 = I31(4, 5);
-  } else {
-    P2 = I332(3, 7, 4);
-    P3 = I521(4, 7, 5);
-  }
-} break;
-case 201 :
-case 205 :
-{
-  P0 = I31(4, 1);
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-} break;
-case 202 :
-{
-  P1 = I31(4, 2);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-} break;
-case 203 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 206 :
-{
-  P1 = I31(4, 5);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-} break;
-case 207 :
-{
-  P2 = I31(4, 6);
-  P3 = I31(4, 5);
-  if (MUL) {
-    P0 = IC(4);
-    P1 = I31(4, 5);
-  } else {
-    P0 = I332(1, 3, 4);
-    P1 = I521(4, 1, 5);
-  }
-} break;
-case 208 :
-case 209 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 210 :
-case 216 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 211 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 212 :
-case 213 :
-{
-  P0 = I211(4, 1, 3);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P1 = I31(4, 1);
-    P3 = IC(4);
-  } else {
-    P1 = I521(4, 5, 1);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 215 :
-{
-  P0 = I31(4, 3);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 217 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 218 :
-{
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 219 :
-{
-  P1 = I31(4, 2);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 220 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  if (MDL) {
-    P2 = I31(4, 6);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 221 :
-{
-  P0 = I31(4, 1);
-  P2 = I31(4, 6);
-  if (MDR) {
-    P1 = I31(4, 1);
-    P3 = IC(4);
-  } else {
-    P1 = I521(4, 5, 1);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 223 :
-{
-  P2 = I31(4, 6);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 224 :
-case 225 :
-case 228 :
-case 229 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I211(4, 1, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 5);
-} break;
-case 226 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 2);
-  P2 = I31(4, 3);
-  P3 = I31(4, 5);
-} break;
-case 227 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  P2 = I31(4, 3);
-  P3 = I31(4, 5);
-} break;
-case 230 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 5);
-} break;
-case 231 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 5);
-  P2 = I31(4, 3);
-  P3 = I31(4, 5);
-} break;
-case 232 :
-case 236 :
-{
-  P0 = I31(4, 0);
-  P1 = I211(4, 1, 5);
-  if (MDL) {
-    P2 = IC(4);
-    P3 = I31(4, 5);
-  } else {
-    P2 = I332(3, 7, 4);
-    P3 = I521(4, 7, 5);
-  }
-} break;
-case 233 :
-case 237 :
-{
-  P0 = I31(4, 1);
-  P1 = I211(4, 1, 5);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-} break;
-case 234 :
-{
-  P1 = I31(4, 2);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = I31(4, 0);
-  } else {
-    P0 = I611(4, 1, 3);
-  }
-} break;
-case 235 :
-{
-  P1 = I31(4, 2);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 238 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 5);
-  if (MDL) {
-    P2 = IC(4);
-    P3 = I31(4, 5);
-  } else {
-    P2 = I332(3, 7, 4);
-    P3 = I521(4, 7, 5);
-  }
-} break;
-case 239 :
-{
-  P1 = I31(4, 5);
-  P3 = I31(4, 5);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 240 :
-case 241 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 2);
-  if (MDR) {
-    P2 = I31(4, 3);
-    P3 = IC(4);
-  } else {
-    P2 = I521(4, 7, 3);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 242 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = I31(4, 2);
-  } else {
-    P1 = I611(4, 1, 5);
-  }
-} break;
-case 243 :
-{
-  P0 = I31(4, 3);
-  P1 = I31(4, 2);
-  if (MDR) {
-    P2 = I31(4, 3);
-    P3 = IC(4);
-  } else {
-    P2 = I521(4, 7, 3);
-    P3 = I332(5, 7, 4);
-  }
-} break;
-case 244 :
-case 245 :
-{
-  P0 = I211(4, 1, 3);
-  P1 = I31(4, 1);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-} break;
-case 246 :
-{
-  P0 = I31(4, 0);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 247 :
-{
-  P0 = I31(4, 3);
-  P2 = I31(4, 3);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 249 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 2);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-} break;
-case 251 :
-{
-  P1 = I31(4, 2);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 252 :
-{
-  P0 = I31(4, 0);
-  P1 = I31(4, 1);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-} break;
-case 253 :
-{
-  P0 = I31(4, 1);
-  P1 = I31(4, 1);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-} break;
-case 254 :
-{
-  P0 = I31(4, 0);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 255 :
-{
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
diff --git a/src/sdl12/filter/interp.h b/src/sdl12/filter/interp.h
deleted file mode 100644
index e994387fb8d402e5a7b92bbd6bd77e5bdecfca78..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/interp.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * This file is part of the Advance project.
- *
- * Copyright (C) 2003 Andrea Mazzoleni
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * In addition, as a special exception, Andrea Mazzoleni
- * gives permission to link the code of this program with
- * the MAME library (or with modified versions of MAME that use the
- * same license as MAME), and distribute linked combinations including
- * the two.  You must obey the GNU General Public License in all
- * respects for all of the code used other than MAME.  If you modify
- * this file, you may extend this exception to your version of the
- * file, but you are not obligated to do so.  If you do not wish to
- * do so, delete this exception statement from your version.
- */
-
-#ifndef __INTERP_H
-#define __INTERP_H
-
-/***************************************************************************/
-/* Basic types */
-
-/***************************************************************************/
-/* interpolation */
-
-static Uint32 interp_mask[2] = {0xF81F,0x07E0};
-static Uint32 interp_bits_per_pixel = 16;
-
-#define INTERP_16_MASK_1(v) (v & interp_mask[0])
-#define INTERP_16_MASK_2(v) (v & interp_mask[1])
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_521(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*2 + INTERP_16_MASK_1(p3)*1) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*2 + INTERP_16_MASK_2(p3)*1) / 8));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_332(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)*2) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)*2) / 8));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_611(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*6 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*6 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 8));
-}
-
-/*
-FUNCINLINE static ATTRINLINE Uint16 interp_16_71(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*7 + INTERP_16_MASK_1(p2)) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*7 + INTERP_16_MASK_2(p2)) / 8));
-}
-*/
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_211(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*2 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 4)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*2 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 4));
-}
-
-/*
-FUNCINLINE static ATTRINLINE Uint16 interp_16_772(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1(((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2))*7 + INTERP_16_MASK_1(p3)*2) / 16)
-    | INTERP_16_MASK_2(((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2))*7 + INTERP_16_MASK_2(p3)*2) / 16));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_11(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1) + INTERP_16_MASK_1(p2)) / 2)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1) + INTERP_16_MASK_2(p2)) / 2));
-}
-*/
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_31(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*3 + INTERP_16_MASK_1(p2)) / 4)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*3 + INTERP_16_MASK_2(p2)) / 4));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_1411(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*14 + INTERP_16_MASK_1(p2) + INTERP_16_MASK_1(p3)) / 16)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*14 + INTERP_16_MASK_2(p2) + INTERP_16_MASK_2(p3)) / 16));
-}
-
-/*
-FUNCINLINE static ATTRINLINE Uint16 interp_16_431(Uint16 p1, Uint16 p2, Uint16 p3)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*4 + INTERP_16_MASK_1(p2)*3 + INTERP_16_MASK_1(p3)) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*4 + INTERP_16_MASK_2(p2)*3 + INTERP_16_MASK_2(p3)) / 8));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_53(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*5 + INTERP_16_MASK_1(p2)*3) / 8)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*5 + INTERP_16_MASK_2(p2)*3) / 8));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_151(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*15 + INTERP_16_MASK_1(p2)) / 16)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*15 + INTERP_16_MASK_2(p2)) / 16));
-}
-
-FUNCINLINE static ATTRINLINE Uint16 interp_16_97(Uint16 p1, Uint16 p2)
-{
-  return (Uint16)(INTERP_16_MASK_1((INTERP_16_MASK_1(p1)*9 + INTERP_16_MASK_1(p2)*7) / 16)
-    | INTERP_16_MASK_2((INTERP_16_MASK_2(p1)*9 + INTERP_16_MASK_2(p2)*7) / 16));
-}
-*/
-
-#define INTERP_32_MASK_1(v) (v & 0xFF00FF)
-#define INTERP_32_MASK_2(v) (v & 0x00FF00)
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_521(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*2 + INTERP_32_MASK_1(p3)*1) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*2 + INTERP_32_MASK_2(p3)*1) / 8);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_332(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)*2) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)*2) / 8);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_211(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*2 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 4)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*2 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 4);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_611(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*6 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*6 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 8);
-}
-
-/*
-FUNCINLINE static ATTRINLINE Uint32 interp_32_71(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*7 + INTERP_32_MASK_1(p2)) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*7 + INTERP_32_MASK_2(p2)) / 8);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_772(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1(((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2))*7 + INTERP_32_MASK_1(p3)*2) / 16)
-    | INTERP_32_MASK_2(((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2))*7 + INTERP_32_MASK_2(p3)*2) / 16);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_11(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1) + INTERP_32_MASK_1(p2)) / 2)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1) + INTERP_32_MASK_2(p2)) / 2);
-}
-*/
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_31(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*3 + INTERP_32_MASK_1(p2)) / 4)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*3 + INTERP_32_MASK_2(p2)) / 4);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_1411(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*14 + INTERP_32_MASK_1(p2) + INTERP_32_MASK_1(p3)) / 16)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*14 + INTERP_32_MASK_2(p2) + INTERP_32_MASK_2(p3)) / 16);
-}
-
-/*
-FUNCINLINE static ATTRINLINE Uint32 interp_32_431(Uint32 p1, Uint32 p2, Uint32 p3)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*4 + INTERP_32_MASK_1(p2)*3 + INTERP_32_MASK_1(p3)) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*4 + INTERP_32_MASK_2(p2)*3 + INTERP_32_MASK_2(p3)) / 8);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_53(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*5 + INTERP_32_MASK_1(p2)*3) / 8)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*5 + INTERP_32_MASK_2(p2)*3) / 8);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_151(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*15 + INTERP_32_MASK_1(p2)) / 16)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*15 + INTERP_32_MASK_2(p2)) / 16);
-}
-
-FUNCINLINE static ATTRINLINE Uint32 interp_32_97(Uint32 p1, Uint32 p2)
-{
-  return INTERP_32_MASK_1((INTERP_32_MASK_1(p1)*9 + INTERP_32_MASK_1(p2)*7) / 16)
-    | INTERP_32_MASK_2((INTERP_32_MASK_2(p1)*9 + INTERP_32_MASK_2(p2)*7) / 16);
-}
-*/
-
-/***************************************************************************/
-/* diff */
-
-#define INTERP_Y_LIMIT (0x30*4)
-#define INTERP_U_LIMIT (0x07*4)
-#define INTERP_V_LIMIT (0x06*8)
-
-static int interp_16_diff(Uint16 p1, Uint16 p2)
-{
-  int r, g, b;
-  int y, u, v;
-
-  if (p1 == p2)
-    return 0;
-
-  if (interp_bits_per_pixel == 16) {
-    b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3;
-    g = (int)((p1 & 0x7E0) - (p2 & 0x7E0)) >> 3;
-    r = (int)((p1 & 0xF800) - (p2 & 0xF800)) >> 8;
-  } else {
-    b = (int)((p1 & 0x1F) - (p2 & 0x1F)) << 3;
-    g = (int)((p1 & 0x3E0) - (p2 & 0x3E0)) >> 2;
-    r = (int)((p1 & 0x7C00) - (p2 & 0x7C00)) >> 7;
-  }
-
-  y = r + g + b;
-  u = r - b;
-  v = -r + 2*g - b;
-
-  if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT)
-    return 1;
-
-  if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT)
-    return 1;
-
-  if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT)
-    return 1;
-
-  return 0;
-}
-
-static int interp_32_diff(Uint32 p1, Uint32 p2)
-{
-  int r, g, b;
-  int y, u, v;
-
-  if ((p1 & 0xF8F8F8) == (p2 & 0xF8F8F8))
-    return 0;
-
-  b = (int)((p1 & 0xFF) - (p2 & 0xFF));
-  g = (int)((p1 & 0xFF00) - (p2 & 0xFF00)) >> 8;
-  r = (int)((p1 & 0xFF0000) - (p2 & 0xFF0000)) >> 16;
-
-  y = r + g + b;
-  u = r - b;
-  v = -r + 2*g - b;
-
-  if (y < -INTERP_Y_LIMIT || y > INTERP_Y_LIMIT)
-    return 1;
-
-  if (u < -INTERP_U_LIMIT || u > INTERP_U_LIMIT)
-    return 1;
-
-  if (v < -INTERP_V_LIMIT || v > INTERP_V_LIMIT)
-    return 1;
-
-  return 0;
-}
-
-/*
-static void interp_set(Uint32 bits_per_pixel)
-{
-  interp_bits_per_pixel = bits_per_pixel;
-
-  switch (bits_per_pixel) {
-  case 15 :
-    interp_mask[0] = 0x7C1F;
-    interp_mask[1] = 0x03E0;
-    break;
-  case 16 :
-    interp_mask[0] = 0xF81F;
-    interp_mask[1] = 0x07E0;
-    break;
-  case 32 :
-    interp_mask[0] = 0xFF00FF;
-    interp_mask[1] = 0x00FF00;
-    break;
-  }
-}
-*/
-
-#endif
diff --git a/src/sdl12/filter/lq2x.c b/src/sdl12/filter/lq2x.c
deleted file mode 100644
index 8d06fa8ccae45a19922bd1768f084d40087d4aac..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/lq2x.c
+++ /dev/null
@@ -1,564 +0,0 @@
-#include "filters.h"
-#include "interp.h"
-
-static void hq2x_16_def(Uint16* dst0, Uint16* dst1, const Uint16* src0, const Uint16* src1, const Uint16* src2, Uint32 count)
-{
-  Uint32 i;
-
-  for(i=0;i<count;++i) {
-    Uint8 mask;
-
-    Uint16 c[9];
-
-    c[1] = src0[0];
-    c[4] = src1[0];
-    c[7] = src2[0];
-
-    if (i>0) {
-      c[0] = src0[-1];
-      c[3] = src1[-1];
-      c[6] = src2[-1];
-    } else {
-      c[0] = c[1];
-      c[3] = c[4];
-      c[6] = c[7];
-    }
-
-    if (i<count-1) {
-      c[2] = src0[1];
-      c[5] = src1[1];
-      c[8] = src2[1];
-    } else {
-      c[2] = c[1];
-      c[5] = c[4];
-      c[8] = c[7];
-    }
-
-    mask = 0;
-
-    if (interp_16_diff(c[0], c[4]))
-      mask |= 1 << 0;
-    if (interp_16_diff(c[1], c[4]))
-      mask |= 1 << 1;
-    if (interp_16_diff(c[2], c[4]))
-      mask |= 1 << 2;
-    if (interp_16_diff(c[3], c[4]))
-      mask |= 1 << 3;
-    if (interp_16_diff(c[5], c[4]))
-      mask |= 1 << 4;
-    if (interp_16_diff(c[6], c[4]))
-      mask |= 1 << 5;
-    if (interp_16_diff(c[7], c[4]))
-      mask |= 1 << 6;
-    if (interp_16_diff(c[8], c[4]))
-      mask |= 1 << 7;
-
-#define P0 dst0[0]
-#define P1 dst0[1]
-#define P2 dst1[0]
-#define P3 dst1[1]
-#define MUR interp_16_diff(c[1], c[5])
-#define MDR interp_16_diff(c[5], c[7])
-#define MDL interp_16_diff(c[7], c[3])
-#define MUL interp_16_diff(c[3], c[1])
-#define IC(p0) c[p0]
-#define I11(p0,p1) interp_16_11(c[p0], c[p1])
-#define I211(p0,p1,p2) interp_16_211(c[p0], c[p1], c[p2])
-#define I31(p0,p1) interp_16_31(c[p0], c[p1])
-#define I332(p0,p1,p2) interp_16_332(c[p0], c[p1], c[p2])
-#define I431(p0,p1,p2) interp_16_431(c[p0], c[p1], c[p2])
-#define I521(p0,p1,p2) interp_16_521(c[p0], c[p1], c[p2])
-#define I53(p0,p1) interp_16_53(c[p0], c[p1])
-#define I611(p0,p1,p2) interp_16_611(c[p0], c[p1], c[p2])
-#define I71(p0,p1) interp_16_71(c[p0], c[p1])
-#define I772(p0,p1,p2) interp_16_772(c[p0], c[p1], c[p2])
-#define I97(p0,p1) interp_16_97(c[p0], c[p1])
-#define I1411(p0,p1,p2) interp_16_1411(c[p0], c[p1], c[p2])
-#define I151(p0,p1) interp_16_151(c[p0], c[p1])
-
-    switch (mask) {
-#include "hq2x.h"
-    }
-
-#undef P0
-#undef P1
-#undef P2
-#undef P3
-#undef MUR
-#undef MDR
-#undef MDL
-#undef MUL
-#undef IC
-#undef I11
-#undef I211
-#undef I31
-#undef I332
-#undef I431
-#undef I521
-#undef I53
-#undef I611
-#undef I71
-#undef I772
-#undef I97
-#undef I1411
-#undef I151
-
-    src0 += 1;
-    src1 += 1;
-    src2 += 1;
-    dst0 += 2;
-    dst1 += 2;
-  }
-}
-
-static void hq2x_32_def(Uint32* dst0, Uint32* dst1, const Uint32* src0, const Uint32* src1, const Uint32* src2, Uint32 count)
-{
-  Uint32 i;
-
-  for(i=0;i<count;++i) {
-    Uint8 mask;
-
-    Uint32 c[9];
-
-    c[1] = src0[0];
-    c[4] = src1[0];
-    c[7] = src2[0];
-
-    if (i>0) {
-      c[0] = src0[-1];
-      c[3] = src1[-1];
-      c[6] = src2[-1];
-    } else {
-      c[0] = c[1];
-      c[3] = c[4];
-      c[6] = c[7];
-    }
-
-    if (i<count-1) {
-      c[2] = src0[1];
-      c[5] = src1[1];
-      c[8] = src2[1];
-    } else {
-      c[2] = c[1];
-      c[5] = c[4];
-      c[8] = c[7];
-    }
-
-    mask = 0;
-
-    if (interp_32_diff(c[0], c[4]))
-      mask |= 1 << 0;
-    if (interp_32_diff(c[1], c[4]))
-      mask |= 1 << 1;
-    if (interp_32_diff(c[2], c[4]))
-      mask |= 1 << 2;
-    if (interp_32_diff(c[3], c[4]))
-      mask |= 1 << 3;
-    if (interp_32_diff(c[5], c[4]))
-      mask |= 1 << 4;
-    if (interp_32_diff(c[6], c[4]))
-      mask |= 1 << 5;
-    if (interp_32_diff(c[7], c[4]))
-      mask |= 1 << 6;
-    if (interp_32_diff(c[8], c[4]))
-      mask |= 1 << 7;
-
-#define P0 dst0[0]
-#define P1 dst0[1]
-#define P2 dst1[0]
-#define P3 dst1[1]
-#define MUR interp_32_diff(c[1], c[5])
-#define MDR interp_32_diff(c[5], c[7])
-#define MDL interp_32_diff(c[7], c[3])
-#define MUL interp_32_diff(c[3], c[1])
-#define IC(p0) c[p0]
-#define I11(p0,p1) interp_32_11(c[p0], c[p1])
-#define I211(p0,p1,p2) interp_32_211(c[p0], c[p1], c[p2])
-#define I31(p0,p1) interp_32_31(c[p0], c[p1])
-#define I332(p0,p1,p2) interp_32_332(c[p0], c[p1], c[p2])
-#define I431(p0,p1,p2) interp_32_431(c[p0], c[p1], c[p2])
-#define I521(p0,p1,p2) interp_32_521(c[p0], c[p1], c[p2])
-#define I53(p0,p1) interp_32_53(c[p0], c[p1])
-#define I611(p0,p1,p2) interp_32_611(c[p0], c[p1], c[p2])
-#define I71(p0,p1) interp_32_71(c[p0], c[p1])
-#define I772(p0,p1,p2) interp_32_772(c[p0], c[p1], c[p2])
-#define I97(p0,p1) interp_32_97(c[p0], c[p1])
-#define I1411(p0,p1,p2) interp_32_1411(c[p0], c[p1], c[p2])
-#define I151(p0,p1) interp_32_151(c[p0], c[p1])
-
-    switch (mask) {
-#include "hq2x.h"
-    }
-
-#undef P0
-#undef P1
-#undef P2
-#undef P3
-#undef MUR
-#undef MDR
-#undef MDL
-#undef MUL
-#undef IC
-#undef I11
-#undef I211
-#undef I31
-#undef I332
-#undef I431
-#undef I521
-#undef I53
-#undef I611
-#undef I71
-#undef I772
-#undef I97
-#undef I1411
-#undef I151
-
-    src0 += 1;
-    src1 += 1;
-    src2 += 1;
-    dst0 += 2;
-    dst1 += 2;
-  }
-}
-
-/***************************************************************************/
-/* LQ2x C implementation */
-
-/*
- * This effect is derived from the hq2x effect made by Maxim Stepin
- */
-
-static void lq2x_16_def(Uint16* dst0, Uint16* dst1, const Uint16* src0, const Uint16* src1, const Uint16* src2, Uint32 count)
-{
-  Uint32 i;
-
-  for(i=0;i<count;++i) {
-    Uint8 mask;
-
-    Uint16 c[9];
-
-    c[1] = src0[0];
-    c[4] = src1[0];
-    c[7] = src2[0];
-
-    if (i>0) {
-      c[0] = src0[-1];
-      c[3] = src1[-1];
-      c[6] = src2[-1];
-    } else {
-      c[0] = c[1];
-      c[3] = c[4];
-      c[6] = c[7];
-    }
-
-    if (i<count-1) {
-      c[2] = src0[1];
-      c[5] = src1[1];
-      c[8] = src2[1];
-    } else {
-      c[2] = c[1];
-      c[5] = c[4];
-      c[8] = c[7];
-    }
-
-    mask = 0;
-
-    if (c[0] != c[4])
-      mask |= 1 << 0;
-    if (c[1] != c[4])
-      mask |= 1 << 1;
-    if (c[2] != c[4])
-      mask |= 1 << 2;
-    if (c[3] != c[4])
-      mask |= 1 << 3;
-    if (c[5] != c[4])
-      mask |= 1 << 4;
-    if (c[6] != c[4])
-      mask |= 1 << 5;
-    if (c[7] != c[4])
-      mask |= 1 << 6;
-    if (c[8] != c[4])
-      mask |= 1 << 7;
-
-#define P0 dst0[0]
-#define P1 dst0[1]
-#define P2 dst1[0]
-#define P3 dst1[1]
-#define MUR (c[1] != c[5])
-#define MDR (c[5] != c[7])
-#define MDL (c[7] != c[3])
-#define MUL (c[3] != c[1])
-#define IC(p0) c[p0]
-#define I11(p0,p1) interp_16_11(c[p0], c[p1])
-#define I211(p0,p1,p2) interp_16_211(c[p0], c[p1], c[p2])
-#define I31(p0,p1) interp_16_31(c[p0], c[p1])
-#define I332(p0,p1,p2) interp_16_332(c[p0], c[p1], c[p2])
-#define I431(p0,p1,p2) interp_16_431(c[p0], c[p1], c[p2])
-#define I521(p0,p1,p2) interp_16_521(c[p0], c[p1], c[p2])
-#define I53(p0,p1) interp_16_53(c[p0], c[p1])
-#define I611(p0,p1,p2) interp_16_611(c[p0], c[p1], c[p2])
-#define I71(p0,p1) interp_16_71(c[p0], c[p1])
-#define I772(p0,p1,p2) interp_16_772(c[p0], c[p1], c[p2])
-#define I97(p0,p1) interp_16_97(c[p0], c[p1])
-#define I1411(p0,p1,p2) interp_16_1411(c[p0], c[p1], c[p2])
-#define I151(p0,p1) interp_16_151(c[p0], c[p1])
-
-    switch (mask) {
-#include "lq2x.h"
-    }
-
-#undef P0
-#undef P1
-#undef P2
-#undef P3
-#undef MUR
-#undef MDR
-#undef MDL
-#undef MUL
-#undef IC
-#undef I11
-#undef I211
-#undef I31
-#undef I332
-#undef I431
-#undef I521
-#undef I53
-#undef I611
-#undef I71
-#undef I772
-#undef I97
-#undef I1411
-#undef I151
-
-    src0 += 1;
-    src1 += 1;
-    src2 += 1;
-    dst0 += 2;
-    dst1 += 2;
-  }
-}
-
-static void lq2x_32_def(Uint32* dst0, Uint32* dst1, const Uint32* src0, const Uint32* src1, const Uint32* src2, Uint32 count)
-{
-  Uint32 i;
-
-  for(i=0;i<count;++i) {
-    Uint8 mask;
-
-    Uint32 c[9];
-
-    c[1] = src0[0];
-    c[4] = src1[0];
-    c[7] = src2[0];
-
-    if (i>0) {
-      c[0] = src0[-1];
-      c[3] = src1[-1];
-      c[6] = src2[-1];
-    } else {
-      c[0] = c[1];
-      c[3] = c[4];
-      c[6] = c[7];
-    }
-
-    if (i<count-1) {
-      c[2] = src0[1];
-      c[5] = src1[1];
-      c[8] = src2[1];
-    } else {
-      c[2] = c[1];
-      c[5] = c[4];
-      c[8] = c[7];
-    }
-
-    mask = 0;
-
-    if (c[0] != c[4])
-      mask |= 1 << 0;
-    if (c[1] != c[4])
-      mask |= 1 << 1;
-    if (c[2] != c[4])
-      mask |= 1 << 2;
-    if (c[3] != c[4])
-      mask |= 1 << 3;
-    if (c[5] != c[4])
-      mask |= 1 << 4;
-    if (c[6] != c[4])
-      mask |= 1 << 5;
-    if (c[7] != c[4])
-      mask |= 1 << 6;
-    if (c[8] != c[4])
-      mask |= 1 << 7;
-
-#define P0 dst0[0]
-#define P1 dst0[1]
-#define P2 dst1[0]
-#define P3 dst1[1]
-#define MUR (c[1] != c[5])
-#define MDR (c[5] != c[7])
-#define MDL (c[7] != c[3])
-#define MUL (c[3] != c[1])
-#define IC(p0) c[p0]
-#define I11(p0,p1) interp_32_11(c[p0], c[p1])
-#define I211(p0,p1,p2) interp_32_211(c[p0], c[p1], c[p2])
-#define I31(p0,p1) interp_32_31(c[p0], c[p1])
-#define I332(p0,p1,p2) interp_32_332(c[p0], c[p1], c[p2])
-#define I431(p0,p1,p2) interp_32_431(c[p0], c[p1], c[p2])
-#define I521(p0,p1,p2) interp_32_521(c[p0], c[p1], c[p2])
-#define I53(p0,p1) interp_32_53(c[p0], c[p1])
-#define I611(p0,p1,p2) interp_32_611(c[p0], c[p1], c[p2])
-#define I71(p0,p1) interp_32_71(c[p0], c[p1])
-#define I772(p0,p1,p2) interp_32_772(c[p0], c[p1], c[p2])
-#define I97(p0,p1) interp_32_97(c[p0], c[p1])
-#define I1411(p0,p1,p2) interp_32_1411(c[p0], c[p1], c[p2])
-#define I151(p0,p1) interp_32_151(c[p0], c[p1])
-
-    switch (mask) {
-#include "lq2x.h"
-    }
-
-#undef P0
-#undef P1
-#undef P2
-#undef P3
-#undef MUR
-#undef MDR
-#undef MDL
-#undef MUL
-#undef IC
-#undef I11
-#undef I211
-#undef I31
-#undef I332
-#undef I431
-#undef I521
-#undef I53
-#undef I611
-#undef I71
-#undef I772
-#undef I97
-#undef I1411
-#undef I151
-
-    src0 += 1;
-    src1 += 1;
-    src2 += 1;
-    dst0 += 2;
-    dst1 += 2;
-  }
-}
-
-void hq2x16(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr,
-           Uint32 dstPitch, int width, int height)
-{
-  Uint16 *dst0 = (Uint16 *)dstPtr;
-  Uint16 *dst1 = dst0 + (dstPitch >> 1);
-
-  Uint16 *src0 = (Uint16 *)srcPtr;
-  Uint16 *src1 = src0 + (srcPitch >> 1);
-  Uint16 *src2 = src1 + (srcPitch >> 1);
-  int count = height-2;
-
-  hq2x_16_def(dst0, dst1, src0, src0, src1, width);
-
-  while(count) {
-    dst0 += dstPitch;
-    dst1 += dstPitch;
-    hq2x_16_def(dst0, dst1, src0, src1, src2, width);
-    src0 = src1;
-    src1 = src2;
-    src2 += srcPitch >> 1;
-    --count;
-  }
-  dst0 += dstPitch;
-  dst1 += dstPitch;
-  hq2x_16_def(dst0, dst1, src0, src1, src1, width);
-}
-
-void hq2x32(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr,
-             Uint32 dstPitch, int width, int height)
-{
-  Uint32 *dst0 = (Uint32 *)dstPtr;
-  Uint32 *dst1 = dst0 + (dstPitch >> 2);
-
-  Uint32 *src0 = (Uint32 *)srcPtr;
-  Uint32 *src1 = src0 + (srcPitch >> 2);
-  Uint32 *src2 = src1 + (srcPitch >> 2);
-  int count = height-2;
-
-  hq2x_32_def(dst0, dst1, src0, src0, src1, width);
-
-  while(count) {
-    dst0 += dstPitch >> 1;
-    dst1 += dstPitch >> 1;
-    hq2x_32_def(dst0, dst1, src0, src1, src2, width);
-    src0 = src1;
-    src1 = src2;
-    src2 += srcPitch >> 2;
-    --count;
-  }
-  dst0 += dstPitch >> 1;
-  dst1 += dstPitch >> 1;
-  hq2x_32_def(dst0, dst1, src0, src1, src1, width);
-}
-
-void lq2x16(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr,
-           Uint32 dstPitch, int width, int height)
-{
-  Uint16 *dst0 = (Uint16 *)dstPtr;
-  Uint16 *dst1 = dst0 + (dstPitch >> 1);
-
-  Uint16 *src0 = (Uint16 *)srcPtr;
-  Uint16 *src1 = src0 + (srcPitch >> 1);
-  Uint16 *src2 = src1 + (srcPitch >> 1);
-  int count = height-2;
-
-  lq2x_16_def(dst0, dst1, src0, src0, src1, width);
-
-  while(count) {
-    dst0 += dstPitch;
-    dst1 += dstPitch;
-    lq2x_16_def(dst0, dst1, src0, src1, src2, width);
-    src0 = src1;
-    src1 = src2;
-    src2 += srcPitch >> 1;
-    --count;
-  }
-  dst0 += dstPitch;
-  dst1 += dstPitch;
-  lq2x_16_def(dst0, dst1, src0, src1, src1, width);
-}
-
-void lq2x32(Uint8 *srcPtr, Uint32 srcPitch, Uint8 *dstPtr,
-             Uint32 dstPitch, int width, int height)
-{
-  Uint32 *dst0 = (Uint32 *)dstPtr;
-  Uint32 *dst1 = dst0 + (dstPitch >> 2);
-
-  Uint32 *src0 = (Uint32 *)srcPtr;
-  Uint32 *src1 = src0 + (srcPitch >> 2);
-  Uint32 *src2 = src1 + (srcPitch >> 2);
-  int count = height-2;
-
-  lq2x_32_def(dst0, dst1, src0, src0, src1, width);
-
-  while(count) {
-    dst0 += dstPitch >> 1;
-    dst1 += dstPitch >> 1;
-    lq2x_32_def(dst0, dst1, src0, src1, src2, width);
-    src0 = src1;
-    src1 = src2;
-    src2 += srcPitch >> 2;
-    --count;
-  }
-  dst0 += dstPitch >> 1;
-  dst1 += dstPitch >> 1;
-  lq2x_32_def(dst0, dst1, src0, src1, src1, width);
-}
-
-/*
-static inline void hq2x_init(Uint32 bits_per_pixel)
-{
-  interp_set(bits_per_pixel);
-}
-*/
diff --git a/src/sdl12/filter/lq2x.h b/src/sdl12/filter/lq2x.h
deleted file mode 100644
index 094c2b5aeef069bca6afb9efcb8ce270ea2b887a..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/lq2x.h
+++ /dev/null
@@ -1,1284 +0,0 @@
-case 0 :
-case 2 :
-case 4 :
-case 6 :
-case 8 :
-case 12 :
-case 16 :
-case 20 :
-case 24 :
-case 28 :
-case 32 :
-case 34 :
-case 36 :
-case 38 :
-case 40 :
-case 44 :
-case 48 :
-case 52 :
-case 56 :
-case 60 :
-case 64 :
-case 66 :
-case 68 :
-case 70 :
-case 96 :
-case 98 :
-case 100 :
-case 102 :
-case 128 :
-case 130 :
-case 132 :
-case 134 :
-case 136 :
-case 140 :
-case 144 :
-case 148 :
-case 152 :
-case 156 :
-case 160 :
-case 162 :
-case 164 :
-case 166 :
-case 168 :
-case 172 :
-case 176 :
-case 180 :
-case 184 :
-case 188 :
-case 192 :
-case 194 :
-case 196 :
-case 198 :
-case 224 :
-case 226 :
-case 228 :
-case 230 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  P2 = IC(0);
-  P3 = IC(0);
-} break;
-case 1 :
-case 5 :
-case 9 :
-case 13 :
-case 17 :
-case 21 :
-case 25 :
-case 29 :
-case 33 :
-case 37 :
-case 41 :
-case 45 :
-case 49 :
-case 53 :
-case 57 :
-case 61 :
-case 65 :
-case 69 :
-case 97 :
-case 101 :
-case 129 :
-case 133 :
-case 137 :
-case 141 :
-case 145 :
-case 149 :
-case 153 :
-case 157 :
-case 161 :
-case 165 :
-case 169 :
-case 173 :
-case 177 :
-case 181 :
-case 185 :
-case 189 :
-case 193 :
-case 197 :
-case 225 :
-case 229 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P2 = IC(1);
-  P3 = IC(1);
-} break;
-case 3 :
-case 35 :
-case 67 :
-case 99 :
-case 131 :
-case 163 :
-case 195 :
-case 227 :
-{
-  P0 = IC(2);
-  P1 = IC(2);
-  P2 = IC(2);
-  P3 = IC(2);
-} break;
-case 7 :
-case 39 :
-case 71 :
-case 103 :
-case 135 :
-case 167 :
-case 199 :
-case 231 :
-{
-  P0 = IC(3);
-  P1 = IC(3);
-  P2 = IC(3);
-  P3 = IC(3);
-} break;
-case 10 :
-case 138 :
-{
-  P1 = IC(0);
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I211(0, 1, 3);
-  }
-} break;
-case 11 :
-case 27 :
-case 75 :
-case 139 :
-case 155 :
-case 203 :
-{
-  P1 = IC(2);
-  P2 = IC(2);
-  P3 = IC(2);
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-} break;
-case 14 :
-case 142 :
-{
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-    P1 = IC(0);
-  } else {
-    P0 = I332(1, 3, 0);
-    P1 = I31(0, 1);
-  }
-} break;
-case 15 :
-case 143 :
-case 207 :
-{
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-    P1 = IC(4);
-  } else {
-    P0 = I332(1, 3, 4);
-    P1 = I31(4, 1);
-  }
-} break;
-case 18 :
-case 22 :
-case 30 :
-case 50 :
-case 54 :
-case 62 :
-case 86 :
-case 118 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 19 :
-case 51 :
-{
-  P2 = IC(2);
-  P3 = IC(2);
-  if (MUR) {
-    P0 = IC(2);
-    P1 = IC(2);
-  } else {
-    P0 = I31(2, 1);
-    P1 = I332(1, 5, 2);
-  }
-} break;
-case 23 :
-case 55 :
-case 119 :
-{
-  P2 = IC(3);
-  P3 = IC(3);
-  if (MUR) {
-    P0 = IC(3);
-    P1 = IC(3);
-  } else {
-    P0 = I31(3, 1);
-    P1 = I332(1, 5, 3);
-  }
-} break;
-case 26 :
-{
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I211(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 31 :
-case 95 :
-{
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 42 :
-case 170 :
-{
-  P1 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-    P2 = IC(0);
-  } else {
-    P0 = I332(1, 3, 0);
-    P2 = I31(0, 3);
-  }
-} break;
-case 43 :
-case 171 :
-case 187 :
-{
-  P1 = IC(2);
-  P3 = IC(2);
-  if (MUL) {
-    P0 = IC(2);
-    P2 = IC(2);
-  } else {
-    P0 = I332(1, 3, 2);
-    P2 = I31(2, 3);
-  }
-} break;
-case 46 :
-case 174 :
-{
-  P1 = IC(0);
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-} break;
-case 47 :
-case 175 :
-{
-  P1 = IC(4);
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 58 :
-case 154 :
-case 186 :
-{
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 59 :
-{
-  P2 = IC(2);
-  P3 = IC(2);
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(2);
-  } else {
-    P1 = I611(2, 1, 5);
-  }
-} break;
-case 63 :
-{
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 72 :
-case 76 :
-case 104 :
-case 106 :
-case 108 :
-case 110 :
-case 120 :
-case 124 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  P3 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-} break;
-case 73 :
-case 77 :
-case 105 :
-case 109 :
-case 125 :
-{
-  P1 = IC(1);
-  P3 = IC(1);
-  if (MDL) {
-    P0 = IC(1);
-    P2 = IC(1);
-  } else {
-    P0 = I31(1, 3);
-    P2 = I332(3, 7, 1);
-  }
-} break;
-case 74 :
-{
-  P1 = IC(0);
-  P3 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I211(0, 1, 3);
-  }
-} break;
-case 78 :
-case 202 :
-case 206 :
-{
-  P1 = IC(0);
-  P3 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-} break;
-case 79 :
-{
-  P1 = IC(4);
-  P3 = IC(4);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I611(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-} break;
-case 80 :
-case 208 :
-case 210 :
-case 216 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-} break;
-case 81 :
-case 209 :
-case 217 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P2 = IC(1);
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I211(1, 5, 7);
-  }
-} break;
-case 82 :
-case 214 :
-case 222 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 83 :
-case 115 :
-{
-  P0 = IC(2);
-  P2 = IC(2);
-  if (MDR) {
-    P3 = IC(2);
-  } else {
-    P3 = I611(2, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(2);
-  } else {
-    P1 = I611(2, 1, 5);
-  }
-} break;
-case 84 :
-case 212 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P1 = IC(0);
-    P3 = IC(0);
-  } else {
-    P1 = I31(0, 5);
-    P3 = I332(5, 7, 0);
-  }
-} break;
-case 85 :
-case 213 :
-case 221 :
-{
-  P0 = IC(1);
-  P2 = IC(1);
-  if (MDR) {
-    P1 = IC(1);
-    P3 = IC(1);
-  } else {
-    P1 = I31(1, 5);
-    P3 = I332(5, 7, 1);
-  }
-} break;
-case 87 :
-{
-  P0 = IC(3);
-  P2 = IC(3);
-  if (MDR) {
-    P3 = IC(3);
-  } else {
-    P3 = I611(3, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(3);
-  } else {
-    P1 = I211(3, 1, 5);
-  }
-} break;
-case 88 :
-case 248 :
-case 250 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-} break;
-case 89 :
-case 93 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I611(1, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I611(1, 5, 7);
-  }
-} break;
-case 90 :
-{
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 91 :
-{
-  if (MDL) {
-    P2 = IC(2);
-  } else {
-    P2 = I611(2, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(2);
-  } else {
-    P3 = I611(2, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(2);
-  } else {
-    P1 = I611(2, 1, 5);
-  }
-} break;
-case 92 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-} break;
-case 94 :
-{
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 107 :
-case 123 :
-{
-  P1 = IC(2);
-  P3 = IC(2);
-  if (MDL) {
-    P2 = IC(2);
-  } else {
-    P2 = I211(2, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-} break;
-case 111 :
-{
-  P1 = IC(4);
-  P3 = IC(4);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 112 :
-case 240 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDR) {
-    P2 = IC(0);
-    P3 = IC(0);
-  } else {
-    P2 = I31(0, 7);
-    P3 = I332(5, 7, 0);
-  }
-} break;
-case 113 :
-case 241 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  if (MDR) {
-    P2 = IC(1);
-    P3 = IC(1);
-  } else {
-    P2 = I31(1, 7);
-    P3 = I332(5, 7, 1);
-  }
-} break;
-case 114 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 116 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-} break;
-case 117 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P2 = IC(1);
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I611(1, 5, 7);
-  }
-} break;
-case 121 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I211(1, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I611(1, 5, 7);
-  }
-} break;
-case 122 :
-{
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I611(0, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 126 :
-{
-  P0 = IC(0);
-  P3 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 127 :
-{
-  P3 = IC(4);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I211(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I211(4, 1, 5);
-  }
-} break;
-case 146 :
-case 150 :
-case 178 :
-case 182 :
-case 190 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MUR) {
-    P1 = IC(0);
-    P3 = IC(0);
-  } else {
-    P1 = I332(1, 5, 0);
-    P3 = I31(0, 5);
-  }
-} break;
-case 147 :
-case 179 :
-{
-  P0 = IC(2);
-  P2 = IC(2);
-  P3 = IC(2);
-  if (MUR) {
-    P1 = IC(2);
-  } else {
-    P1 = I611(2, 1, 5);
-  }
-} break;
-case 151 :
-case 183 :
-{
-  P0 = IC(3);
-  P2 = IC(3);
-  P3 = IC(3);
-  if (MUR) {
-    P1 = IC(3);
-  } else {
-    P1 = I1411(3, 1, 5);
-  }
-} break;
-case 158 :
-{
-  P2 = IC(0);
-  P3 = IC(0);
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 159 :
-{
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 191 :
-{
-  P2 = IC(4);
-  P3 = IC(4);
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 200 :
-case 204 :
-case 232 :
-case 236 :
-case 238 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-    P3 = IC(0);
-  } else {
-    P2 = I332(3, 7, 0);
-    P3 = I31(0, 7);
-  }
-} break;
-case 201 :
-case 205 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P3 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I611(1, 3, 7);
-  }
-} break;
-case 211 :
-{
-  P0 = IC(2);
-  P1 = IC(2);
-  P2 = IC(2);
-  if (MDR) {
-    P3 = IC(2);
-  } else {
-    P3 = I211(2, 5, 7);
-  }
-} break;
-case 215 :
-{
-  P0 = IC(3);
-  P2 = IC(3);
-  if (MDR) {
-    P3 = IC(3);
-  } else {
-    P3 = I211(3, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(3);
-  } else {
-    P1 = I1411(3, 1, 5);
-  }
-} break;
-case 218 :
-{
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 219 :
-{
-  P1 = IC(2);
-  P2 = IC(2);
-  if (MDR) {
-    P3 = IC(2);
-  } else {
-    P3 = I211(2, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-} break;
-case 220 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I611(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-} break;
-case 223 :
-{
-  P2 = IC(4);
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I211(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I211(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
-case 233 :
-case 237 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P3 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I1411(1, 3, 7);
-  }
-} break;
-case 234 :
-{
-  P1 = IC(0);
-  P3 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(0);
-  } else {
-    P0 = I611(0, 1, 3);
-  }
-} break;
-case 235 :
-{
-  P1 = IC(2);
-  P3 = IC(2);
-  if (MDL) {
-    P2 = IC(2);
-  } else {
-    P2 = I1411(2, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-} break;
-case 239 :
-{
-  P1 = IC(4);
-  P3 = IC(4);
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-} break;
-case 242 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I211(0, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I611(0, 1, 5);
-  }
-} break;
-case 243 :
-{
-  P0 = IC(2);
-  P1 = IC(2);
-  if (MDR) {
-    P2 = IC(2);
-    P3 = IC(2);
-  } else {
-    P2 = I31(2, 7);
-    P3 = I332(5, 7, 2);
-  }
-} break;
-case 244 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I1411(0, 5, 7);
-  }
-} break;
-case 245 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  P2 = IC(1);
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I1411(1, 5, 7);
-  }
-} break;
-case 246 :
-{
-  P0 = IC(0);
-  P2 = IC(0);
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I1411(0, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 247 :
-{
-  P0 = IC(3);
-  P2 = IC(3);
-  if (MDR) {
-    P3 = IC(3);
-  } else {
-    P3 = I1411(3, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(3);
-  } else {
-    P1 = I1411(3, 1, 5);
-  }
-} break;
-case 249 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I1411(1, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I211(1, 5, 7);
-  }
-} break;
-case 251 :
-{
-  P1 = IC(2);
-  if (MDL) {
-    P2 = IC(2);
-  } else {
-    P2 = I1411(2, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(2);
-  } else {
-    P3 = I211(2, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(2);
-  } else {
-    P0 = I211(2, 1, 3);
-  }
-} break;
-case 252 :
-{
-  P0 = IC(0);
-  P1 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I1411(0, 5, 7);
-  }
-} break;
-case 253 :
-{
-  P0 = IC(1);
-  P1 = IC(1);
-  if (MDL) {
-    P2 = IC(1);
-  } else {
-    P2 = I1411(1, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(1);
-  } else {
-    P3 = I1411(1, 5, 7);
-  }
-} break;
-case 254 :
-{
-  P0 = IC(0);
-  if (MDL) {
-    P2 = IC(0);
-  } else {
-    P2 = I211(0, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(0);
-  } else {
-    P3 = I1411(0, 5, 7);
-  }
-  if (MUR) {
-    P1 = IC(0);
-  } else {
-    P1 = I211(0, 1, 5);
-  }
-} break;
-case 255 :
-{
-  if (MDL) {
-    P2 = IC(4);
-  } else {
-    P2 = I1411(4, 3, 7);
-  }
-  if (MDR) {
-    P3 = IC(4);
-  } else {
-    P3 = I1411(4, 5, 7);
-  }
-  if (MUL) {
-    P0 = IC(4);
-  } else {
-    P0 = I1411(4, 1, 3);
-  }
-  if (MUR) {
-    P1 = IC(4);
-  } else {
-    P1 = I1411(4, 1, 5);
-  }
-} break;
diff --git a/src/sdl12/filter/main.c b/src/sdl12/filter/main.c
deleted file mode 100644
index 98ab1541c9539eeb3473ea38d6c1df595e007da3..0000000000000000000000000000000000000000
--- a/src/sdl12/filter/main.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "filters.h"
-
-int main(int argc, char *argv[])
-{
-	SDL_Surface *src = NULL;
-	SDL_Surface *dst = NULL;
-	src = SDL_LoadBMP("src.bmp"); //load
-	if(!src) return -1; //check
-	dst = filter_2x(src, NULL, hq2x32); //prcoess
-	SDL_FreeSurface(src); //free
-	if(!dst) return 0; //error
-	SDL_SaveBMP(dst, "dst.bmp"); //save
-	SDL_FreeSurface(dst); //free
-	return 1; //good
-}
diff --git a/src/sdl12/hwsym_sdl.c b/src/sdl12/hwsym_sdl.c
deleted file mode 100644
index 54f5da3a083da6d9b3b9159b059389cbc7bc8271..0000000000000000000000000000000000000000
--- a/src/sdl12/hwsym_sdl.c
+++ /dev/null
@@ -1,185 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-/// \file
-/// \brief Tool for dynamic referencing of hardware rendering functions
-///
-///	Declaration and definition of the HW rendering
-///	functions do have the same name. Originally, the
-///	implementation was stored in a separate library.
-///	For SDL, we need some function to return the addresses,
-///	otherwise we have a conflict with the compiler.
-
-#include "hwsym_sdl.h"
-#include "../doomdef.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#ifdef HAVE_SDL
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#if defined (_XBOX) || defined (_arch_dreamcast) || defined(GP2X)
-#define NOLOADSO
-#endif
-
-#if SDL_VERSION_ATLEAST(1,2,6) && !defined (NOLOADSO)
-#include "SDL_loadso.h" // 1.2.6+
-#elif !defined (NOLOADSO)
-#define NOLOADSO
-#endif
-
-#define  _CREATE_DLL_  // necessary for Unix AND Windows
-
-#ifdef HWRENDER
-#include "../hardware/hw_drv.h"
-#include "ogl_sdl.h"
-#ifdef STATIC_OPENGL
-#include "../hardware/r_opengl/r_opengl.h"
-#endif
-#endif
-
-#ifdef HW3SOUND
-#include "../hardware/hw3dsdrv.h"
-#endif
-
-#define GETFUNC(func) \
-	else if (0 == strcmp(#func, funcName)) \
-		funcPointer = &func \
-//
-//
-/**	\brief	The *hwSym function
-
-	Stupid function to return function addresses
-
-	\param	funcName	the name of the function
-	\param	handle	an object to look in(NULL for self)
-
-	\return	void
-*/
-//
-void *hwSym(const char *funcName,void *handle)
-{
-	void *funcPointer = NULL;
-#ifdef HWRENDER
-	if (0 == strcmp("SetPalette", funcName))
-                funcPointer = &OglSdlSetPalette;
-	GETFUNC(Init);
-	GETFUNC(Draw2DLine);
-	GETFUNC(DrawPolygon);
-	GETFUNC(SetBlend);
-	GETFUNC(ClearBuffer);
-	GETFUNC(SetTexture);
-	GETFUNC(ReadRect);
-	GETFUNC(GClipRect);
-	GETFUNC(ClearMipMapCache);
-	GETFUNC(SetSpecialState);
-	GETFUNC(GetTextureUsed);
-	GETFUNC(DrawMD2);
-	GETFUNC(DrawMD2i);
-	GETFUNC(SetTransform);
-	GETFUNC(GetRenderVersion);
-#ifdef SHUFFLE
-	GETFUNC(PostImgRedraw);
-#endif //SHUFFLE
-	GETFUNC(StartScreenWipe);
-	GETFUNC(EndScreenWipe);
-	GETFUNC(DoScreenWipe);
-	GETFUNC(DrawIntermissionBG);
-	GETFUNC(MakeScreenTexture);
-	GETFUNC(MakeScreenFinalTexture);
-	GETFUNC(DrawScreenFinalTexture);
-#else //HWRENDER
-	if (0 == strcmp("FinishUpdate", funcName))
-		return funcPointer; //&FinishUpdate;
-#endif //!HWRENDER
-#ifdef STATIC3DS
-	GETFUNC(Startup);
-	GETFUNC(AddSfx);
-	GETFUNC(AddSource);
-	GETFUNC(StartSource);
-	GETFUNC(StopSource);
-	GETFUNC(GetHW3DSVersion);
-	GETFUNC(BeginFrameUpdate);
-	GETFUNC(EndFrameUpdate);
-	GETFUNC(IsPlaying);
-	GETFUNC(UpdateListener);
-	GETFUNC(UpdateSourceParms);
-	GETFUNC(SetGlobalSfxVolume);
-	GETFUNC(SetCone);
-	GETFUNC(Update3DSource);
-	GETFUNC(ReloadSource);
-	GETFUNC(KillSource);
-	GETFUNC(Shutdown);
-	GETFUNC(GetHW3DSTitle);
-#endif
-#ifdef NOLOADSO
-	else
-		funcPointer = handle;
-#else
-	else if (handle)
-		funcPointer = SDL_LoadFunction(handle,funcName);
-#endif
-	if (!funcPointer)
-		I_OutputMsg("hwSym for %s: %s\n", funcName, SDL_GetError());
-	return funcPointer;
-}
-
-/**	\brief	The *hwOpen function
-
-	\param	hwfile	Open a handle to the SO
-
-	\return	Handle to SO
-
-
-*/
-
-void *hwOpen(const char *hwfile)
-{
-#ifdef NOLOADSO
-	(void)hwfile;
-	return NULL;
-#else
-	void *tempso = NULL;
-	tempso = SDL_LoadObject(hwfile);
-	if (!tempso) I_OutputMsg("hwOpen of %s: %s\n", hwfile, SDL_GetError());
-	return tempso;
-#endif
-}
-
-/**	\brief	The hwClose function
-
-	\param	handle	Close the handle of the SO
-
-	\return	void
-
-
-*/
-
-void hwClose(void *handle)
-{
-#ifdef NOLOADSO
-	(void)handle;
-#else
-	SDL_UnloadObject(handle);
-#endif
-}
-#endif
diff --git a/src/sdl12/hwsym_sdl.h b/src/sdl12/hwsym_sdl.h
deleted file mode 100644
index 7297587bf3bcb42f5e3f10e52b43cc232e022b5b..0000000000000000000000000000000000000000
--- a/src/sdl12/hwsym_sdl.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Tool for dynamic referencing of hardware rendering/3D sound functions
-
-void *hwSym(const char *funcName,void *handle);
-
-void *hwOpen(const char *hwfile);
-
-void hwClose(void *handle);
diff --git a/src/sdl12/i_cdmus.c b/src/sdl12/i_cdmus.c
deleted file mode 100644
index 1eeac370b25d27d438fb532087f4a3458c1762b0..0000000000000000000000000000000000000000
--- a/src/sdl12/i_cdmus.c
+++ /dev/null
@@ -1,588 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief cd music interface
-///
-
-#ifdef HAVE_SDL
-
-#if defined (DC) || defined (_WIN32_WCE) || defined(GP2X) || defined(_PS3)
-#define NOSDLCD
-#endif
-
-#include <stdlib.h>
-#ifndef NOSDLCD
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#endif
-
-#include "../doomtype.h"
-#include "../i_sound.h"
-#include "../command.h"
-#include "../m_argv.h"
-#include "../s_sound.h"
-
-#define MAX_CD_TRACKS 256
-
-#ifdef _XBOX
-INT32  SDL_SYS_CDInit(void)
-{
-	return(0);
-}
-
-void SDL_SYS_CDQuit(void)
-{
-	return;
-}
-#endif
-
-UINT8 cdaudio_started = 0;   // for system startup/shutdown
-
-consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-consvar_t cdUpdate  = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-#ifndef NOSDLCD
-static SDL_bool cdValid     = SDL_FALSE;
-static SDL_bool cdPlaying   = SDL_FALSE;
-static SDL_bool wasPlaying  = SDL_FALSE;
-static SDL_bool cdEnabled   = SDL_FALSE;
-static SDL_bool playLooping = SDL_FALSE;
-static Uint8    playTrack   = 0;
-static Uint8    maxTrack    = MAX_CD_TRACKS-1;
-static Uint8    cdRemap[MAX_CD_TRACKS];
-static INT32      cdvolume    = -1;
-static SDL_CD  *cdrom       = NULL;
-static CDstatus cdStatus    = CD_ERROR;
-
-/**************************************************************************
- *
- * function: CDAudio_GetAudioDiskInfo
- *
- * description:
- * set number of tracks if CD is available
- *
- **************************************************************************/
-static INT32 CDAudio_GetAudioDiskInfo(void)
-{
-	cdValid = SDL_FALSE;
-	maxTrack = 0;
-
-	if (!cdrom)
-		return 0;//Alam: Lies!
-
-	cdStatus = SDL_CDStatus(cdrom);
-
-	if (!CD_INDRIVE(cdStatus))
-	{
-		CONS_Printf("%s", M_GetText("No CD in drive\n"));
-		return -1;
-	}
-
-	if (cdStatus == CD_ERROR)
-	{
-		CONS_Printf(M_GetText("CD Error: %s\n"), SDL_GetError());
-		return -1;
-	}
-
-	cdValid = SDL_TRUE;
-	maxTrack = (Uint8)cdrom->numtracks;
-
-	return 0;
-}
-
-
-/**************************************************************************
- *
- * function: I_EjectCD
- *
- * description:
- *
- *
- **************************************************************************/
-static void I_EjectCD(void)
-{
-	if (!cdrom || !cdEnabled)
-		return; // no cd init'd
-
-	I_StopCD();
-
-	if (SDL_CDEject(cdrom))
-		CONS_Printf("%s", M_GetText("CD eject failed\n"));
-}
-
-/**************************************************************************
- *
- * function: Command_Cd_f
- *
- * description:
- * handles all CD commands from the console
- *
- **************************************************************************/
-static void Command_Cd_f (void)
-{
-	const char *command;
-	size_t ret, n;
-
-	if (!cdaudio_started)
-		return;
-
-	if (COM_Argc() < 2)
-	{
-		CONS_Printf ("%s", M_GetText("cd [on] [off] [remap] [reset] [select]\n"
-		"   [open] [info] [play <track>] [resume]\n"
-		"   [stop] [pause] [loop <track>]\n"));
-		return;
-	}
-
-	command = COM_Argv (1);
-
-	if (!strncmp(command, "on", 2))
-	{
-		cdEnabled = SDL_TRUE;
-		return;
-	}
-
-	if (!strncmp(command, "off", 3))
-	{
-		I_StopCD();
-		cdEnabled = SDL_FALSE;
-		return;
-	}
-
-	if (!strncmp(command, "select", 6))
-	{
-		INT32 newcddrive;
-		newcddrive = atoi(COM_Argv(2));
-		command = SDL_CDName(newcddrive);
-		I_StopCD();
-		cdEnabled = SDL_FALSE;
-		SDL_CDClose(cdrom);
-		cdrom = SDL_CDOpen(newcddrive);
-		if (cdrom)
-		{
-			cdEnabled = SDL_TRUE;
-			CONS_Printf(M_GetText("Opened CD-ROM drive %s\n"), command ? command : COM_Argv(2));
-		}
-		else CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), command ? command : COM_Argv(2), SDL_GetError());
-		return;
-	}
-
-	if (!strncmp(command, "remap", 5))
-	{
-		ret = COM_Argc() - 2;
-		if (ret <= 0)
-		{
-			for (n = 1; n < MAX_CD_TRACKS; n++)
-			{
-				if (cdRemap[n] != n)
-					CONS_Printf("  %s -> %u\n", sizeu1(n), cdRemap[n]);
-			}
-			return;
-		}
-		for (n = 1; n <= ret; n++)
-			cdRemap[n] = (Uint8)atoi(COM_Argv (n+1));
-		return;
-	}
-
-	if (!strncmp(command, "reset", 5))
-	{
-		if (!cdrom) return;
-		cdEnabled = SDL_TRUE;
-		I_StopCD();
-		for (n = 0; n < MAX_CD_TRACKS; n++)
-			cdRemap[n] = (Uint8)n;
-		CDAudio_GetAudioDiskInfo();
-		return;
-	}
-
-	if (!cdValid)
-	{
-		if (CDAudio_GetAudioDiskInfo()==-1 && !cdValid)
-		{
-			CONS_Printf("%s", M_GetText("No CD in drive\n"));
-			return;
-		}
-	}
-
-	if (!strncmp(command, "open", 4))
-	{
-		I_EjectCD();
-		cdValid = SDL_FALSE;
-		return;
-	}
-
-	if (!strncmp(command, "info", 4))
-	{
-		CONS_Printf(M_GetText("%u tracks\n"), maxTrack);
-		if (cdPlaying)
-			CONS_Printf(M_GetText("Currently %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
-		else if (wasPlaying)
-			CONS_Printf(M_GetText("Paused %s track %u\n"), playLooping ? M_GetText("looping") : M_GetText("playing"), playTrack);
-		CONS_Printf(M_GetText("Volume is %d\n"), cdvolume);
-		return;
-	}
-
-	if (!strncmp(command, "play", 4))
-	{
-		I_PlayCD((UINT8)atoi(COM_Argv (2)), SDL_FALSE);
-		return;
-	}
-
-	if (!strncmp(command, "loop", 4))
-	{
-		I_PlayCD((UINT8)atoi(COM_Argv (2)), true);
-		return;
-	}
-
-	if (!strncmp(command, "stop", 4))
-	{
-		I_StopCD();
-		return;
-	}
-	if (!strncmp(command, "pause", 5))
-	{
-		I_PauseCD();
-		return;
-	}
-
-	if (!strncmp(command, "resume", 6))
-	{
-		I_ResumeCD();
-		return;
-	}
-
-	CONS_Printf(M_GetText("Invalid CD command \"CD %s\"\n"), COM_Argv(1));
-}
-#endif
-
-/**************************************************************************
- *
- * function: StopCD
- *
- * description:
- *
- *
- **************************************************************************/
-void I_StopCD(void)
-{
-#ifndef NOSDLCD
-	if (!cdrom || !cdEnabled)
-		return;
-
-	if (!(cdPlaying || wasPlaying))
-		return;
-
-	if (SDL_CDStop(cdrom))
-		I_OutputMsg("cdromstop failed\n");
-
-	wasPlaying = SDL_FALSE;
-	cdPlaying = SDL_FALSE;
-#endif
-}
-
-/**************************************************************************
- *
- * function: PauseCD
- *
- * description:
- *
- *
- **************************************************************************/
-void I_PauseCD (void)
-{
-#ifndef NOSDLCD
-	if (!cdrom || !cdEnabled)
-		return;
-
-	if (!cdPlaying)
-		return;
-
-	if (SDL_CDPause(cdrom))
-		I_OutputMsg("cdrompause failed\n");
-
-	wasPlaying = cdPlaying;
-	cdPlaying = SDL_FALSE;
-#endif
-}
-
-/**************************************************************************
- *
- * function: ResumeCD
- *
- * description:
- *
- *
- **************************************************************************/
-// continue after a pause
-void I_ResumeCD (void)
-{
-#ifndef NOSDLCD
-	if (!cdrom || !cdEnabled)
-		return;
-
-	if (!cdValid)
-		return;
-
-	if (!wasPlaying)
-		return;
-
-	if (cd_volume.value == 0)
-		return;
-
-	if (SDL_CDResume(cdrom))
-		I_OutputMsg("cdromresume failed\n");
-
-	cdPlaying = SDL_TRUE;
-	wasPlaying = SDL_FALSE;
-#endif
-}
-
-
-/**************************************************************************
- *
- * function: ShutdownCD
- *
- * description:
- *
- *
- **************************************************************************/
-void I_ShutdownCD (void)
-{
-#ifndef NOSDLCD
-	if (!cdaudio_started)
-		return;
-
-	I_StopCD();
-
-	CONS_Printf("I_ShutdownCD: ");
-	SDL_CDClose(cdrom);
-	cdrom = NULL;
-	cdaudio_started = false;
-	CONS_Printf("%s", M_GetText("shut down\n"));
-	SDL_QuitSubSystem(SDL_INIT_CDROM);
-	cdEnabled = SDL_FALSE;
-#endif
-}
-
-/**************************************************************************
- *
- * function: InitCD
- *
- * description:
- * Initialize the first CD drive SDL detects and add console command 'cd'
- *
- **************************************************************************/
-void I_InitCD (void)
-{
-#ifndef NOSDLCD
-	INT32 i;
-
-	// Has been checked in d_main.c, but doesn't hurt here
-	if (M_CheckParm ("-nocd"))
-		return;
-
-	CONS_Printf("%s", M_GetText("I_InitCD: Init CD audio\n"));
-
-	// Initialize SDL first
-	if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
-	{
-		CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError());
-		return;
-	}
-
-	// Open drive
-	cdrom = SDL_CDOpen(0);
-
-	if (!cdrom)
-	{
-		const char *cdName = SDL_CDName(0);
-		if (!cdName)
-			CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), "\b", SDL_GetError());
-		else
-			CONS_Printf(M_GetText("Couldn't open CD-ROM drive %s: %s\n"), cdName, SDL_GetError());
-		//return;
-	}
-
-	for (i = 0; i < MAX_CD_TRACKS; i++)
-		cdRemap[i] = (Uint8)i;
-
-	cdaudio_started = true;
-	if (cdrom) cdEnabled = SDL_TRUE;
-
-	if (CDAudio_GetAudioDiskInfo()==-1)
-	{
-		CONS_Printf("%s", M_GetText("No CD in drive\n"));
-		cdValid = SDL_FALSE;
-	}
-
-	COM_AddCommand ("cd", Command_Cd_f);
-
-	CONS_Printf("%s", M_GetText("CD audio Initialized\n"));
-#endif
-}
-
-
-
-//
-/**************************************************************************
- *
- * function: UpdateCD
- *
- * description:
- * sets CD volume (may have changed) and initiates play evey 2 seconds
- * in case the song has elapsed
- *
- **************************************************************************/
-void I_UpdateCD (void)
-{
-#ifndef NOSDLCD
-	static Uint32 lastchk = 0;
-
-	if (!cdEnabled || !cdrom)
-		return;
-
-	I_SetVolumeCD(cd_volume.value);
-
-	if (cdPlaying && lastchk < SDL_GetTicks())
-	{
-		lastchk = SDL_GetTicks() + 2000; //two seconds between chks
-
-		if (CDAudio_GetAudioDiskInfo()==-1)
-		{
-			cdPlaying = SDL_FALSE;
-			return;
-		}
-
-		if (cdStatus != CD_PLAYING && cdStatus != CD_PAUSED)
-		{
-			cdPlaying = SDL_FALSE;
-			if (playLooping)
-				I_PlayCD(playTrack, true);
-		}
-	}
-#endif
-}
-
-
-
-/**************************************************************************
- *
- * function: PlayCD
- *
- * description:
- * play the requested track and set the looping flag
- * pauses the CD if volume is 0
- *
- **************************************************************************/
-
-void I_PlayCD (UINT8 track, UINT8 looping)
-{
-#ifdef NOSDLCD
-	(void)track;
-	(void)looping;
-#else
-	if (!cdrom || !cdEnabled)
-		return;
-
-	if (!cdValid)
-	{
-		CDAudio_GetAudioDiskInfo();
-		if (!cdValid)
-			return;
-	}
-
-	track = cdRemap[track];
-
-	if (track < 1 || track > maxTrack)
-	{
-		CONS_Printf(M_GetText("Bad track number %u.\n"), track);
-		return;
-	}
-
-	// don't try to play a non-audio track
-	if (cdrom->track[track].type == SDL_DATA_TRACK)
-	{
-		CONS_Printf(M_GetText("Track %u is not audio\n"), track);
-		return;
-	}
-
-	if (cdPlaying)
-	{
-		if (playTrack == track)
-			return;
-		I_StopCD();
-	}
-
-	if (SDL_CDPlayTracks(cdrom, track, 0, 1, 0))
-	{
-		CONS_Printf(M_GetText("Error playing track %d: %s\n"), track, SDL_GetError());
-		return;
-	}
-
-	playLooping = looping;
-	playTrack = (Uint8)track;
-	cdPlaying = SDL_TRUE;
-
-	if (cd_volume.value == 0)
-		I_PauseCD();
-#endif
-}
-
-
-/**************************************************************************
- *
- * function: SetVolumeCD
- *
- * description:
- * SDL does not support setting the CD volume
- * use pause instead and toggle between full and no music
- *
- **************************************************************************/
-
-boolean I_SetVolumeCD (INT32 volume)
-{
-#ifdef NOSDLCD
-	(void)volume;
-#else
-	if (volume != cdvolume)
-	{
-		if (volume > 0 && volume < 16)
-		{
-			CV_SetValue(&cd_volume, 31);
-			cdvolume = 31;
-			I_ResumeCD();
-		}
-		else if (volume > 15 && volume < 31)
-		{
-			CV_SetValue(&cd_volume, 0);
-			cdvolume = 0;
-			I_PauseCD();
-		}
-	}
-#endif
-	return false;
-}
-
-#endif
diff --git a/src/sdl12/i_main.c b/src/sdl12/i_main.c
deleted file mode 100644
index 1c438e0834f97aed1c15d962c9e982c246892921..0000000000000000000000000000000000000000
--- a/src/sdl12/i_main.c
+++ /dev/null
@@ -1,247 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Main program, simply calls D_SRB2Main and D_SRB2Loop, the high level loop.
-
-#include "../doomdef.h"
-#include "../m_argv.h"
-#include "../d_main.h"
-#include "../i_system.h"
-
-#ifdef __GNUC__
-#include <unistd.h>
-#endif
-
-#ifdef _WII
-#include <limits.h>
-#include <network.h>
-#include <fat.h>
-#ifdef REMOTE_DEBUGGING
-#include <debug.h>
-#endif
-static char wiicwd[PATH_MAX] = "sd:/";
-static char localip[16] = {0};
-static char gateway[16] = {0};
-static char netmask[16] = {0};
-#endif
-
-#ifdef _PSP
-#include <pspmoduleinfo.h>
-#include <pspthreadman.h>
-PSP_HEAP_SIZE_KB(24*1024);
-PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU);
-PSP_MAIN_THREAD_NAME("SRB2");
-PSP_MAIN_THREAD_STACK_SIZE_KB(256);
-#endif
-
-#ifdef HAVE_SDL
-
-#ifdef HAVE_TTF
-#include "SDL.h"
-#include "i_ttf.h"
-#endif
-
-#ifdef SDLMAIN
-#include "SDL_main.h"
-#elif defined(FORCESDLMAIN)
-extern int SDL_main(int argc, char *argv[]);
-#endif
-
-#ifdef LOGMESSAGES
-FILE *logstream = NULL;
-#endif
-
-#ifndef DOXYGEN
-#ifndef O_TEXT
-#define O_TEXT 0
-#endif
-
-#ifndef O_SEQUENTIAL
-#define O_SEQUENTIAL 0
-#endif
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX)
-#include "../win32/win_dbg.h"
-typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
-#endif
-
-#ifdef _arch_dreamcast
-#include <arch/arch.h>
-KOS_INIT_FLAGS(INIT_DEFAULT
-//| INIT_NET
-//| INIT_MALLOCSTATS
-//| INIT_QUIET
-//| INIT_OCRAM
-//| INIT_NO_DCLOAD
-);
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX) && !defined (_WIN32_WCE)
-static inline VOID MakeCodeWritable(VOID)
-{
-#ifdef USEASM // Disable write-protection of code segment
-	DWORD OldRights;
-	const DWORD NewRights = PAGE_EXECUTE_READWRITE;
-	PBYTE pBaseOfImage = (PBYTE)GetModuleHandle(NULL);
-	PIMAGE_DOS_HEADER dosH =(PIMAGE_DOS_HEADER)pBaseOfImage;
-	PIMAGE_NT_HEADERS ntH = (PIMAGE_NT_HEADERS)(pBaseOfImage + dosH->e_lfanew);
-	PIMAGE_OPTIONAL_HEADER oH = (PIMAGE_OPTIONAL_HEADER)
-		((PBYTE)ntH + sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER));
-	LPVOID pA = pBaseOfImage+oH->BaseOfCode;
-	SIZE_T pS = oH->SizeOfCode;
-#if 1 // try to find the text section
-	PIMAGE_SECTION_HEADER ntS = IMAGE_FIRST_SECTION (ntH);
-	WORD s;
-	for (s = 0; s < ntH->FileHeader.NumberOfSections; s++)
-	{
-		if (memcmp (ntS[s].Name, ".text\0\0", 8) == 0)
-		{
-			pA = pBaseOfImage+ntS[s].VirtualAddress;
-			pS = ntS[s].Misc.VirtualSize;
-			break;
-		}
-	}
-#endif
-
-	if (!VirtualProtect(pA,pS,NewRights,&OldRights))
-		I_Error("Could not make code writable\n");
-#endif
-}
-#endif
-
-
-/**	\brief	The main function
-
-	\param	argc	number of arg
-	\param	*argv	string table
-
-	\return	int
-*/
-FUNCNORETURN
-#if defined (_XBOX) && defined (__GNUC__)
-void XBoxStartup()
-{
-	const char *logdir = NULL;
-	myargc = -1;
-	myargv = NULL;
-#else
-#ifdef FORCESDLMAIN
-int SDL_main(int argc, char **argv)
-#else
-int main(int argc, char **argv)
-#endif
-{
-	const char *logdir = NULL;
-	myargc = argc;
-	myargv = argv; /// \todo pull out path to exe from this string
-#endif
-
-#ifdef HAVE_TTF
-#ifdef _PS3
-	// apparently there is a bug in SDL_PSL1GHT which needs this to be set to work around
-	SDL_setenv("SDL_VIDEODRIVER", "psl1ght", 1);
-	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE|SDL_DOUBLEBUF);
-#elif defined(_WIN32)
-	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO|SDL_INIT_AUDIO, SDL_SWSURFACE);
-#else
-	I_StartupTTF(FONTPOINTSIZE, SDL_INIT_VIDEO, SDL_SWSURFACE);
-#endif
-#endif
-
-#ifdef _PS3
-	// initialise controllers.
-	//ioPadInit(7);
-#endif
-
-// init Wii-specific stuff
-#ifdef _WII
-	// Start network
-	if_config(localip, netmask, gateway, TRUE);
-
-#ifdef REMOTE_DEBUGGING
-#if REMOTE_DEBUGGING == 0
-	DEBUG_Init(GDBSTUB_DEVICE_TCP, GDBSTUB_DEF_TCPPORT); // Port 2828
-#elif REMOTE_DEBUGGING > 2
-	DEBUG_Init(GDBSTUB_DEVICE_TCP, REMOTE_DEBUGGING); // Custom Port
-#elif REMOTE_DEBUGGING < 0
-	DEBUG_Init(GDBSTUB_DEVICE_USB, GDBSTUB_DEF_CHANNEL); // Slot 1
-#else
-	DEBUG_Init(GDBSTUB_DEVICE_USB, REMOTE_DEBUGGING-1); // Custom Slot
-#endif
-#endif
-	// Start FAT filesystem
-	fatInitDefault();
-
-	if (getcwd(wiicwd, PATH_MAX))
-		I_PutEnv(va("HOME=%ssrb2wii", wiicwd));
-#endif
-
-	logdir = D_Home();
-
-#ifdef LOGMESSAGES
-#if defined(_WIN32_WCE) || defined(GP2X)
-	logstream = fopen(va("%s.log",argv[0]), "a");
-#elif defined (_WII)
-	logstream = fopen(va("%s/srb2log.txt",logdir), "a");
-#elif defined (DEFAULTDIR)
-	if (logdir)
-		logstream = fopen(va("%s/"DEFAULTDIR"/srb2log.txt",logdir), "a");
-	else
-#endif
-		logstream = fopen("./srb2log.txt", "a");
-#endif
-
-	//I_OutputMsg("I_StartupSystem() ...\n");
-	I_StartupSystem();
-#if defined (_WIN32) && !defined (_XBOX)
-#ifndef _WIN32_WCE
-	{
-		p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsDebuggerPresent");
-		if ((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent())
-#ifdef BUGTRAP
-			&& !InitBugTrap()
-#endif
-			)
-		{
-			LoadLibraryA("exchndl.dll");
-		}
-	}
-#endif
-	prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo);
-#ifndef _WIN32_WCE
-	MakeCodeWritable();
-#endif
-#endif
-	// startup SRB2
-	CONS_Printf("%s", M_GetText("Setting up SRB2...\n"));
-	D_SRB2Main();
-	CONS_Printf("%s", M_GetText("Entering main game loop...\n"));
-	// never return
-	D_SRB2Loop();
-
-#ifdef BUGTRAP
-	// This is safe even if BT didn't start.
-	ShutdownBugTrap();
-#endif
-
-	// return to OS
-#ifndef __GNUC__
-	return 0;
-#endif
-}
-#endif
diff --git a/src/sdl12/i_net.c b/src/sdl12/i_net.c
deleted file mode 100644
index ee4a34c13dd8d4d10950d53d972d0cf873068943..0000000000000000000000000000000000000000
--- a/src/sdl12/i_net.c
+++ /dev/null
@@ -1,442 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL network interface
-
-#include "../doomdef.h"
-
-#include "../i_system.h"
-#include "../d_event.h"
-#include "../d_net.h"
-#include "../m_argv.h"
-
-#include "../doomstat.h"
-
-#include "../i_net.h"
-
-#include "../z_zone.h"
-
-#include "../i_tcp.h"
-
-#ifdef HAVE_SDL
-
-#ifdef HAVE_SDLNET
-
-#include "SDL_net.h"
-
-#define MAXBANS 20
-
-static IPaddress clientaddress[MAXNETNODES+1];
-static IPaddress banned[MAXBANS];
-
-static UDPpacket mypacket;
-static UDPsocket mysocket = NULL;
-static SDLNet_SocketSet myset = NULL;
-
-static size_t numbans = 0;
-static boolean NET_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
-static boolean init_SDLNet_driver = false;
-
-static const char *NET_AddrToStr(IPaddress* sk)
-{
-	static char s[22]; // 255.255.255.255:65535
-	strcpy(s, SDLNet_ResolveIP(sk));
-	if (sk->port != 0) strcat(s, va(":%d", sk->port));
-	return s;
-}
-
-static const char *NET_GetNodeAddress(INT32 node)
-{
-	if (!nodeconnected[node])
-		return NULL;
-	return NET_AddrToStr(&clientaddress[node]);
-}
-
-static const char *NET_GetBanAddress(size_t ban)
-{
-	if (ban > numbans)
-		return NULL;
-	return NET_AddrToStr(&banned[ban]);
-}
-
-static boolean NET_cmpaddr(IPaddress* a, IPaddress* b)
-{
-	return (a->host == b->host && (b->port == 0 || a->port == b->port));
-}
-
-static boolean NET_CanGet(void)
-{
-	return myset?(SDLNet_CheckSockets(myset,0)  == 1):false;
-}
-
-static void NET_Get(void)
-{
-	INT32 mystatus;
-	INT32 newnode;
-	mypacket.len = MAXPACKETLENGTH;
-	if (!NET_CanGet())
-	{
-		doomcom->remotenode = -1; // no packet
-		return;
-	}
-	mystatus = SDLNet_UDP_Recv(mysocket,&mypacket);
-	if (mystatus != -1)
-	{
-		if (mypacket.channel != -1)
-		{
-			doomcom->remotenode = mypacket.channel+1; // good packet from a game player
-			doomcom->datalength = mypacket.len;
-			return;
-		}
-		newnode = SDLNet_UDP_Bind(mysocket,-1,&mypacket.address);
-		if (newnode != -1)
-		{
-			size_t i;
-			newnode++;
-			M_Memcpy(&clientaddress[newnode], &mypacket.address, sizeof (IPaddress));
-			DEBFILE(va("New node detected: node:%d address:%s\n", newnode,
-					NET_GetNodeAddress(newnode)));
-			doomcom->remotenode = newnode; // good packet from a game player
-			doomcom->datalength = mypacket.len;
-			for (i = 0; i < numbans; i++)
-			{
-				if (NET_cmpaddr(&mypacket.address, &banned[i]))
-				{
-					DEBFILE("This dude has been banned\n");
-					NET_bannednode[newnode] = true;
-					break;
-				}
-			}
-			if (i == numbans)
-				NET_bannednode[newnode] = false;
-			return;
-		}
-		else
-			I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-	}
-	else if (mystatus == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-	}
-
-	DEBFILE("New node detected: No more free slots\n");
-	doomcom->remotenode = -1; // no packet
-}
-
-#if 0
-static boolean NET_CanSend(void)
-{
-	return true;
-}
-#endif
-
-static void NET_Send(void)
-{
-	if (!doomcom->remotenode)
-		return;
-	mypacket.len = doomcom->datalength;
-	if (SDLNet_UDP_Send(mysocket,doomcom->remotenode-1,&mypacket) == 0)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-	}
-}
-
-static void NET_FreeNodenum(INT32 numnode)
-{
-	// can't disconnect from self :)
-	if (!numnode)
-		return;
-
-	DEBFILE(va("Free node %d (%s)\n", numnode, NET_GetNodeAddress(numnode)));
-
-	SDLNet_UDP_Unbind(mysocket,numnode-1);
-
-	memset(&clientaddress[numnode], 0, sizeof (IPaddress));
-}
-
-static UDPsocket NET_Socket(void)
-{
-	UDPsocket temp = NULL;
-	Uint16 portnum = 0;
-	IPaddress tempip = {INADDR_BROADCAST,0};
-	//Hurdler: I'd like to put a server and a client on the same computer
-	//Logan: Me too
-	//BP: in fact for client we can use any free port we want i have read
-	//    in some doc that connect in udp can do it for us...
-	//Alam: where?
-	if (M_CheckParm("-clientport"))
-	{
-		if (!M_IsNextParm())
-			I_Error("syntax: -clientport <portnum>");
-		portnum = atoi(M_GetNextParm());
-	}
-	else
-		portnum = sock_port;
-	temp = SDLNet_UDP_Open(portnum);
-	if (!temp)
-	{
-			I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return NULL;
-	}
-	if (SDLNet_UDP_Bind(temp,BROADCASTADDR-1,&tempip) == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		SDLNet_UDP_Close(temp);
-		return NULL;
-	}
-	clientaddress[BROADCASTADDR].port = sock_port;
-	clientaddress[BROADCASTADDR].host = INADDR_BROADCAST;
-
-	doomcom->extratics = 1; // internet is very high ping
-
-	return temp;
-}
-
-static void I_ShutdownSDLNetDriver(void)
-{
-	if (myset) SDLNet_FreeSocketSet(myset);
-	myset = NULL;
-	SDLNet_Quit();
-	init_SDLNet_driver = false;
-}
-
-static void I_InitSDLNetDriver(void)
-{
-	if (init_SDLNet_driver)
-		I_ShutdownSDLNetDriver();
-	if (SDLNet_Init() == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return; // No good!
-	}
-	D_SetDoomcom();
-	mypacket.data = doomcom->data;
-	init_SDLNet_driver = true;
-}
-
-static void NET_CloseSocket(void)
-{
-	if (mysocket)
-		SDLNet_UDP_Close(mysocket);
-	mysocket = NULL;
-}
-
-static SINT8 NET_NetMakeNodewPort(const char *hostname, const char *port)
-{
-	INT32 newnode;
-	UINT16 portnum = sock_port;
-	IPaddress hostnameIP;
-
-	// retrieve portnum from address!
-	if (port && !port[0])
-		portnum = atoi(port);
-
-	if (SDLNet_ResolveHost(&hostnameIP,hostname,portnum) == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return -1;
-	}
-	newnode = SDLNet_UDP_Bind(mysocket,-1,&hostnameIP);
-	if (newnode == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return newnode;
-	}
-	newnode++;
-	M_Memcpy(&clientaddress[newnode],&hostnameIP,sizeof (IPaddress));
-	return (SINT8)newnode;
-}
-
-
-static boolean NET_OpenSocket(void)
-{
-	memset(clientaddress, 0, sizeof (clientaddress));
-
-	//I_OutputMsg("SDL_Net Code starting up\n");
-
-	I_NetSend = NET_Send;
-	I_NetGet = NET_Get;
-	I_NetCloseSocket = NET_CloseSocket;
-	I_NetFreeNodenum = NET_FreeNodenum;
-	I_NetMakeNodewPort = NET_NetMakeNodewPort;
-
-	//I_NetCanSend = NET_CanSend;
-
-	// build the socket but close it first
-	NET_CloseSocket();
-	mysocket = NET_Socket();
-
-	if (!mysocket)
-		return false;
-
-	// for select
-	myset = SDLNet_AllocSocketSet(1);
-	if (!myset)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return false;
-	}
-	if (SDLNet_UDP_AddSocket(myset,mysocket) == -1)
-	{
-		I_OutputMsg("SDL_Net: %s",SDLNet_GetError());
-		return false;
-	}
-	return true;
-}
-
-static boolean NET_Ban(INT32 node)
-{
-	if (numbans == MAXBANS)
-		return false;
-
-	M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (IPaddress));
-	banned[numbans].port = 0;
-	numbans++;
-	return true;
-}
-
-static boolean NET_SetBanAddress(const char *address, const char *mask)
-{
-	(void)mask;
-	if (bans == MAXBANS)
-		return false;
-
-	if (SDLNet_ResolveHost(&banned[numbans], address, 0) == -1)
-		return false;
-	numbans++;
-	return true;
-}
-
-static void NET_ClearBans(void)
-{
-	numbans = 0;
-}
-#endif
-
-//
-// I_InitNetwork
-// Only required for DOS, so this is more a dummy
-//
-boolean I_InitNetwork(void)
-{
-#ifdef HAVE_SDLNET
-	char serverhostname[255];
-	boolean ret = false;
-	SDL_version SDLcompiled;
-	const SDL_version *SDLlinked = SDLNet_Linked_Version();
-	SDL_NET_VERSION(&SDLcompiled)
-	I_OutputMsg("Compiled for SDL_Net version: %d.%d.%d\n",
-                        SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
-	I_OutputMsg("Linked with SDL_Net version: %d.%d.%d\n",
-                        SDLlinked->major, SDLlinked->minor, SDLlinked->patch);
-	//if (!M_CheckParm ("-sdlnet"))
-	//	return false;
-	// initilize the driver
-	I_InitSDLNetDriver();
-	I_AddExitFunc(I_ShutdownSDLNetDriver);
-	if (!init_SDLNet_driver)
-		return false;
-
-	if (M_CheckParm("-udpport"))
-	{
-		if (M_IsNextParm())
-			sock_port = (UINT16)atoi(M_GetNextParm());
-		else
-			sock_port = 0;
-	}
-
-	// parse network game options,
-	if (M_CheckParm("-server") || dedicated)
-	{
-		server = true;
-
-		// If a number of clients (i.e. nodes) is specified, the server will wait for the clients
-		// to connect before starting.
-		// If no number is specified here, the server starts with 1 client, and others can join
-		// in-game.
-		// Since Boris has implemented join in-game, there is no actual need for specifying a
-		// particular number here.
-		// FIXME: for dedicated server, numnodes needs to be set to 0 upon start
-/*		if (M_IsNextParm())
-			doomcom->numnodes = (INT16)atoi(M_GetNextParm());
-		else */if (dedicated)
-			doomcom->numnodes = 0;
-		else
-			doomcom->numnodes = 1;
-
-		if (doomcom->numnodes < 0)
-			doomcom->numnodes = 0;
-		if (doomcom->numnodes > MAXNETNODES)
-			doomcom->numnodes = MAXNETNODES;
-
-		// server
-		servernode = 0;
-		// FIXME:
-		// ??? and now ?
-		// server on a big modem ??? 4*isdn
-		net_bandwidth = 16000;
-		hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
-
-		ret = true;
-	}
-	else if (M_CheckParm("-connect"))
-	{
-		if (M_IsNextParm())
-			strcpy(serverhostname, M_GetNextParm());
-		else
-			serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it
-
-		// server address only in ip
-		if (serverhostname[0])
-		{
-			COM_BufAddText("connect \"");
-			COM_BufAddText(serverhostname);
-			COM_BufAddText("\"\n");
-
-			// probably modem
-			hardware_MAXPACKETLENGTH = INETPACKETLENGTH;
-		}
-		else
-		{
-			// so we're on a LAN
-			COM_BufAddText("connect any\n");
-
-			net_bandwidth = 800000;
-			hardware_MAXPACKETLENGTH = MAXPACKETLENGTH;
-		}
-	}
-
-	mypacket.maxlen = hardware_MAXPACKETLENGTH;
-	I_NetOpenSocket = NET_OpenSocket;
-	I_Ban = NET_Ban;
-	I_ClearBans = NET_ClearBans;
-	I_GetNodeAddress = NET_GetNodeAddress;
-	I_GetBenAddress = NET_GetBenAddress;
-	I_SetBanAddress = NET_SetBanAddress;
-	bannednode = NET_bannednode;
-
-	return ret;
-#else
-	if ( M_CheckParm ("-net") )
-	{
-		I_Error("-net not supported, use -server and -connect\n"
-			"see docs for more\n");
-	}
-	return false;
-#endif
-}
-#endif
diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c
deleted file mode 100644
index ed0db653d1f51df07ae714199f5bd9f68c05de21..0000000000000000000000000000000000000000
--- a/src/sdl12/i_system.c
+++ /dev/null
@@ -1,3127 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// Changes by Graue <graue@oceanbase.org> are in the public domain.
-//
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SRB2 system stuff for SDL
-
-#ifndef _WIN32_WCE
-#include <signal.h>
-#endif
-
-#ifdef _XBOX
-#include "SRB2XBOX/xboxhelp.h"
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX)
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-#include "../doomtype.h"
-#ifndef _WIN32_WCE
-typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
-typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD);
-typedef DWORD (WINAPI *p_timeGetTime) (void);
-typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
-typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
-typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
-typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
-typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR);
-typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR);
-#endif
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef __GNUC__
-#include <unistd.h>
-#elif defined (_MSC_VER)
-#include <direct.h>
-#endif
-#if defined (__unix__) || defined (UNIXCOMMON)
-#include <fcntl.h>
-#endif
-
-#ifdef _arch_dreamcast
-#include <arch/gdb.h>
-#include <arch/timer.h>
-#include <conio/conio.h>
-#include <dc/pvr.h>
-void __set_fpscr(long); // in libgcc / kernel's startup.s?
-#else
-#include <stdio.h>
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
-#include <conio.h>
-#endif
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#ifdef HAVE_SDL
-
-#include "SDL.h"
-
-#ifdef HAVE_TTF
-#include "i_ttf.h"
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#if SDL_VERSION_ATLEAST(1,2,7) && !defined (DC)
-#include "SDL_cpuinfo.h" // 1.2.7 or greater
-#define HAVE_SDLCPUINFO
-#endif
-
-#ifdef _PSP
-//#include <pspiofilemgr.h>
-#elif !defined(_PS3)
-#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (__HAIKU__) && !defined (_WII))
-#if defined (__linux__)
-#include <sys/vfs.h>
-#else
-#include <sys/param.h>
-#include <sys/mount.h>
-/*For meminfo*/
-#include <sys/types.h>
-#ifdef FREEBSD
-#include <kvm.h>
-#endif
-#include <nlist.h>
-#include <sys/vmmeter.h>
-#endif
-#endif
-#endif
-
-#ifndef _PS3
-#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (_arch_dreamcast) && !defined (_PSP) && !defined (__HAIKU__) && !defined (_WII))
-#ifndef NOTERMIOS
-#include <termios.h>
-#include <sys/ioctl.h> // ioctl
-#define HAVE_TERMIOS
-#endif
-#endif
-#endif
-
-#ifndef NOMUMBLE
-#if defined (__linux__) && !defined(_PS3) // need -lrt
-#include <sys/mman.h>
-#ifdef MAP_FAILED
-#define HAVE_SHM
-#endif
-#include <wchar.h>
-#endif
-
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
-#define HAVE_MUMBLE
-#define WINMUMBLE
-#elif defined (HAVE_SHM)
-#define HAVE_MUMBLE
-#endif
-#endif // NOMUMBLE
-
-#ifdef _WIN32_WCE
-#include "SRB2CE/cehelp.h"
-#endif
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-// Locations for searching the srb2.srb
-#ifdef _arch_dreamcast
-#define DEFAULTWADLOCATION1 "/cd"
-#define DEFAULTWADLOCATION2 "/pc"
-#define DEFAULTWADLOCATION3 "/pc/home/alam/srb2code/data"
-#define DEFAULTSEARCHPATH1 "/cd"
-#define DEFAULTSEARCHPATH2 "/pc"
-//#define DEFAULTSEARCHPATH3 "/pc/home/alam/srb2code/data"
-#elif defined (GP2X)
-#define DEFAULTWADLOCATION1 "/mnt/sd"
-#define DEFAULTWADLOCATION2 "/mnt/sd/SRB2"
-#define DEFAULTWADLOCATION3 "/tmp/mnt/sd"
-#define DEFAULTWADLOCATION4 "/tmp/mnt/sd/SRB2"
-#define DEFAULTSEARCHPATH1 "/mnt/sd"
-#define DEFAULTSEARCHPATH2 "/tmp/mnt/sd"
-#elif defined (_WII)
-#define NOCWD
-#define NOHOME
-#define NEED_SDL_GETENV
-#define DEFAULTWADLOCATION1 "sd:/srb2wii"
-#define DEFAULTWADLOCATION2 "usb:/srb2wii"
-#define DEFAULTSEARCHPATH1 "sd:/srb2wii"
-#define DEFAULTSEARCHPATH2 "usb:/srb2wii"
-// PS3: TODO: this will need modification most likely
-#elif defined (_PS3)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#define DEFAULTWADLOCATION2 "/dev_usb/SRB2PS3"
-#define DEFAULTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#define DEFAULTSEARCHPATH2 "/dev_usb/SRB2PS3"
-#elif defined (_PSP)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "host0:/bin/Resources"
-#define DEFAULTWADLOCATION2 "ms0:/PSP/GAME/SRB2PSP"
-#define DEFAULTSEARCHPATH1 "host0:/"
-#define DEFAULTSEARCHPATH2 "ms0:/PSP/GAME/SRB2PSP"
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
-#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
-#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
-#define DEFAULTWADLOCATION4 "/usr/games/SRB2"
-#define DEFAULTSEARCHPATH1 "/usr/local/games"
-#define DEFAULTSEARCHPATH2 "/usr/games"
-#define DEFAULTSEARCHPATH3 "/usr/local"
-#elif defined (_XBOX)
-#define NOCWD
-#ifdef __GNUC__
-#include <openxdk/debug.h>
-#endif
-#define DEFAULTWADLOCATION1 "c:\\srb2"
-#define DEFAULTWADLOCATION2 "d:\\srb2"
-#define DEFAULTWADLOCATION3 "e:\\srb2"
-#define DEFAULTWADLOCATION4 "f:\\srb2"
-#define DEFAULTWADLOCATION5 "g:\\srb2"
-#define DEFAULTWADLOCATION6 "h:\\srb2"
-#define DEFAULTWADLOCATION7 "i:\\srb2"
-#elif defined (_WIN32_WCE)
-#define NOCWD
-#define NOHOME
-#define DEFAULTWADLOCATION1 "\\Storage Card\\SRB2DEMO"
-#define DEFAULTSEARCHPATH1 "\\Storage Card"
-#elif defined (_WIN32)
-#define DEFAULTWADLOCATION1 "c:\\games\\srb2"
-#define DEFAULTWADLOCATION2 "\\games\\srb2"
-#define DEFAULTSEARCHPATH1 "c:\\games"
-#define DEFAULTSEARCHPATH2 "\\games"
-#endif
-
-/**	\brief WAD file to look for
-*/
-#define WADKEYWORD1 "srb2.srb"
-#define WADKEYWORD2 "srb2.wad"
-/**	\brief holds wad path
-*/
-static char returnWadPath[256];
-
-//Alam_GBC: SDL
-
-#include "../doomdef.h"
-#include "../m_misc.h"
-#include "../i_video.h"
-#include "../i_sound.h"
-#include "../i_system.h"
-#include "../screen.h" //vid.WndParent
-#include "../d_net.h"
-#include "../g_game.h"
-#include "../filesrch.h"
-#include "endtxt.h"
-#include "sdlmain.h"
-
-#include "../i_joy.h"
-
-#include "../m_argv.h"
-
-#ifdef MAC_ALERT
-#include "macosx/mac_alert.h"
-#endif
-
-#include "../d_main.h"
-
-#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
-// Mumble context string
-#include "../d_clisrv.h"
-#include "../byteptr.h"
-#endif
-
-/**	\brief	The JoyReset function
-
-	\param	JoySet	Joystick info to reset
-
-	\return	void
-*/
-static void JoyReset(SDLJoyInfo_t *JoySet)
-{
-	if (JoySet->dev)
-	{
-#ifdef GP2X //GP2X's SDL does an illegal free on the 1st joystick...
-		if (SDL_JoystickIndex(JoySet->dev) != 0)
-#endif
-		SDL_JoystickClose(JoySet->dev);
-	}
-	JoySet->dev = NULL;
-	JoySet->oldjoy = -1;
-	JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0;
-	//JoySet->scale
-}
-
-/**	\brief First joystick up and running
-*/
-static INT32 joystick_started  = 0;
-
-/**	\brief SDL info about joystick 1
-*/
-SDLJoyInfo_t JoyInfo;
-
-
-/**	\brief Second joystick up and running
-*/
-static INT32 joystick2_started = 0;
-
-/**	\brief SDL inof about joystick 2
-*/
-SDLJoyInfo_t JoyInfo2;
-
-#ifdef HAVE_TERMIOS
-static INT32 fdmouse2 = -1;
-static INT32 mouse2_started = 0;
-#endif
-
-SDL_bool consolevent = SDL_FALSE;
-SDL_bool framebuffer = SDL_FALSE;
-
-UINT8 keyboard_started = false;
-
-#if 0
-static void signal_handler(INT32 num)
-{
-	//static char msg[] = "oh no! back to reality!\r\n";
-	char *      sigmsg;
-	char        sigdef[32];
-
-	switch (num)
-	{
-	case SIGINT:
-		sigmsg = "interrupt";
-		break;
-	case SIGILL:
-		sigmsg = "illegal instruction - invalid function image";
-		break;
-	case SIGFPE:
-		sigmsg = "floating point exception";
-		break;
-	case SIGSEGV:
-		sigmsg = "segment violation";
-		break;
-	case SIGTERM:
-		sigmsg = "Software termination signal from kill";
-		break;
-#if !(defined (__unix_) || defined (UNIXCOMMON))
-	case SIGBREAK:
-		sigmsg = "Ctrl-Break sequence";
-		break;
-#endif
-	case SIGABRT:
-		sigmsg = "abnormal termination triggered by abort call";
-		break;
-	default:
-		sprintf(sigdef,"signal number %d", num);
-		sigmsg = sigdef;
-	}
-
-	I_OutputMsg("signal_handler() error: %s\n", sigmsg);
-	signal(num, SIG_DFL);               //default signal action
-	raise(num);
-	I_Quit();
-}
-#endif
-
-#if defined (NDEBUG) && !defined (DC) && !defined (_WIN32_WCE)
-FUNCNORETURN static ATTRNORETURN void quit_handler(int num)
-{
-	signal(num, SIG_DFL); //default signal action
-	raise(num);
-	I_Quit();
-}
-#endif
-
-#ifdef HAVE_TERMIOS
-// TERMIOS console code from Quake3: thank you!
-SDL_bool stdin_active = SDL_TRUE;
-
-typedef struct
-{
-	size_t cursor;
-	char buffer[256];
-} feild_t;
-
-feild_t tty_con;
-
-// when printing general stuff to stdout stderr (Sys_Printf)
-//   we need to disable the tty console stuff
-// this increments so we can recursively disable
-static INT32 ttycon_hide = 0;
-// some key codes that the terminal may be using
-// TTimo NOTE: I'm not sure how relevant this is
-static INT32 tty_erase;
-static INT32 tty_eof;
-
-static struct termios tty_tc;
-
-// =============================================================
-// tty console routines
-// NOTE: if the user is editing a line when something gets printed to the early console then it won't look good
-//   so we provide tty_Clear and tty_Show to be called before and after a stdout or stderr output
-// =============================================================
-
-// flush stdin, I suspect some terminals are sending a LOT of garbage
-// FIXME TTimo relevant?
-#if 0
-static inline void tty_FlushIn(void)
-{
-	char key;
-	while (read(STDIN_FILENO, &key, 1)!=-1);
-}
-#endif
-
-// do a backspace
-// TTimo NOTE: it seems on some terminals just sending '\b' is not enough
-//   so for now, in any case we send "\b \b" .. yeah well ..
-//   (there may be a way to find out if '\b' alone would work though)
-static void tty_Back(void)
-{
-	char key;
-	ssize_t d;
-	key = '\b';
-	d = write(STDOUT_FILENO, &key, 1);
-	key = ' ';
-	d = write(STDOUT_FILENO, &key, 1);
-	key = '\b';
-	d = write(STDOUT_FILENO, &key, 1);
-	(void)d;
-}
-
-static void tty_Clear(void)
-{
-	size_t i;
-	if (tty_con.cursor>0)
-	{
-		for (i=0; i<tty_con.cursor; i++)
-		{
-			tty_Back();
-		}
-	}
-
-}
-
-// clear the display of the line currently edited
-// bring cursor back to beginning of line
-static inline void tty_Hide(void)
-{
-	//I_Assert(consolevent);
-	if (ttycon_hide)
-	{
-		ttycon_hide++;
-		return;
-	}
-	tty_Clear();
-	ttycon_hide++;
-}
-
-// show the current line
-// FIXME TTimo need to position the cursor if needed??
-static inline void tty_Show(void)
-{
-	size_t i;
-	ssize_t d;
-	//I_Assert(consolevent);
-	I_Assert(ttycon_hide>0);
-	ttycon_hide--;
-	if (ttycon_hide == 0 && tty_con.cursor)
-	{
-		for (i=0; i<tty_con.cursor; i++)
-		{
-			d = write(STDOUT_FILENO, tty_con.buffer+i, 1);
-		}
-	}
-	(void)d;
-}
-
-// never exit without calling this, or your terminal will be left in a pretty bad state
-static void I_ShutdownConsole(void)
-{
-	if (consolevent)
-	{
-		I_OutputMsg("Shutdown tty console\n");
-		consolevent = SDL_FALSE;
-		tcsetattr (STDIN_FILENO, TCSADRAIN, &tty_tc);
-	}
-}
-
-static void I_StartupConsole(void)
-{
-	struct termios tc;
-
-	// TTimo
-	// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=390 (404)
-	// then SIGTTIN or SIGTOU is emitted, if not catched, turns into a SIGSTP
-	signal(SIGTTIN, SIG_IGN);
-	signal(SIGTTOU, SIG_IGN);
-
-#if !defined(GP2X) //read is bad on GP2X
-	consolevent = !M_CheckParm("-noconsole");
-#endif
-	framebuffer = M_CheckParm("-framebuffer");
-
-	if (framebuffer)
-		consolevent = SDL_FALSE;
-
-	if (!consolevent) return;
-
-	if (isatty(STDIN_FILENO)!=1)
-	{
-		I_OutputMsg("stdin is not a tty, tty console mode failed\n");
-		consolevent = SDL_FALSE;
-		return;
-	}
-	memset(&tty_con, 0x00, sizeof(tty_con));
-	tcgetattr (0, &tty_tc);
-	tty_erase = tty_tc.c_cc[VERASE];
-	tty_eof = tty_tc.c_cc[VEOF];
-	tc = tty_tc;
-	/*
-	 ECHO: don't echo input characters
-	 ICANON: enable canonical mode.  This  enables  the  special
-	  characters  EOF,  EOL,  EOL2, ERASE, KILL, REPRINT,
-	  STATUS, and WERASE, and buffers by lines.
-	 ISIG: when any of the characters  INTR,  QUIT,  SUSP,  or
-	  DSUSP are received, generate the corresponding signal
-	*/
-	tc.c_lflag &= ~(ECHO | ICANON);
-	/*
-	 ISTRIP strip off bit 8
-	 INPCK enable input parity checking
-	 */
-	tc.c_iflag &= ~(ISTRIP | INPCK);
-	tc.c_cc[VMIN] = 0; //1?
-	tc.c_cc[VTIME] = 0;
-	tcsetattr (0, TCSADRAIN, &tc);
-}
-
-void I_GetConsoleEvents(void)
-{
-	// we use this when sending back commands
-	event_t ev = {0,0,0,0};
-	char key = 0;
-	ssize_t d;
-
-	if (!consolevent)
-		return;
-
-	ev.type = ev_console;
-	if (read(STDIN_FILENO, &key, 1) == -1 || !key)
-		return;
-
-	// we have something
-	// backspace?
-	// NOTE TTimo testing a lot of values .. seems it's the only way to get it to work everywhere
-	if ((key == tty_erase) || (key == 127) || (key == 8))
-	{
-		if (tty_con.cursor > 0)
-		{
-			tty_con.cursor--;
-			tty_con.buffer[tty_con.cursor] = '\0';
-			tty_Back();
-		}
-		ev.data1 = KEY_BACKSPACE;
-	}
-	else if (key < ' ') // check if this is a control char
-	{
-		if (key == '\n')
-		{
-			tty_Clear();
-			tty_con.cursor = 0;
-			ev.data1 = KEY_ENTER;
-		}
-		else return;
-	}
-	else
-	{
-		// push regular character
-		ev.data1 = tty_con.buffer[tty_con.cursor] = key;
-		tty_con.cursor++;
-		// print the current line (this is differential)
-		d = write(STDOUT_FILENO, &key, 1);
-	}
-	if (ev.data1) D_PostEvent(&ev);
-	//tty_FlushIn();
-	(void)d;
-}
-
-#elif defined (_WIN32) && !(defined (_XBOX) || defined (_WIN32_WCE))
-static BOOL I_ReadyConsole(HANDLE ci)
-{
-	DWORD gotinput;
-	if (ci == INVALID_HANDLE_VALUE) return FALSE;
-	if (WaitForSingleObject(ci,0) != WAIT_OBJECT_0) return FALSE;
-	if (GetFileType(ci) != FILE_TYPE_CHAR) return FALSE;
-	if (!GetConsoleMode(ci, &gotinput)) return FALSE;
-	return (GetNumberOfConsoleInputEvents(ci, &gotinput) && gotinput);
-}
-
-static boolean entering_con_command = false;
-
-void I_GetConsoleEvents(void)
-{
-	event_t ev = {0,0,0,0};
-	HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
-	HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-	CONSOLE_SCREEN_BUFFER_INFO CSBI;
-	INPUT_RECORD input;
-	DWORD t;
-
-	while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t)
-	{
-		memset(&ev,0x00,sizeof (ev));
-		switch (input.EventType)
-		{
-			case KEY_EVENT:
-				if (input.Event.KeyEvent.bKeyDown)
-				{
-					ev.type = ev_console;
-					entering_con_command = true;
-					switch (input.Event.KeyEvent.wVirtualKeyCode)
-					{
-						case VK_ESCAPE:
-						case VK_TAB:
-							ev.data1 = KEY_NULL;
-							break;
-						case VK_SHIFT:
-							ev.data1 = KEY_LSHIFT;
-							break;
-						case VK_RETURN:
-							entering_con_command = false;
-							// Fall through.
-						default:
-							ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
-					}
-					if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t))
-					{
-						if (ev.data1 && ev.data1 != KEY_LSHIFT && ev.data1 != KEY_RSHIFT)
-						{
-#ifdef _UNICODE
-							WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL);
-#else
-							WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1 , &t, NULL);
-#endif
-						}
-						if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK
-							&& GetConsoleScreenBufferInfo(co,&CSBI))
-						{
-							WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t);
-						}
-					}
-				}
-				else
-				{
-					ev.type = ev_keyup;
-					switch (input.Event.KeyEvent.wVirtualKeyCode)
-					{
-						case VK_SHIFT:
-							ev.data1 = KEY_LSHIFT;
-							break;
-						default:
-							break;
-					}
-				}
-				if (ev.data1) D_PostEvent(&ev);
-				break;
-			case MOUSE_EVENT:
-			case WINDOW_BUFFER_SIZE_EVENT:
-			case MENU_EVENT:
-			case FOCUS_EVENT:
-				break;
-		}
-	}
-}
-
-static void I_StartupConsole(void)
-{
-	HANDLE ci, co;
-	const INT32 ded = M_CheckParm("-dedicated");
-#ifdef SDLMAIN
-	BOOL gotConsole = FALSE;
-	if (M_CheckParm("-console") || ded)
-		gotConsole = AllocConsole();
-#else
-	BOOL gotConsole = TRUE;
-	if (M_CheckParm("-detachconsole"))
-	{
-		FreeConsole();
-		gotConsole = AllocConsole();
-	}
-#ifdef _DEBUG
-	else if (M_CheckParm("-noconsole") && !ded)
-#else
-	else if (!M_CheckParm("-console") && !ded)
-#endif
-	{
-		FreeConsole();
-		gotConsole = FALSE;
-	}
-#endif
-
-	if (gotConsole)
-	{
-		SetConsoleTitleA("SRB2 Console");
-		consolevent = SDL_TRUE;
-	}
-
-	//Let get the real console HANDLE, because Mingw's Bash is bad!
-	ci = CreateFile(TEXT("CONIN$") ,               GENERIC_READ, FILE_SHARE_READ,  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-	co = CreateFile(TEXT("CONOUT$"), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-	if (ci != INVALID_HANDLE_VALUE)
-	{
-		const DWORD CM = ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT;
-		SetStdHandle(STD_INPUT_HANDLE, ci);
-		if (GetFileType(ci) == FILE_TYPE_CHAR)
-			SetConsoleMode(ci, CM); //default mode but no ENABLE_MOUSE_INPUT
-	}
-	if (co != INVALID_HANDLE_VALUE)
-	{
-		SetStdHandle(STD_OUTPUT_HANDLE, co);
-		SetStdHandle(STD_ERROR_HANDLE, co);
-	}
-}
-static inline void I_ShutdownConsole(void){}
-#else
-void I_GetConsoleEvents(void){}
-static inline void I_StartupConsole(void)
-{
-#ifdef _arch_dreamcast
-	char title[] = "SRB2 for Dreamcast!\n";
-	__set_fpscr(0x00040000); /* ignore FPU underflow */
-	//printf("\nHello world!\n\n");
-	pvr_init_defaults();
-	conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE);
-	conio_set_theme(CONIO_THEME_MATRIX);
-	conio_clear();
-	conio_putstr(title);
-	//printf("\nHello world!\n\n");
-#endif
-#ifdef _DEBUG
-	consolevent = !M_CheckParm("-noconsole");
-#else
-	consolevent = M_CheckParm("-console");
-#endif
-
-	framebuffer = M_CheckParm("-framebuffer");
-
-	if (framebuffer)
-		consolevent = SDL_FALSE;
-}
-static inline void I_ShutdownConsole(void){}
-#endif
-
-//
-// StartupKeyboard
-//
-void I_StartupKeyboard (void)
-{
-#if defined (NDEBUG) && !defined (DC)
-#ifdef SIGILL
-//	signal(SIGILL , signal_handler);
-#endif
-#ifdef SIGINT
-	signal(SIGINT , quit_handler);
-#endif
-#ifdef SIGSEGV
-//	signal(SIGSEGV , signal_handler);
-#endif
-#ifdef SIGBREAK
-	signal(SIGBREAK , quit_handler);
-#endif
-#ifdef SIGABRT
-//	signal(SIGABRT , signal_handler);
-#endif
-#ifdef SIGTERM
-	signal(SIGTERM , quit_handler);
-#endif
-#endif
-}
-
-//
-//I_OutputMsg
-//
-void I_OutputMsg(const char *fmt, ...)
-{
-	size_t len;
-	XBOXSTATIC char txt[8192];
-	va_list  argptr;
-
-#ifdef _arch_dreamcast
-	if (!keyboard_started) conio_printf(fmt);
-#endif
-
-	va_start(argptr,fmt);
-	vsprintf(txt, fmt, argptr);
-	va_end(argptr);
-
-#ifdef HAVE_TTF
-	if (TTF_WasInit()) I_TTFDrawText(currentfont, solid, DEFAULTFONTFGR, DEFAULTFONTFGG, DEFAULTFONTFGB,  DEFAULTFONTFGA,
-	DEFAULTFONTBGR, DEFAULTFONTBGG, DEFAULTFONTBGB, DEFAULTFONTBGA, txt);
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX) && defined (_MSC_VER)
-	OutputDebugStringA(txt);
-#endif
-
-	len = strlen(txt);
-
-#ifdef LOGMESSAGES
-	if (logstream)
-	{
-		size_t d = fwrite(txt, len, 1, logstream);
-		fflush(logstream);
-		(void)d;
-	}
-#endif
-
-#if defined (_WIN32) && !defined (_XBOX) && !defined(_WIN32_WCE)
-#ifdef DEBUGFILE
-	if (debugfile != stderr)
-#endif
-	{
-		HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-		DWORD bytesWritten;
-
-		if (co == INVALID_HANDLE_VALUE)
-			return;
-
-		if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten))
-		{
-			static COORD coordNextWrite = {0,0};
-			LPVOID oldLines = NULL;
-			INT oldLength;
-			CONSOLE_SCREEN_BUFFER_INFO csbi;
-
-			// Save the lines that we're going to obliterate.
-			GetConsoleScreenBufferInfo(co, &csbi);
-			oldLength = csbi.dwSize.X * (csbi.dwCursorPosition.Y - coordNextWrite.Y) + csbi.dwCursorPosition.X - coordNextWrite.X;
-
-			if (oldLength > 0)
-			{
-				LPVOID blank = malloc(oldLength);
-				if (!blank) return;
-				memset(blank, ' ', oldLength); // Blank out.
-				oldLines = malloc(oldLength*sizeof(TCHAR));
-				if (!oldLines)
-				{
-					free(blank);
-					return;
-				}
-
-				ReadConsoleOutputCharacter(co, oldLines, oldLength, coordNextWrite, &bytesWritten);
-
-				// Move to where we what to print - which is where we would've been,
-				// had console input not been in the way,
-				SetConsoleCursorPosition(co, coordNextWrite);
-
-				WriteConsoleA(co, blank, oldLength, &bytesWritten, NULL);
-				free(blank);
-
-				// And back to where we want to print again.
-				SetConsoleCursorPosition(co, coordNextWrite);
-			}
-
-			// Actually write the string now!
-			WriteConsoleA(co, txt, (DWORD)len, &bytesWritten, NULL);
-
-			// Next time, output where we left off.
-			GetConsoleScreenBufferInfo(co, &csbi);
-			coordNextWrite = csbi.dwCursorPosition;
-
-			// Restore what was overwritten.
-			if (oldLines && entering_con_command)
-				WriteConsole(co, oldLines, oldLength, &bytesWritten, NULL);
-			if (oldLines) free(oldLines);
-		}
-		else // Redirected to a file.
-			WriteFile(co, txt, (DWORD)len, &bytesWritten, NULL);
-	}
-#else
-#ifdef HAVE_TERMIOS
-	if (consolevent)
-	{
-		tty_Hide();
-	}
-#endif
-
-	if (!framebuffer)
-		fprintf(stderr, "%s", txt);
-#ifdef HAVE_TERMIOS
-	if (consolevent)
-	{
-		tty_Show();
-	}
-#endif
-
-	// 2004-03-03 AJR Since not all messages end in newline, some were getting displayed late.
-	if (!framebuffer)
-		fflush(stderr);
-
-#endif
-}
-
-//
-// I_GetKey
-//
-INT32 I_GetKey (void)
-{
-	// Warning: I_GetKey empties the event queue till next keypress
-	event_t *ev;
-	INT32 rc = 0;
-
-	// return the first keypress from the event queue
-	for (; eventtail != eventhead; eventtail = (eventtail+1)&(MAXEVENTS-1))
-	{
-		ev = &events[eventtail];
-		if (ev->type == ev_keydown || ev->type == ev_console)
-		{
-			rc = ev->data1;
-			continue;
-		}
-	}
-
-	return rc;
-}
-
-//
-// I_JoyScale
-//
-void I_JoyScale(void)
-{
-#ifdef GP2X
-	if (JoyInfo.dev && SDL_JoystickIndex(JoyInfo.dev) == 0)
-		Joystick.bGamepadStyle = true;
-	else
-#endif
-	Joystick.bGamepadStyle = cv_joyscale.value==0;
-	JoyInfo.scale = Joystick.bGamepadStyle?1:cv_joyscale.value;
-}
-
-void I_JoyScale2(void)
-{
-#ifdef GP2X
-	if (JoyInfo2.dev && SDL_JoystickIndex(JoyInfo2.dev) == 0)
-		Joystick.bGamepadStyle = true;
-	else
-#endif
-	Joystick2.bGamepadStyle = cv_joyscale2.value==0;
-	JoyInfo2.scale = Joystick2.bGamepadStyle?1:cv_joyscale2.value;
-}
-
-/**	\brief Joystick 1 buttons states
-*/
-static UINT64 lastjoybuttons = 0;
-
-/**	\brief Joystick 1 hats state
-*/
-static UINT64 lastjoyhats = 0;
-
-/**	\brief	Shuts down joystick 1
-
-
-	\return void
-
-
-*/
-static void I_ShutdownJoystick(void)
-{
-	INT32 i;
-	event_t event;
-	event.type=ev_keyup;
-	event.data2 = 0;
-	event.data3 = 0;
-
-	lastjoybuttons = lastjoyhats = 0;
-
-	// emulate the up of all joystick buttons
-	for (i=0;i<JOYBUTTONS;i++)
-	{
-		event.data1=KEY_JOY1+i;
-		D_PostEvent(&event);
-	}
-
-	// emulate the up of all joystick hats
-	for (i=0;i<JOYHATS*4;i++)
-	{
-		event.data1=KEY_HAT1+i;
-		D_PostEvent(&event);
-	}
-
-	// reset joystick position
-	event.type = ev_joystick;
-	for (i=0;i<JOYAXISSET; i++)
-	{
-		event.data1 = i;
-		D_PostEvent(&event);
-	}
-
-	joystick_started = 0;
-	JoyReset(&JoyInfo);
-	if (!joystick_started && !joystick2_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
-	{
-		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-		if (cv_usejoystick.value == 0)
-		{
-			I_OutputMsg("I_Joystick: SDL's Joystick system has been shutdown\n");
-		}
-	}
-}
-
-void I_GetJoystickEvents(void)
-{
-	static event_t event = {0,0,0,0};
-	INT32 i = 0;
-	UINT64 joyhats = 0;
-#if 0
-	UINT64 joybuttons = 0;
-	Sint16 axisx, axisy;
-#endif
-
-	if (!joystick_started) return;
-
-	if (!JoyInfo.dev) //I_ShutdownJoystick();
-		return;
-
-#if 0
-	//faB: look for as much buttons as g_input code supports,
-	//  we don't use the others
-	for (i = JoyInfo.buttons - 1; i >= 0; i--)
-	{
-		joybuttons <<= 1;
-		if (SDL_JoystickGetButton(JoyInfo.dev,i))
-			joybuttons |= 1;
-	}
-
-	if (joybuttons != lastjoybuttons)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newbuttons = joybuttons ^ lastjoybuttons;
-		lastjoybuttons = joybuttons;
-
-		for (i = 0; i < JOYBUTTONS; i++, j <<= 1)
-		{
-			if (newbuttons & j) // button changed state?
-			{
-				if (joybuttons & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-#ifdef _PSP
-				if (i == 12)
-					event.data1 = KEY_ESCAPE;
-				else
-#endif
-				event.data1 = KEY_JOY1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-#endif
-
-	for (i = JoyInfo.hats - 1; i >= 0; i--)
-	{
-		Uint8 hat = SDL_JoystickGetHat(JoyInfo.dev, i);
-
-		if (hat & SDL_HAT_UP   ) joyhats|=(UINT64)0x1<<(0 + 4*i);
-		if (hat & SDL_HAT_DOWN ) joyhats|=(UINT64)0x1<<(1 + 4*i);
-		if (hat & SDL_HAT_LEFT ) joyhats|=(UINT64)0x1<<(2 + 4*i);
-		if (hat & SDL_HAT_RIGHT) joyhats|=(UINT64)0x1<<(3 + 4*i);
-	}
-
-	if (joyhats != lastjoyhats)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newhats = joyhats ^ lastjoyhats;
-		lastjoyhats = joyhats;
-
-		for (i = 0; i < JOYHATS*4; i++, j <<= 1)
-		{
-			if (newhats & j) // hat changed state?
-			{
-				if (joyhats & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_HAT1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-
-#if 0
-	// send joystick axis positions
-	event.type = ev_joystick;
-
-	for (i = JOYAXISSET - 1; i >= 0; i--)
-	{
-		event.data1 = i;
-		if (i*2 + 1 <= JoyInfo.axises)
-			axisx = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 0);
-		else axisx = 0;
-		if (i*2 + 2 <= JoyInfo.axises)
-			axisy = SDL_JoystickGetAxis(JoyInfo.dev, i*2 + 1);
-		else axisy = 0;
-
-#ifdef _arch_dreamcast // -128 to 127
-		axisx = axisx*8;
-		axisy = axisy*8;
-#else // -32768 to 32767
-		axisx = axisx/32;
-		axisy = axisy/32;
-#endif
-
-		if (Joystick.bGamepadStyle)
-		{
-			// gamepad control type, on or off, live or die
-			if (axisx < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (axisx > (JOYAXISRANGE/2))
-				event.data2 = 1;
-			else event.data2 = 0;
-			if (axisy < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (axisy > (JOYAXISRANGE/2))
-				event.data3 = 1;
-			else event.data3 = 0;
-		}
-		else
-		{
-
-			axisx = JoyInfo.scale?((axisx/JoyInfo.scale)*JoyInfo.scale):axisx;
-			axisy = JoyInfo.scale?((axisy/JoyInfo.scale)*JoyInfo.scale):axisy;
-
-#ifdef SDL_JDEADZONE
-			if (-SDL_JDEADZONE <= axisx && axisx <= SDL_JDEADZONE) axisx = 0;
-			if (-SDL_JDEADZONE <= axisy && axisy <= SDL_JDEADZONE) axisy = 0;
-#endif
-
-			// analog control style , just send the raw data
-			event.data2 = axisx; // x axis
-			event.data3 = axisy; // y axis
-		}
-		D_PostEvent(&event);
-	}
-#endif
-}
-
-/**	\brief	Open joystick handle
-
-	\param	fname	name of joystick
-
-	\return	axises
-
-
-*/
-static int joy_open(const char *fname)
-{
-	int joyindex = atoi(fname);
-	int num_joy = 0;
-	int i;
-
-	if (joystick_started == 0 && joystick2_started == 0)
-	{
-		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
-		{
-			CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
-			return -1;
-		}
-		else
-		{
-			num_joy = SDL_NumJoysticks();
-		}
-
-		if (num_joy < joyindex)
-		{
-			CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
-			for (i = 0; i < num_joy; i++)
-				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
-			I_ShutdownJoystick();
-			return -1;
-		}
-	}
-	else
-	{
-		JoyReset(&JoyInfo);
-		//I_ShutdownJoystick();
-		//joy_open(fname);
-	}
-
-	num_joy = SDL_NumJoysticks();
-
-	if (joyindex <= 0 || num_joy == 0 || JoyInfo.oldjoy == joyindex)
-	{
-//		I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
-		if (num_joy != 0)
-		{
-			CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
-			for (i = 0; i < num_joy; i++)
-				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
-		}
-		else
-			CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
-		if (joyindex <= 0 || num_joy == 0) return 0;
-	}
-
-	JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
-	CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1));
-
-	if (JoyInfo.dev == NULL)
-	{
-		CONS_Printf(M_GetText("Couldn't open joystick: %s\n"), SDL_GetError());
-		I_ShutdownJoystick();
-		return -1;
-	}
-	else
-	{
-		JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
-		if (JoyInfo.axises > JOYAXISSET*2)
-			JoyInfo.axises = JOYAXISSET*2;
-/*		if (joyaxes<2)
-		{
-			I_OutputMsg("Not enought axes?\n");
-			I_ShutdownJoystick();
-			return 0;
-		}*/
-
-		JoyInfo.buttons = SDL_JoystickNumButtons(JoyInfo.dev);
-		if (JoyInfo.buttons > JOYBUTTONS)
-			JoyInfo.buttons = JOYBUTTONS;
-
-#ifdef DC
-		JoyInfo.hats = 0;
-#else
-		JoyInfo.hats = SDL_JoystickNumHats(JoyInfo.dev);
-		if (JoyInfo.hats > JOYHATS)
-			JoyInfo.hats = JOYHATS;
-
-		JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
-#endif
-
-		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad");
-
-		return JoyInfo.axises;
-	}
-}
-
-//Joystick2
-
-/**	\brief Joystick 2 buttons states
-*/
-static UINT64 lastjoy2buttons = 0;
-
-/**	\brief Joystick 2 hats state
-*/
-static UINT64 lastjoy2hats = 0;
-
-/**	\brief	Shuts down joystick 2
-
-
-	\return	void
-*/
-static void I_ShutdownJoystick2(void)
-{
-	INT32 i;
-	event_t event;
-	event.type = ev_keyup;
-	event.data2 = 0;
-	event.data3 = 0;
-
-	lastjoy2buttons = lastjoy2hats = 0;
-
-	// emulate the up of all joystick buttons
-	for (i = 0; i < JOYBUTTONS; i++)
-	{
-		event.data1 = KEY_2JOY1 + i;
-		D_PostEvent(&event);
-	}
-
-	// emulate the up of all joystick hats
-	for (i = 0; i < JOYHATS*4; i++)
-	{
-		event.data1 = KEY_2HAT1 + i;
-		D_PostEvent(&event);
-	}
-
-	// reset joystick position
-	event.type = ev_joystick2;
-	for (i = 0; i < JOYAXISSET; i++)
-	{
-		event.data1 = i;
-		D_PostEvent(&event);
-	}
-
-	JoyReset(&JoyInfo2);
-	if (!joystick_started && !joystick2_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
-	{
-		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-		if (cv_usejoystick2.value == 0)
-		{
-			DEBFILE("I_Joystick2: SDL's Joystick system has been shutdown\n");
-		}
-	}
-}
-
-void I_GetJoystick2Events(void)
-{
-	static event_t event = {0,0,0,0};
-	INT32 i = 0;
-	UINT64 joyhats = 0;
-#if 0
-	INT64 joybuttons = 0;
-	INT32 axisx, axisy;
-#endif
-
-	if (!joystick2_started)
-		return;
-
-	if (!JoyInfo2.dev) //I_ShutdownJoystick2();
-		return;
-
-
-#if 0
-	//faB: look for as much buttons as g_input code supports,
-	//  we don't use the others
-	for (i = JoyInfo2.buttons - 1; i >= 0; i--)
-	{
-		joybuttons <<= 1;
-		if (SDL_JoystickGetButton(JoyInfo2.dev,i))
-			joybuttons |= 1;
-	}
-
-	if (joybuttons != lastjoy2buttons)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newbuttons = joybuttons ^ lastjoy2buttons;
-		lastjoy2buttons = joybuttons;
-
-		for (i = 0; i < JOYBUTTONS; i++, j <<= 1)
-		{
-			if (newbuttons & j) // button changed state?
-			{
-				if (joybuttons & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_2JOY1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-#endif
-
-	for (i = JoyInfo2.hats - 1; i >= 0; i--)
-	{
-		Uint8 hat = SDL_JoystickGetHat(JoyInfo2.dev, i);
-
-		if (hat & SDL_HAT_UP   ) joyhats|=(UINT64)0x1<<(0 + 4*i);
-		if (hat & SDL_HAT_DOWN ) joyhats|=(UINT64)0x1<<(1 + 4*i);
-		if (hat & SDL_HAT_LEFT ) joyhats|=(UINT64)0x1<<(2 + 4*i);
-		if (hat & SDL_HAT_RIGHT) joyhats|=(UINT64)0x1<<(3 + 4*i);
-	}
-
-	if (joyhats != lastjoy2hats)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newhats = joyhats ^ lastjoy2hats;
-		lastjoy2hats = joyhats;
-
-		for (i = 0; i < JOYHATS*4; i++, j <<= 1)
-		{
-			if (newhats & j) // hat changed state?
-			{
-				if (joyhats & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_2HAT1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-
-#if 0
-	// send joystick axis positions
-	event.type = ev_joystick2;
-
-	for (i = JOYAXISSET - 1; i >= 0; i--)
-	{
-		event.data1 = i;
-		if (i*2 + 1 <= JoyInfo2.axises)
-			axisx = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 0);
-		else axisx = 0;
-		if (i*2 + 2 <= JoyInfo2.axises)
-			axisy = SDL_JoystickGetAxis(JoyInfo2.dev, i*2 + 1);
-		else axisy = 0;
-
-#ifdef _arch_dreamcast // -128 to 127
-		axisx = axisx*8;
-		axisy = axisy*8;
-#else // -32768 to 32767
-		axisx = axisx/32;
-		axisy = axisy/32;
-#endif
-
-		if (Joystick2.bGamepadStyle)
-		{
-			// gamepad control type, on or off, live or die
-			if (axisx < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (axisx > (JOYAXISRANGE/2))
-				event.data2 = 1;
-			else
-				event.data2 = 0;
-			if (axisy < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (axisy > (JOYAXISRANGE/2))
-				event.data3 = 1;
-			else
-				event.data3 = 0;
-		}
-		else
-		{
-
-			axisx = JoyInfo2.scale?((axisx/JoyInfo2.scale)*JoyInfo2.scale):axisx;
-			axisy = JoyInfo2.scale?((axisy/JoyInfo2.scale)*JoyInfo2.scale):axisy;
-
-#ifdef SDL_JDEADZONE
-			if (-SDL_JDEADZONE <= axisx && axisx <= SDL_JDEADZONE) axisx = 0;
-			if (-SDL_JDEADZONE <= axisy && axisy <= SDL_JDEADZONE) axisy = 0;
-#endif
-
-			// analog control style , just send the raw data
-			event.data2 = axisx; // x axis
-			event.data3 = axisy; // y axis
-		}
-		D_PostEvent(&event);
-	}
-#endif
-
-}
-
-/**	\brief	Open joystick handle
-
-	\param	fname	name of joystick
-
-	\return	axises
-
-
-*/
-static int joy_open2(const char *fname)
-{
-	int joyindex = atoi(fname);
-	int num_joy = 0;
-	int i;
-
-	if (joystick_started == 0 && joystick2_started == 0)
-	{
-		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
-		{
-			CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
-			return -1;
-		}
-		else
-			num_joy = SDL_NumJoysticks();
-
-		if (num_joy < joyindex)
-		{
-			CONS_Printf(M_GetText("Cannot use joystick #%d/(%s), it doesn't exist\n"),joyindex,fname);
-			for (i = 0; i < num_joy; i++)
-				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
-			I_ShutdownJoystick2();
-			return -1;
-		}
-	}
-	else
-	{
-		JoyReset(&JoyInfo2);
-		//I_ShutdownJoystick();
-		//joy_open(fname);
-	}
-
-	num_joy = SDL_NumJoysticks();
-
-	if (joyindex <= 0 || num_joy == 0 || JoyInfo2.oldjoy == joyindex)
-	{
-//		I_OutputMsg("Unable to use that joystick #(%s), non-number\n",fname);
-		if (num_joy != 0)
-		{
-			CONS_Printf(M_GetText("Found %d joysticks on this system\n"), num_joy);
-			for (i = 0; i < num_joy; i++)
-				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickName(i));
-		}
-		else
-			CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
-		if (joyindex <= 0 || num_joy == 0) return 0;
-	}
-
-	JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
-	CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1));
-
-	if (!JoyInfo2.dev)
-	{
-		CONS_Printf(M_GetText("Couldn't open joystick2: %s\n"), SDL_GetError());
-		I_ShutdownJoystick2();
-		return -1;
-	}
-	else
-	{
-		JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
-		if (JoyInfo2.axises > JOYAXISSET*2)
-			JoyInfo2.axises = JOYAXISSET*2;
-/*		if (joyaxes < 2)
-		{
-			I_OutputMsg("Not enought axes?\n");
-			I_ShutdownJoystick2();
-			return 0;
-		}*/
-
-		JoyInfo2.buttons = SDL_JoystickNumButtons(JoyInfo2.dev);
-		if (JoyInfo2.buttons > JOYBUTTONS)
-			JoyInfo2.buttons = JOYBUTTONS;
-
-#ifdef DC
-		JoyInfo2.hats = 0;
-#else
-		JoyInfo2.hats = SDL_JoystickNumHats(JoyInfo2.dev);
-		if (JoyInfo2.hats > JOYHATS)
-			JoyInfo2.hats = JOYHATS;
-
-		JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
-#endif
-
-		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad");
-
-		return JoyInfo2.axises;
-	}
-}
-
-//
-// I_InitJoystick
-//
-void I_InitJoystick(void)
-{
-	I_ShutdownJoystick();
-	if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy"))
-		return;
-	if (joy_open(cv_usejoystick.string) != -1)
-		JoyInfo.oldjoy = atoi(cv_usejoystick.string);
-	else
-	{
-		cv_usejoystick.value = 0;
-		return;
-	}
-	joystick_started = 1;
-}
-
-void I_InitJoystick2(void)
-{
-	I_ShutdownJoystick2();
-	if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy"))
-		return;
-	if (joy_open2(cv_usejoystick2.string) != -1)
-		JoyInfo2.oldjoy = atoi(cv_usejoystick2.string);
-	else
-	{
-		cv_usejoystick2.value = 0;
-		return;
-	}
-	joystick2_started = 1;
-}
-
-static void I_ShutdownInput(void)
-{
-	if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
-	{
-		JoyReset(&JoyInfo);
-		JoyReset(&JoyInfo2);
-		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-	}
-
-}
-
-INT32 I_NumJoys(void)
-{
-	INT32 numjoy = 0;
-	if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
-	{
-		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
-			numjoy = SDL_NumJoysticks();
-		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-	}
-	else
-		numjoy = SDL_NumJoysticks();
-	return numjoy;
-}
-
-const char *I_GetJoyName(INT32 joyindex)
-{
-	const char *joyname = "NA";
-	joyindex--; //SDL's Joystick System starts at 0, not 1
-	if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
-	{
-		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
-			joyname = SDL_JoystickName(joyindex);
-		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
-	}
-	else
-		joyname = SDL_JoystickName(joyindex);
-	return joyname;
-}
-
-#ifndef NOMUMBLE
-#ifdef HAVE_MUMBLE
-// Best Mumble positional audio settings:
-// Minimum distance 3.0 m
-// Bloom 175%
-// Maximum distance 80.0 m
-// Minimum volume 50%
-#define DEG2RAD (0.017453292519943295769236907684883l) // TAU/360 or PI/180
-#define MUMBLEUNIT (64.0f) // FRACUNITS in a Meter
-
-static struct {
-#ifdef WINMUMBLE
-	UINT32 uiVersion;
-	DWORD uiTick;
-#else
-	Uint32 uiVersion;
-	Uint32 uiTick;
-#endif
-	float fAvatarPosition[3];
-	float fAvatarFront[3];
-	float fAvatarTop[3]; // defaults to Y-is-up (only used for leaning)
-	wchar_t name[256]; // game name
-	float fCameraPosition[3];
-	float fCameraFront[3];
-	float fCameraTop[3]; // defaults to Y-is-up (only used for leaning)
-	wchar_t identity[256]; // player id
-#ifdef WINMUMBLE
-	UINT32 context_len;
-#else
-	Uint32 context_len;
-#endif
-	unsigned char context[256]; // server/team
-	wchar_t description[2048]; // game description
-} *mumble = NULL;
-#endif // HAVE_MUMBLE
-
-static void I_SetupMumble(void)
-{
-#ifdef WINMUMBLE
-	HANDLE hMap = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink");
-	if (!hMap)
-		return;
-
-	mumble = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(*mumble));
-	if (!mumble)
-		CloseHandle(hMap);
-#elif defined (HAVE_SHM)
-	int shmfd;
-	char memname[256];
-
-	snprintf(memname, 256, "/MumbleLink.%d", getuid());
-	shmfd = shm_open(memname, O_RDWR, S_IRUSR | S_IWUSR);
-
-	if(shmfd < 0)
-		return;
-
-	mumble = mmap(NULL, sizeof(*mumble), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, 0);
-	if (mumble == MAP_FAILED)
-		mumble = NULL;
-#endif
-}
-
-void I_UpdateMumble(const mobj_t *mobj, const listener_t listener)
-{
-#ifdef HAVE_MUMBLE
-	double angle;
-	fixed_t anglef;
-
-	if (!mumble)
-		return;
-
-	if(mumble->uiVersion != 2) {
-		wcsncpy(mumble->name, L"SRB2 "VERSIONSTRING, 256);
-		wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048);
-		mumble->uiVersion = 2;
-	}
-	mumble->uiTick++;
-
-	if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink.
-		mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
-		mumble->fAvatarFront[0] = 1.0f;
-		mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
-		mumble->fCameraPosition[0] = mumble->fCameraPosition[1] = mumble->fCameraPosition[2] = 0.0f;
-		mumble->fCameraFront[0] = 1.0f;
-		mumble->fCameraFront[1] = mumble->fCameraFront[2] = 0.0f;
-		return;
-	}
-
-	{
-		UINT8 *p = mumble->context;
-		WRITEMEM(p, server_context, 8);
-		WRITEINT16(p, gamemap);
-		mumble->context_len = p - mumble->context;
-	}
-
-	if (mobj) {
-		mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT;
-		mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT;
-		mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT;
-
-		anglef = AngleFixed(mobj->angle);
-		angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
-		mumble->fAvatarFront[0] = (float)cos(angle);
-		mumble->fAvatarFront[1] = 0.0f;
-		mumble->fAvatarFront[2] = (float)sin(angle);
-	} else {
-		mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f;
-		mumble->fAvatarFront[0] = 1.0f;
-		mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f;
-	}
-
-	mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT;
-	mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT;
-	mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT;
-
-	anglef = AngleFixed(listener.angle);
-	angle = FIXED_TO_FLOAT(anglef)*DEG2RAD;
-	mumble->fCameraFront[0] = (float)cos(angle);
-	mumble->fCameraFront[1] = 0.0f;
-	mumble->fCameraFront[2] = (float)sin(angle);
-#else
-	(void)mobj;
-	(void)listener;
-#endif // HAVE_MUMBLE
-}
-#undef WINMUMBLE
-#endif // NOMUMBLE
-
-#ifdef HAVE_TERMIOS
-
-void I_GetMouseEvents(void)
-{
-	static UINT8 mdata[5];
-	static INT32 i = 0,om2b = 0;
-	INT32 di, j, mlp, button;
-	event_t event;
-	const INT32 mswap[8] = {0, 4, 1, 5, 2, 6, 3, 7};
-
-	if (!mouse2_started) return;
-	for (mlp = 0; mlp < 20; mlp++)
-	{
-		for (; i < 5; i++)
-		{
-			di = read(fdmouse2, mdata+i, 1);
-			if (di == -1) return;
-		}
-		if ((mdata[0] & 0xf8) != 0x80)
-		{
-			for (j = 1; j < 5; j++)
-				if ((mdata[j] & 0xf8) == 0x80)
-					for (i = 0; i < 5-j; i++) // shift
-						mdata[i] = mdata[i+j];
-			if (i < 5) continue;
-		}
-		else
-		{
-			button = mswap[~mdata[0] & 0x07];
-			for (j = 0; j < MOUSEBUTTONS; j++)
-			{
-				if (om2b & (1<<j))
-				{
-					if (!(button & (1<<j))) //keyup
-					{
-						event.type = ev_keyup;
-						event.data1 = KEY_2MOUSE1+j;
-						D_PostEvent(&event);
-						om2b ^= 1 << j;
-					}
-				}
-				else
-				{
-					if (button & (1<<j))
-					{
-						event.type = ev_keydown;
-						event.data1 = KEY_2MOUSE1+j;
-						D_PostEvent(&event);
-						om2b ^= 1 << j;
-					}
-				}
-			}
-			event.data2 = ((SINT8)mdata[1])+((SINT8)mdata[3]);
-			event.data3 = ((SINT8)mdata[2])+((SINT8)mdata[4]);
-			if (event.data2 && event.data3)
-			{
-				event.type = ev_mouse2;
-				event.data1 = 0;
-				D_PostEvent(&event);
-			}
-		}
-		i = 0;
-	}
-}
-
-//
-// I_ShutdownMouse2
-//
-static void I_ShutdownMouse2(void)
-{
-	if (fdmouse2 != -1) close(fdmouse2);
-	mouse2_started = 0;
-}
-#elif defined (_WIN32) && !defined (_XBOX)
-
-static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
-
-static void I_ShutdownMouse2(void)
-{
-	event_t event;
-	INT32 i;
-
-	if (mouse2filehandle == INVALID_HANDLE_VALUE)
-		return;
-
-	SetCommMask(mouse2filehandle, 0);
-
-	EscapeCommFunction(mouse2filehandle, CLRDTR);
-	EscapeCommFunction(mouse2filehandle, CLRRTS);
-
-	PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT |
-	          PURGE_TXCLEAR | PURGE_RXCLEAR);
-
-	CloseHandle(mouse2filehandle);
-
-	// emulate the up of all mouse buttons
-	for (i = 0; i < MOUSEBUTTONS; i++)
-	{
-		event.type = ev_keyup;
-		event.data1 = KEY_2MOUSE1+i;
-		D_PostEvent(&event);
-	}
-
-	mouse2filehandle = INVALID_HANDLE_VALUE;
-}
-
-#define MOUSECOMBUFFERSIZE 256
-static INT32 handlermouse2x,handlermouse2y,handlermouse2buttons;
-
-static void I_PoolMouse2(void)
-{
-	UINT8 buffer[MOUSECOMBUFFERSIZE];
-	COMSTAT ComStat;
-	DWORD dwErrorFlags;
-	DWORD dwLength;
-	char dx,dy;
-
-	static INT32 bytenum;
-	static UINT8 combytes[4];
-	DWORD i;
-
-	ClearCommError(mouse2filehandle, &dwErrorFlags, &ComStat);
-	dwLength = min(MOUSECOMBUFFERSIZE, ComStat.cbInQue);
-
-	if (dwLength <= 0)
-		return;
-
-	if (!ReadFile(mouse2filehandle, buffer, dwLength, &dwLength, NULL))
-	{
-		CONS_Alert(CONS_WARNING, "%s", M_GetText("Read Error on secondary mouse port\n"));
-		return;
-	}
-
-	// parse the mouse packets
-	for (i = 0; i < dwLength; i++)
-	{
-		if ((buffer[i] & 64)== 64)
-			bytenum = 0;
-
-		if (bytenum < 4)
-			combytes[bytenum] = buffer[i];
-		bytenum++;
-
-		if (bytenum == 1)
-		{
-			handlermouse2buttons &= ~3;
-			handlermouse2buttons |= ((combytes[0] & (32+16)) >> 4);
-		}
-		else if (bytenum == 3)
-		{
-			dx = (char)((combytes[0] &  3) << 6);
-			dy = (char)((combytes[0] & 12) << 4);
-			dx = (char)(dx + combytes[1]);
-			dy = (char)(dy + combytes[2]);
-			handlermouse2x+= dx;
-			handlermouse2y+= dy;
-		}
-		else if (bytenum == 4) // fourth UINT8 (logitech mouses)
-		{
-			if (buffer[i] & 32)
-				handlermouse2buttons |= 4;
-			else
-				handlermouse2buttons &= ~4;
-		}
-	}
-}
-
-void I_GetMouseEvents(void)
-{
-	static UINT8 lastbuttons2 = 0; //mouse movement
-	event_t event;
-
-	if (mouse2filehandle == INVALID_HANDLE_VALUE)
-		return;
-
-	I_PoolMouse2();
-	// post key event for buttons
-	if (handlermouse2buttons != lastbuttons2)
-	{
-		INT32 i, j = 1, k;
-		k = (handlermouse2buttons ^ lastbuttons2); // only changed bit to 1
-		lastbuttons2 = (UINT8)handlermouse2buttons;
-
-		for (i = 0; i < MOUSEBUTTONS; i++, j <<= 1)
-			if (k & j)
-			{
-				if (handlermouse2buttons & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_2MOUSE1+i;
-				D_PostEvent(&event);
-			}
-	}
-
-	if (handlermouse2x != 0 || handlermouse2y != 0)
-	{
-		event.type = ev_mouse2;
-		event.data1 = 0;
-//		event.data1 = buttons; // not needed
-		event.data2 = handlermouse2x << 1;
-		event.data3 = -handlermouse2y << 1;
-		handlermouse2x = 0;
-		handlermouse2y = 0;
-
-		D_PostEvent(&event);
-	}
-}
-#else
-void I_GetMouseEvents(void){};
-#endif
-
-//
-// I_StartupMouse2
-//
-void I_StartupMouse2(void)
-{
-#ifdef HAVE_TERMIOS
-	struct termios m2tio;
-	size_t i;
-	INT32 dtr = -1, rts = -1;;
-	I_ShutdownMouse2();
-	if (cv_usemouse2.value == 0) return;
-	if ((fdmouse2 = open(cv_mouse2port.string, O_RDONLY|O_NONBLOCK|O_NOCTTY)) == -1)
-	{
-		CONS_Printf(M_GetText("Error opening %s!\n"), cv_mouse2port.string);
-		return;
-	}
-	tcflush(fdmouse2, TCIOFLUSH);
-	m2tio.c_iflag = IGNBRK;
-	m2tio.c_oflag = 0;
-	m2tio.c_cflag = CREAD|CLOCAL|HUPCL|CS8|CSTOPB|B1200;
-	m2tio.c_lflag = 0;
-	m2tio.c_cc[VTIME] = 0;
-	m2tio.c_cc[VMIN] = 1;
-	tcsetattr(fdmouse2, TCSANOW, &m2tio);
-	for (i = 0; i < strlen(cv_mouse2opt.string); i++)
-	{
-		if (toupper(cv_mouse2opt.string[i]) == 'D')
-		{
-			if (cv_mouse2opt.string[i+1] == '-')
-				dtr = 0;
-			else
-				dtr = 1;
-		}
-		if (toupper(cv_mouse2opt.string[i]) == 'R')
-		{
-			if (cv_mouse2opt.string[i+1] == '-')
-				rts = 0;
-			else
-				rts = 1;
-		}
-		if (dtr != -1 || rts != -1)
-		{
-			INT32 c;
-			if (!ioctl(fdmouse2, TIOCMGET, &c))
-			{
-				if (!dtr)
-					c &= ~TIOCM_DTR;
-				else if (dtr > 0)
-					c |= TIOCM_DTR;
-			}
-			if (!rts)
-				c &= ~TIOCM_RTS;
-			else if (rts > 0)
-				c |= TIOCM_RTS;
-			ioctl(fdmouse2, TIOCMSET, &c);
-		}
-	}
-	mouse2_started = 1;
-	I_AddExitFunc(I_ShutdownMouse2);
-#elif defined (_WIN32) && !defined (_XBOX)
-	DCB dcb;
-
-	if (mouse2filehandle != INVALID_HANDLE_VALUE)
-		I_ShutdownMouse2();
-
-	if (cv_usemouse2.value == 0)
-		return;
-
-	if (mouse2filehandle == INVALID_HANDLE_VALUE)
-	{
-		// COM file handle
-		mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ | GENERIC_WRITE,
-		                               0,                     // exclusive access
-		                               NULL,                  // no security attrs
-		                               OPEN_EXISTING,
-		                               FILE_ATTRIBUTE_NORMAL,
-		                               NULL);
-		if (mouse2filehandle == INVALID_HANDLE_VALUE)
-		{
-			INT32 e = GetLastError();
-			if (e == 5)
-				CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: Access denied\n"), cv_mouse2port.string);
-			else
-				CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: error %d\n"), cv_mouse2port.string, e);
-			return;
-		}
-	}
-
-	// getevent when somthing happens
-	//SetCommMask(mouse2filehandle, EV_RXCHAR);
-
-	// buffers
-	SetupComm(mouse2filehandle, MOUSECOMBUFFERSIZE, MOUSECOMBUFFERSIZE);
-
-	// purge buffers
-	PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT
-	          | PURGE_TXCLEAR | PURGE_RXCLEAR);
-
-	// setup port to 1200 7N1
-	dcb.DCBlength = sizeof (DCB);
-
-	GetCommState(mouse2filehandle, &dcb);
-
-	dcb.BaudRate = CBR_1200;
-	dcb.ByteSize = 7;
-	dcb.Parity = NOPARITY;
-	dcb.StopBits = ONESTOPBIT;
-
-	dcb.fDtrControl = DTR_CONTROL_ENABLE;
-	dcb.fRtsControl = RTS_CONTROL_ENABLE;
-
-	dcb.fBinary = TRUE;
-	dcb.fParity = TRUE;
-
-	SetCommState(mouse2filehandle, &dcb);
-	I_AddExitFunc(I_ShutdownMouse2);
-#endif
-}
-
-//
-// I_Tactile
-//
-void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect)
-{
-	// UNUSED.
-	(void)pFFType;
-	(void)FFEffect;
-}
-
-void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect)
-{
-	// UNUSED.
-	(void)pFFType;
-	(void)FFEffect;
-}
-
-/**	\brief empty ticcmd for player 1
-*/
-static ticcmd_t emptycmd;
-
-ticcmd_t *I_BaseTiccmd(void)
-{
-	return &emptycmd;
-}
-
-/**	\brief empty ticcmd for player 2
-*/
-static ticcmd_t emptycmd2;
-
-ticcmd_t *I_BaseTiccmd2(void)
-{
-	return &emptycmd2;
-}
-
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-static HMODULE winmm = NULL;
-static DWORD starttickcount = 0; // hack for win2k time bug
-static p_timeGetTime pfntimeGetTime = NULL;
-
-// ---------
-// I_GetTime
-// Use the High Resolution Timer if available,
-// else use the multimedia timer which has 1 millisecond precision on Windowz 95,
-// but lower precision on Windows NT
-// ---------
-
-tic_t I_GetTime(void)
-{
-	tic_t newtics = 0;
-
-	if (!starttickcount) // high precision timer
-	{
-		LARGE_INTEGER currtime; // use only LowPart if high resolution counter is not available
-		static LARGE_INTEGER basetime = {{0, 0}};
-
-		// use this if High Resolution timer is found
-		static LARGE_INTEGER frequency;
-
-		if (!basetime.LowPart)
-		{
-			if (!QueryPerformanceFrequency(&frequency))
-				frequency.QuadPart = 0;
-			else
-				QueryPerformanceCounter(&basetime);
-		}
-
-		if (frequency.LowPart && QueryPerformanceCounter(&currtime))
-		{
-			newtics = (INT32)((currtime.QuadPart - basetime.QuadPart) * NEWTICRATE
-				/ frequency.QuadPart);
-		}
-		else if (pfntimeGetTime)
-		{
-			currtime.LowPart = pfntimeGetTime();
-			if (!basetime.LowPart)
-				basetime.LowPart = currtime.LowPart;
-			newtics = ((currtime.LowPart - basetime.LowPart)/(1000/NEWTICRATE));
-		}
-	}
-	else
-		newtics = (GetTickCount() - starttickcount)/(1000/NEWTICRATE);
-
-	return newtics;
-}
-
-static void I_ShutdownTimer(void)
-{
-	pfntimeGetTime = NULL;
-	if (winmm)
-	{
-		p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod");
-		if (pfntimeEndPeriod)
-			pfntimeEndPeriod(1);
-		FreeLibrary(winmm);
-		winmm = NULL;
-	}
-}
-#else
-//
-// I_GetTime
-// returns time in 1/TICRATE second tics
-//
-tic_t I_GetTime (void)
-{
-#ifdef _arch_dreamcast
-	static Uint64 basetime = 0;
-	       Uint64 ticks = timer_ms_gettime64(); //using timer_ms_gettime64 instand of SDL_GetTicks for the Dreamcast
-#else
-	static Uint32 basetime = 0;
-	       Uint32 ticks = SDL_GetTicks();
-#endif
-
-	if (!basetime)
-		basetime = ticks;
-
-	ticks -= basetime;
-
-	ticks = (ticks*TICRATE);
-
-#if 0 //#ifdef _WIN32_WCE
-	ticks = (ticks/10);
-#else
-	ticks = (ticks/1000);
-#endif
-
-	return (tic_t)ticks;
-}
-#endif
-
-//
-//I_StartupTimer
-//
-void I_StartupTimer(void)
-{
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-	// for win2k time bug
-	if (M_CheckParm("-gettickcount"))
-	{
-		starttickcount = GetTickCount();
-		CONS_Printf("%s", M_GetText("Using GetTickCount()\n"));
-	}
-	winmm = LoadLibraryA("winmm.dll");
-	if (winmm)
-	{
-		p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod");
-		if (pfntimeBeginPeriod)
-			pfntimeBeginPeriod(1);
-		pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime");
-	}
-	I_AddExitFunc(I_ShutdownTimer);
-#elif 0 //#elif !defined (_arch_dreamcast) && !defined(GP2X) // the DC have it own timer and GP2X have broken pthreads?
-	if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0)
-		I_Error("SRB2: Needs SDL_Timer, Error: %s", SDL_GetError());
-#endif
-}
-
-
-
-void I_Sleep(void)
-{
-#if !(defined (_arch_dreamcast) || defined (_XBOX))
-	if (cv_sleep.value != -1)
-		SDL_Delay(cv_sleep.value);
-#endif
-}
-
-INT32 I_StartupSystem(void)
-{
-	SDL_version SDLcompiled;
-	const SDL_version *SDLlinked;
-#ifdef _XBOX
-#ifdef __GNUC__
-	char DP[] ="      Sonic Robo Blast 2!\n";
-	debugPrint(DP);
-#endif
-	unlink("e:/Games/SRB2/stdout.txt");
-	freopen("e:/Games/SRB2/stdout.txt", "w+", stdout);
-	unlink("e:/Games/SRB2/stderr.txt");
-	freopen("e:/Games/SRB2/stderr.txt", "w+", stderr);
-#endif
-#ifdef _arch_dreamcast
-#ifdef _DEBUG
-	//gdb_init();
-#endif
-	printf(__FILE__":%i\n",__LINE__);
-#ifdef _DEBUG
-	//gdb_breakpoint();
-#endif
-#endif
-	SDL_VERSION(&SDLcompiled)
-	SDLlinked = SDL_Linked_Version();
-	I_StartupConsole();
-	I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
-	 SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
-	I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
-	 SDLlinked->major, SDLlinked->minor, SDLlinked->patch);
-#if 0 //#ifdef GP2X //start up everything
-	if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
-#else
-	if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0)
-#endif
-		I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
-#ifndef NOMUMBLE
-	I_SetupMumble();
-#endif
-	return 0;
-}
-
-
-//
-// I_Quit
-//
-void I_Quit(void)
-{
-	static SDL_bool quiting = SDL_FALSE;
-
-	/* prevent recursive I_Quit() */
-	if (quiting) goto death;
-	SDLforceUngrabMouse();
-	quiting = SDL_FALSE;
-	I_ShutdownConsole();
-	M_SaveConfig(NULL); //save game config, cvars..
-#ifndef NONET
-	D_SaveBan(); // save the ban list
-#endif
-	G_SaveGameData(); // Tails 12-08-2002
-	//added:16-02-98: when recording a demo, should exit using 'q' key,
-	//        but sometimes we forget and use 'F10'.. so save here too.
-
-	if (demorecording)
-		G_CheckDemoStatus();
-	if (metalrecording)
-		G_StopMetalRecording();
-
-	D_QuitNetGame();
-	I_ShutdownMusic();
-	I_ShutdownSound();
-	I_ShutdownCD();
-	// use this for 1.28 19990220 by Kin
-	I_ShutdownGraphics();
-	I_ShutdownInput();
-	I_ShutdownSystem();
-#ifndef _arch_dreamcast
-	SDL_Quit();
-#endif
-	/* if option -noendtxt is set, don't print the text */
-	if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM") != LUMPERROR)
-	{
-		printf("\r");
-		ShowEndTxt();
-	}
-death:
-	W_Shutdown();
-#ifdef GP2X
-	chdir("/usr/gp2x");
-	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-	exit(0);
-}
-
-void I_WaitVBL(INT32 count)
-{
-	count = 1;
-	SDL_Delay(count);
-}
-
-void I_BeginRead(void)
-{
-}
-
-void I_EndRead(void)
-{
-}
-
-//
-// I_Error
-//
-/**	\brief phuck recursive errors
-*/
-static INT32 errorcount = 0;
-
-/**	\brief recursive error detecting
-*/
-static boolean shutdowning = false;
-
-void I_Error(const char *error, ...)
-{
-	va_list argptr;
-#if (defined (MAC_ALERT) || defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
-	char buffer[8192];
-#endif
-
-	// recursive error detecting
-	if (shutdowning)
-	{
-		errorcount++;
-		if (errorcount == 1)
-			SDLforceUngrabMouse();
-		// try to shutdown each subsystem separately
-		if (errorcount == 2)
-			I_ShutdownMusic();
-		if (errorcount == 3)
-			I_ShutdownSound();
-		if (errorcount == 4)
-			I_ShutdownCD();
-		if (errorcount == 5)
-			I_ShutdownGraphics();
-		if (errorcount == 6)
-			I_ShutdownInput();
-		if (errorcount == 7)
-			I_ShutdownSystem();
-#ifndef _arch_dreamcast
-		if (errorcount == 8)
-			SDL_Quit();
-#endif
-		if (errorcount == 9)
-		{
-			M_SaveConfig(NULL);
-			G_SaveGameData();
-		}
-		if (errorcount > 20)
-		{
-#ifdef MAC_ALERT
-			va_start(argptr, error);
-			vsprintf(buffer, error, argptr);
-			va_end(argptr);
-			// 2004-03-03 AJR Since the Mac user is most likely double clicking to run the game, give them a panel.
-			MacShowAlert("Recursive Error", buffer, "Quit", NULL, NULL);
-#elif (defined (_WIN32) || (defined (_WIN32_WCE)) && !defined (__GNUC__)) && !defined (_XBOX)
-			va_start(argptr,error);
-			vsprintf(buffer, error, argptr);
-			va_end(argptr);
-#ifndef _WIN32_WCE
-			{
-				HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-				DWORD bytesWritten;
-				if (co != INVALID_HANDLE_VALUE)
-				{
-					if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten))
-						WriteConsoleA(co, buffer, (DWORD)strlen(buffer), NULL, NULL);
-					else
-						WriteFile(co, buffer, (DWORD)strlen(buffer), &bytesWritten, NULL);
-				}
-			}
-#endif
-			OutputDebugStringA(buffer);
-			MessageBoxA(vid.WndParent, buffer, "SRB2 Recursive Error", MB_OK|MB_ICONERROR);
-#else
-			// Don't print garbage
-			va_start(argptr, error);
-			if (!framebuffer)
-				vfprintf (stderr, error, argptr);
-			va_end(argptr);
-#endif
-			W_Shutdown();
-#ifdef GP2X
-			chdir("/usr/gp2x");
-			execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-			exit(-1); // recursive errors detected
-		}
-	}
-	shutdowning = true;
-	I_ShutdownConsole();
-#ifndef MAC_ALERT
-	// Message first.
-	va_start(argptr,error);
-	if (!framebuffer)
-	{
-		fprintf(stderr, "Error: ");
-		vfprintf(stderr,error,argptr);
-		fprintf(stderr, "\n");
-	}
-	va_end(argptr);
-
-	if (!framebuffer)
-		fflush(stderr);
-#endif
-	M_SaveConfig(NULL); // save game config, cvars..
-#ifndef NONET
-	D_SaveBan(); // save the ban list
-#endif
-	G_SaveGameData(); // Tails 12-08-2002
-
-	// Shutdown. Here might be other errors.
-	if (demorecording)
-		G_CheckDemoStatus();
-	if (metalrecording)
-		G_StopMetalRecording();
-
-	D_QuitNetGame();
-	I_ShutdownMusic();
-	I_ShutdownSound();
-	I_ShutdownCD();
-	// use this for 1.28 19990220 by Kin
-	I_ShutdownGraphics();
-	I_ShutdownInput();
-	I_ShutdownSystem();
-#ifndef _arch_dreamcast
-	SDL_Quit();
-#endif
-#ifdef MAC_ALERT
-	va_start(argptr, error);
-	vsprintf(buffer, error, argptr);
-	va_end(argptr);
-	// 2004-03-03 AJR Since the Mac user is most likely double clicking to run the game, give them a panel.
-	MacShowAlert("Critical Error", buffer, "Quit", NULL, NULL);
-#endif
-	W_Shutdown();
-#if defined (PARANOIA) && defined (__CYGWIN__)
-		*(INT32 *)2 = 4; //Alam: Debug!
-#endif
-#ifdef GP2X
-	chdir("/usr/gp2x");
-	execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
-#endif
-	exit(-1);
-}
-
-/**	\brief quit function table
-*/
-static quitfuncptr quit_funcs[MAX_QUIT_FUNCS]; /* initialized to all bits 0 */
-
-//
-//  Adds a function to the list that need to be called by I_SystemShutdown().
-//
-void I_AddExitFunc(void (*func)())
-{
-	INT32 c;
-
-	for (c = 0; c < MAX_QUIT_FUNCS; c++)
-	{
-		if (!quit_funcs[c])
-		{
-			quit_funcs[c] = func;
-			break;
-		}
-	}
-}
-
-
-//
-//  Removes a function from the list that need to be called by
-//   I_SystemShutdown().
-//
-void I_RemoveExitFunc(void (*func)())
-{
-	INT32 c;
-
-	for (c = 0; c < MAX_QUIT_FUNCS; c++)
-	{
-		if (quit_funcs[c] == func)
-		{
-			while (c < MAX_QUIT_FUNCS-1)
-			{
-				quit_funcs[c] = quit_funcs[c+1];
-				c++;
-			}
-			quit_funcs[MAX_QUIT_FUNCS-1] = NULL;
-			break;
-		}
-	}
-}
-
-//
-//  Closes down everything. This includes restoring the initial
-//  palette and video mode, and removing whatever mouse, keyboard, and
-//  timer routines have been installed.
-//
-//  NOTE: Shutdown user funcs are effectively called in reverse order.
-//
-void I_ShutdownSystem(void)
-{
-	INT32 c;
-
-	for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
-		if (quit_funcs[c])
-			(*quit_funcs[c])();
-#ifdef  LOGMESSAGES
-	if (logstream)
-	{
-		fclose(logstream);
-		logstream = NULL;
-	}
-#endif
-
-}
-
-void I_GetDiskFreeSpace(INT64 *freespace)
-{
-#if defined (_arch_dreamcast) || defined (_PSP)
-	*freespace = 0;
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#if defined (SOLARIS) || defined (__HAIKU__) || defined (_WII) || defined (_PS3)
-	*freespace = INT32_MAX;
-	return;
-#else // Both Linux and BSD have this, apparently.
-	struct statfs stfs;
-	if (statfs(".", &stfs) == -1)
-	{
-		*freespace = INT32_MAX;
-		return;
-	}
-	*freespace = stfs.f_bavail * stfs.f_bsize;
-#endif
-#elif (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-	static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
-	static boolean testwin95 = false;
-	ULARGE_INTEGER usedbytes, lfreespace;
-
-	if (!testwin95)
-	{
-		pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
-		testwin95 = true;
-	}
-	if (pfnGetDiskFreeSpaceEx)
-	{
-		if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
-			*freespace = lfreespace.QuadPart;
-		else
-			*freespace = INT32_MAX;
-	}
-	else
-	{
-		DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters;
-		GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector,
-		                 &NumberOfFreeClusters, &TotalNumberOfClusters);
-		*freespace = BytesPerSector*SectorsPerCluster*NumberOfFreeClusters;
-	}
-#else // Dummy for platform independent; 1GB should be enough
-	*freespace = 1024*1024*1024;
-#endif
-}
-
-char *I_GetUserName(void)
-{
-#ifdef GP2X
-	static char username[MAXPLAYERNAME] = "GP2XUSER";
-	return username;
-#elif defined (PSP)
-	static char username[MAXPLAYERNAME] = "PSPUSER";
-	return username;
-#elif !(defined (_WIN32_WCE) || defined (_XBOX))
-	static char username[MAXPLAYERNAME];
-	char *p;
-#ifdef _WIN32
-	DWORD i = MAXPLAYERNAME;
-
-	if (!GetUserNameA(username, &i))
-#endif
-	{
-		p = I_GetEnv("USER");
-		if (!p)
-		{
-			p = I_GetEnv("user");
-			if (!p)
-			{
-				p = I_GetEnv("USERNAME");
-				if (!p)
-				{
-					p = I_GetEnv("username");
-					if (!p)
-					{
-						return NULL;
-					}
-				}
-			}
-		}
-		strncpy(username, p, MAXPLAYERNAME);
-	}
-
-
-	if (strcmp(username, "") != 0)
-		return username;
-#endif
-	return NULL; // dummy for platform independent version
-}
-
-INT32 I_mkdir(const char *dirname, INT32 unixright)
-{
-//[segabor]
-#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) || defined (__CYGWIN__) || defined (__OS2__)
-	return mkdir(dirname, unixright);
-#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
-	UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt...
-	return CreateDirectoryA(dirname, NULL);
-#else
-	(void)dirname;
-	(void)unixright;
-	return false;
-#endif
-}
-
-char *I_GetEnv(const char *name)
-{
-#ifdef NEED_SDL_GETENV
-	return SDL_getenv(name);
-#elif defined(_WIN32_WCE)
-	(void)name;
-	return NULL;
-#else
-	return getenv(name);
-#endif
-}
-
-INT32 I_PutEnv(char *variable)
-{
-#ifdef NEED_SDL_GETENV
-	return SDL_putenv(variable);
-#elif defined(_WIN32_WCE)
-	return ((variable)?-1:0);
-#else
-	return putenv(variable);
-#endif
-}
-
-INT32 I_ClipboardCopy(const char *data, size_t size)
-{
-	(void)data;
-	(void)size;
-	return -1;
-}
-
-char *I_ClipboardPaste(void)
-{
-	return NULL;
-}
-
-/**	\brief	The isWadPathOk function
-
-	\param	path	string path to check
-
-	\return if true, wad file found
-
-
-*/
-static boolean isWadPathOk(const char *path)
-{
-	char *wad3path = malloc(256);
-
-	if (!wad3path)
-		return false;
-
-	sprintf(wad3path, pandf, path, WADKEYWORD1);
-
-	if (FIL_ReadFileOK(wad3path))
-	{
-		free(wad3path);
-		return true;
-	}
-
-	sprintf(wad3path, pandf, path, WADKEYWORD2);
-
-	if (FIL_ReadFileOK(wad3path))
-	{
-		free(wad3path);
-		return true;
-	}
-
-	free(wad3path);
-	return false;
-}
-
-static void pathonly(char *s)
-{
-	size_t j;
-
-	for (j = strlen(s); j != (size_t)-1; j--)
-		if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
-		{
-			if (s[j] == ':') s[j+1] = 0;
-			else s[j] = 0;
-			return;
-		}
-}
-
-/**	\brief	search for srb2.srb in the given path
-
-	\param	searchDir	starting path
-
-	\return	WAD path if not NULL
-
-
-*/
-static const char *searchWad(const char *searchDir)
-{
-	static char tempsw[256] = "";
-	filestatus_t fstemp;
-
-	strcpy(tempsw, WADKEYWORD1);
-	fstemp = filesearch(tempsw,searchDir,NULL,true,20);
-	if (fstemp == FS_FOUND)
-	{
-		pathonly(tempsw);
-		return tempsw;
-	}
-
-	strcpy(tempsw, WADKEYWORD2);
-	fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
-	if (fstemp == FS_FOUND)
-	{
-		pathonly(tempsw);
-		return tempsw;
-	}
-	return NULL;
-}
-
-/**	\brief go through all possible paths and look for srb2.srb
-
-  \return path to srb2.srb if any
-*/
-static const char *locateWad(void)
-{
-	const char *envstr;
-	const char *WadPath;
-
-	I_OutputMsg("SRB2WADDIR");
-	// does SRB2WADDIR exist?
-	if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr))
-		return envstr;
-
-#if defined(_WIN32_WCE) || defined(_PS3) || defined(_PSP)
-	// examine argv[0]
-	strcpy(returnWadPath, myargv[0]);
-	pathonly(returnWadPath);
-	I_PutEnv(va("HOME=%s",returnWadPath));
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-
-#ifndef NOCWD
-	I_OutputMsg(",.");
-	// examine current dir
-	strcpy(returnWadPath, ".");
-	if (isWadPathOk(returnWadPath))
-		return NULL;
-#endif
-
-	// examine default dirs
-#ifdef DEFAULTWADLOCATION1
-	I_OutputMsg(","DEFAULTWADLOCATION1);
-	strcpy(returnWadPath, DEFAULTWADLOCATION1);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION2
-	I_OutputMsg(","DEFAULTWADLOCATION2);
-	strcpy(returnWadPath, DEFAULTWADLOCATION2);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION3
-	I_OutputMsg(","DEFAULTWADLOCATION3);
-	strcpy(returnWadPath, DEFAULTWADLOCATION3);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION4
-	I_OutputMsg(","DEFAULTWADLOCATION4);
-	strcpy(returnWadPath, DEFAULTWADLOCATION4);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION5
-	I_OutputMsg(","DEFAULTWADLOCATION5);
-	strcpy(returnWadPath, DEFAULTWADLOCATION5);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION6
-	I_OutputMsg(","DEFAULTWADLOCATION6);
-	strcpy(returnWadPath, DEFAULTWADLOCATION6);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifdef DEFAULTWADLOCATION7
-	I_OutputMsg(","DEFAULTWADLOCATION7);
-	strcpy(returnWadPath, DEFAULTWADLOCATION7);
-	if (isWadPathOk(returnWadPath))
-		return returnWadPath;
-#endif
-#ifndef NOHOME
-	// find in $HOME
-	I_OutputMsg(",HOME");
-	if ((envstr = I_GetEnv("HOME")) != NULL)
-	{
-		WadPath = searchWad(envstr);
-		if (WadPath)
-			return WadPath;
-	}
-#endif
-#ifdef DEFAULTSEARCHPATH1
-	// find in /usr/local
-	I_OutputMsg(", in:"DEFAULTSEARCHPATH1);
-	WadPath = searchWad(DEFAULTSEARCHPATH1);
-	if (WadPath)
-		return WadPath;
-#endif
-#ifdef DEFAULTSEARCHPATH2
-	// find in /usr/games
-	I_OutputMsg(", in:"DEFAULTSEARCHPATH2);
-	WadPath = searchWad(DEFAULTSEARCHPATH2);
-	if (WadPath)
-		return WadPath;
-#endif
-#ifdef DEFAULTSEARCHPATH3
-	// find in ???
-	I_OutputMsg(", in:"DEFAULTSEARCHPATH3);
-	WadPath = searchWad(DEFAULTSEARCHPATH3);
-	if (WadPath)
-		return WadPath;
-#endif
-	// if nothing was found
-	return NULL;
-}
-
-const char *I_LocateWad(void)
-{
-	const char *waddir;
-
-	I_OutputMsg("Looking for WADs in: ");
-	waddir = locateWad();
-	I_OutputMsg("\n");
-
-	if (waddir)
-	{
-		// change to the directory where we found srb2.srb
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-		SetCurrentDirectoryA(waddir);
-#elif !defined (_WIN32_WCE) && !defined (_PS3)
-		if (chdir(waddir) == -1)
-			I_OutputMsg("Couldn't change working directory\n");
-#endif
-	}
-	return waddir;
-}
-
-#ifdef LINUX
-#define MEMINFO_FILE "/proc/meminfo"
-#define MEMTOTAL "MemTotal:"
-#define MEMFREE "MemFree:"
-#endif
-
-// quick fix for compil
-UINT32 I_GetFreeMem(UINT32 *total)
-{
-#if defined (_arch_dreamcast)
-	//Dreamcast!
-	if (total)
-		*total = 16<<20;
-	return 8<<20;
-#elif defined (_PSP)
-	// PSP
-	if (total)
-		*total = 32<<20;
-	return 16<<20;
-#elif defined (FREEBSD)
-	struct vmmeter sum;
-	kvm_t *kd;
-	struct nlist namelist[] =
-	{
-#define X_SUM   0
-		{"_cnt"},
-		{NULL}
-	};
-	if ((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open")) == NULL)
-	{
-		*total = 0L;
-		return 0;
-	}
-	if (kvm_nlist(kd, namelist) != 0)
-	{
-		kvm_close (kd);
-		*total = 0L;
-		return 0;
-	}
-	if (kvm_read(kd, namelist[X_SUM].n_value, &sum,
-		sizeof (sum)) != sizeof (sum))
-	{
-		kvm_close(kd);
-		*total = 0L;
-		return 0;
-	}
-	kvm_close(kd);
-
-	if (total)
-		*total = sum.v_page_count * sum.v_page_size;
-	return sum.v_free_count * sum.v_page_size;
-#elif defined (SOLARIS)
-	/* Just guess */
-	if (total)
-		*total = 32 << 20;
-	return 32 << 20;
-#elif defined (LINUX)
-	/* Linux */
-	char buf[1024];
-	char *memTag;
-	UINT32 freeKBytes;
-	UINT32 totalKBytes;
-	INT32 n;
-	INT32 meminfo_fd = -1;
-
-	meminfo_fd = open(MEMINFO_FILE, O_RDONLY);
-	n = read(meminfo_fd, buf, 1023);
-	close(meminfo_fd);
-
-	if (n < 0)
-	{
-		// Error
-		*total = 0L;
-		return 0;
-	}
-
-	buf[n] = '\0';
-	if (NULL == (memTag = strstr(buf, MEMTOTAL)))
-	{
-		// Error
-		*total = 0L;
-		return 0;
-	}
-
-	memTag += sizeof (MEMTOTAL);
-	totalKBytes = atoi(memTag);
-
-	if (NULL == (memTag = strstr(buf, MEMFREE)))
-	{
-		// Error
-		*total = 0L;
-		return 0;
-	}
-
-	memTag += sizeof (MEMFREE);
-	freeKBytes = atoi(memTag);
-
-	if (total)
-		*total = totalKBytes << 10;
-	return freeKBytes << 10;
-#elif (defined (_WIN32) || (defined (_WIN32_WCE) && !defined (__GNUC__))) && !defined (_XBOX)
-	MEMORYSTATUS info;
-
-	info.dwLength = sizeof (MEMORYSTATUS);
-	GlobalMemoryStatus( &info );
-	if (total)
-		*total = (UINT32)info.dwTotalPhys;
-	return (UINT32)info.dwAvailPhys;
-#elif defined (__OS2__)
-	UINT32 pr_arena;
-
-	if (total)
-		DosQuerySysInfo( QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
-							(PVOID) total, sizeof (UINT32));
-	DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM,
-				(PVOID) &pr_arena, sizeof (UINT32));
-
-	return pr_arena;
-#else
-	// Guess 48 MB.
-	if (total)
-		*total = 48<<20;
-	return 48<<20;
-#endif /* LINUX */
-}
-
-const CPUInfoFlags *I_CPUInfo(void)
-{
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-	static CPUInfoFlags WIN_CPUInfo;
-	SYSTEM_INFO SI;
-	p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent");
-
-	ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
-	if (pfnCPUID)
-	{
-		WIN_CPUInfo.FPPE       = pfnCPUID( 0); //PF_FLOATING_POINT_PRECISION_ERRATA
-		WIN_CPUInfo.FPE        = pfnCPUID( 1); //PF_FLOATING_POINT_EMULATED
-		WIN_CPUInfo.cmpxchg    = pfnCPUID( 2); //PF_COMPARE_EXCHANGE_DOUBLE
-		WIN_CPUInfo.MMX        = pfnCPUID( 3); //PF_MMX_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.PPCMM64    = pfnCPUID( 4); //PF_PPC_MOVEMEM_64BIT_OK
-		WIN_CPUInfo.ALPHAbyte  = pfnCPUID( 5); //PF_ALPHA_BYTE_INSTRUCTIONS
-		WIN_CPUInfo.SSE        = pfnCPUID( 6); //PF_XMMI_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.AMD3DNow   = pfnCPUID( 7); //PF_3DNOW_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.RDTSC      = pfnCPUID( 8); //PF_RDTSC_INSTRUCTION_AVAILABLE
-		WIN_CPUInfo.PAE        = pfnCPUID( 9); //PF_PAE_ENABLED
-		WIN_CPUInfo.SSE2       = pfnCPUID(10); //PF_XMMI64_INSTRUCTIONS_AVAILABLE
-		//WIN_CPUInfo.blank    = pfnCPUID(11); //PF_SSE_DAZ_MODE_AVAILABLE
-		WIN_CPUInfo.DEP        = pfnCPUID(12); //PF_NX_ENABLED
-		WIN_CPUInfo.SSE3       = pfnCPUID(13); //PF_SSE3_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.cmpxchg16b = pfnCPUID(14); //PF_COMPARE_EXCHANGE128
-		WIN_CPUInfo.cmp8xchg16 = pfnCPUID(15); //PF_COMPARE64_EXCHANGE128
-		WIN_CPUInfo.PFC        = pfnCPUID(16); //PF_CHANNELS_ENABLED
-	}
-#ifdef HAVE_SDLCPUINFO
-	else
-	{
-		WIN_CPUInfo.RDTSC       = SDL_HasRDTSC();
-		WIN_CPUInfo.MMX         = SDL_HasMMX();
-		WIN_CPUInfo.AMD3DNow    = SDL_Has3DNow();
-		WIN_CPUInfo.SSE         = SDL_HasSSE();
-		WIN_CPUInfo.SSE2        = SDL_HasSSE2();
-		WIN_CPUInfo.AltiVec     = SDL_HasAltiVec();
-	}
-	WIN_CPUInfo.MMXExt      = SDL_HasMMXExt();
-	WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
-#endif
-	GetSystemInfo(&SI);
-	WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
-	WIN_CPUInfo.IA64 = (SI.dwProcessorType == 2200); // PROCESSOR_INTEL_IA64
-	WIN_CPUInfo.AMD64 = (SI.dwProcessorType == 8664); // PROCESSOR_AMD_X8664
-	return &WIN_CPUInfo;
-#elif defined (HAVE_SDLCPUINFO)
-	static CPUInfoFlags SDL_CPUInfo;
-	memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
-	SDL_CPUInfo.RDTSC       = SDL_HasRDTSC();
-	SDL_CPUInfo.MMX         = SDL_HasMMX();
-	SDL_CPUInfo.MMXExt      = SDL_HasMMXExt();
-	SDL_CPUInfo.AMD3DNow    = SDL_Has3DNow();
-	SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
-	SDL_CPUInfo.SSE         = SDL_HasSSE();
-	SDL_CPUInfo.SSE2        = SDL_HasSSE2();
-	SDL_CPUInfo.AltiVec     = SDL_HasAltiVec();
-	return &SDL_CPUInfo;
-#else
-	return NULL; /// \todo CPUID asm
-#endif
-}
-
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-static void CPUAffinity_OnChange(void);
-static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
-
-static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
-static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL;
-static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
-
-static inline VOID GetAffinityFuncs(VOID)
-{
-	HMODULE h = GetModuleHandleA("kernel32.dll");
-	pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
-	pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
-	pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
-}
-
-static void CPUAffinity_OnChange(void)
-{
-	DWORD_PTR dwProcMask, dwSysMask;
-	HANDLE selfpid;
-
-	if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask)
-		return;
-	else
-		selfpid = pfnGetCurrentProcess();
-
-	pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask);
-
-	/* If resulting mask is zero, don't change anything and fall back to
-	 * actual mask.
-	 */
-	if(dwSysMask & cv_cpuaffinity.value)
-	{
-		pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value);
-		CV_StealthSetValue(&cv_cpuaffinity, (INT32)(dwSysMask & cv_cpuaffinity.value));
-	}
-	else
-		CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask);
-}
-#endif
-
-void I_RegisterSysCommands(void)
-{
-#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
-	GetAffinityFuncs();
-	CV_RegisterVar(&cv_cpuaffinity);
-#endif
-}
-#endif
diff --git a/src/sdl12/i_ttf.c b/src/sdl12/i_ttf.c
deleted file mode 100644
index 770a81d98596d463248e5b7e032e1bbb835df699..0000000000000000000000000000000000000000
--- a/src/sdl12/i_ttf.c
+++ /dev/null
@@ -1,340 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2011 by Callum Dickinson.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
-
-#if defined(SDL) && defined(HAVE_TTF)
-#include "SDL.h"
-#include "SDL_ttf.h"
-#include "../doomdef.h"
-#include "../doomstat.h"
-#include "../d_netfil.h"
-#include "../filesrch.h"
-#include "i_ttf.h"
-
-// Search directories to find aforementioned TTF file.
-#ifdef _PS3
-#include <sysutil/video.h>
-#define FONTSEARCHPATH1 "/dev_hdd0/game/SRB2-PS3_/USRDIR/etc"
-#elif defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define FONTSEARCHPATH1 "/usr/share/fonts"
-#define FONTSEARCHPATH2 "/usr/local/share/fonts"
-#define FONTSEARCHPATH3 "/usr/games/SRB2"
-#define FONTSEARCHPATH4 "/usr/local/games/SRB2"
-#define FONTSEARCHPATH5 "/usr/local/share/games/SRB2"
-#else
-#define FONTSEARCHPATH1 "."
-#endif
-
-#define FONTHANDLE -1
-
-// Renduring surfaces.
-SDL_Surface *TTFSurface = NULL;
-SDL_Surface *TTFRendSurface = NULL;
-// Text box.
-SDL_Rect TTFRect;
-// Temporary storage for the new TTFRect, used to check for
-// line wrapping.
-SDL_Rect TTFRectCheck;
-// Text rendering resolution.
-videoResolution res;
-// Text storage buffer, the contents get printed to the SDL surface.
-char textbuffer[8192];
-
-// look for default ttf file in given directory
-static char *searchFont(const char *fontsearchDir)
-{
-	static char tempsw[256] = "";
-	filestatus_t fstemp;
-
-	strcpy(tempsw, FONTFILE);
-	fstemp = filesearch(tempsw, fontsearchDir, NULL, true, 20);
-	if (fstemp == FS_FOUND)
-	{
-		return tempsw;
-	}
-	return NULL;
-}
-
-// Load TTF font from file.
-INT32 I_TTFLoadFont(const char *file, UINT32 ptsize)
-{
-	TTF_Font *tmpfont = NULL;
-	float fontsize;
-
-	// If a font is currently loaded, unload it.
-	if (currentfont)
-	{
-		TTF_CloseFont(currentfont);
-	}
-
-	// Scale the specified font point size for the current resolution.
-	fontsize = (ptsize * 0.005f) * (res.width - res.height);
-
-	tmpfont = TTF_OpenFont(file, fontsize);
-
-	if (!tmpfont)
-		return FONTHANDLE;
-
-	// set pointer for current font
-	currentfont = tmpfont;
-
-	// set current font point size
-	currentfontpoint = ptsize;
-
-	// get font properties, and set them
-	currentfontstyle = TTF_GetFontStyle(currentfont);
-	TTF_SetFontStyle(currentfont, currentfontstyle);
-
-	// these functions only exist in SDL_ttf 2.0.10 onwards
-#if SDL_TTF_VERSION_ATLEAST(2,0,10)
-	currentfontkerning = TTF_GetFontKerning(currentfont);
-	TTF_SetFontKerning(currentfont, currentfontkerning);
-
-	currentfonthinting = TTF_GetFontHinting(currentfont);
-	TTF_SetFontHinting(currentfont, currentfonthinting);
-
-	currentfontoutline = TTF_GetFontOutline(currentfont);
-	TTF_SetFontOutline(currentfont, currentfontoutline);
-#endif
-
-	return 0;
-}
-
-static void I_TTFRendSurface(const char *textmsg, TTF_Font *font, TextQuality quality, SDL_Color fontfgcolor, SDL_Color fontbgcolor)
-{
-	// Print text in the buffer.
-	// SDL_ttf has three modes to draw text.
-	// Solid rendering is quick, but dirty. Use it if you need speed more than quality.
-	switch (quality)
-	{
-		case solid:
-			TTFRendSurface = TTF_RenderText_Solid(font, textmsg, fontfgcolor);
-			break;
-		// Shaded rendering adds a background to the rendered text. Because of this, I_TTFDrawText
-		// takes an extra color more than the other styles to be a background color.
-		// Shaded is supposedly as fast as solid rendering and about as good quality as blended.
-		case shaded:
-			TTFRendSurface = TTF_RenderText_Shaded(font, textmsg, fontfgcolor, fontbgcolor);
-			break;
-		// Blended rendering is the opposite of solid. Good quality, but slow.
-		case blended:
-			TTFRendSurface = TTF_RenderText_Blended(font, textmsg, fontfgcolor);
-			break;
-	}
-
-	// Get SDL to update the main surface.
-	SDL_BlitSurface(TTFRendSurface, NULL, TTFSurface, &TTFRect);
-	SDL_Flip(TTFSurface);
-}
-
-// Draw text to screen. It will accept four colour vales (red, green, blue and alpha)
-// with foreground for draw modes Solid and Blended, and an extra four values for background
-// colour with draw type Shaded.
-void I_TTFDrawText(TTF_Font *font, TextQuality quality, INT32 fgR, INT32 fgG, INT32 fgB, INT32 fgA, INT32 bgR, INT32 bgG, INT32 bgB, INT32 bgA, const char *textmsg)
-{
-	// Temporary small buffer to store character to process.
-	// NULL pointer to prevc to kill warning
-	char c, prevc = 0x0;
-	// hack to allow TTF_SizeText to work properly.
-	char linebuffer[2];
-	// Don't need h, but TTF_SizeText needs a height parameter
-	INT32 w, h;
-
-	// Globally declare foreground and background text colours,
-	// text drawing mode and the font to draw.
-	SDL_Color fontfgcolor = {fgR, fgG, fgB, fgA};
-	SDL_Color fontbgcolor = {bgR, bgG, bgB, bgA};
-
-	// Keep on processing until the null terminator in the text buffer is reached.
-	while (*textmsg != '\0')
-	{
-		// Copy pointer for current character into the temporary buffer.
-		c = *textmsg;
-		// If c is a newline, move to the next available line.
-		if (c == '\n')
-		{
-			TTFRectCheck.x = 0;
-			TTFRectCheck.y += (currentfontpoint + 1);
-		}
-		// Otherwise...
-		else
-		{
-			// If the previous character was a newline, actually move to the next line.
-			if (prevc == '\n')
-			{
-				if (textbuffer != NULL)
-				{
-					// Render cached text to the SDL surface.
-					I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor);
-					// Empty text buffer.
-					memset(textbuffer, '\0', 1);
-				}
-				TTFRect.x = TTFRectCheck.x;
-				TTFRect.y = TTFRectCheck.y;
-			}
-			// Copy the character to the text buffer.
-			sprintf(textbuffer, "%s%c", textbuffer, c);
-			// Hack to allow TTF_SizeText to work properly.
-			sprintf(linebuffer, "%c", c);
-			// If we have reached the end of the screen, move to the next available line.
-			TTF_SizeText(currentfont, linebuffer, &w, &h);
-			TTFRectCheck.x += w;
-			if (TTFRectCheck.x >= res.width)
-			{
-				// Render cached text to the SDL surface.
-				I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor);
-				// Empty text buffer.
-				memset(textbuffer, '\0', 1);
-				// Move to the next line.
-				TTFRectCheck.x = 0;
-				TTFRectCheck.y += (currentfontpoint + 1);
-				// Set stored co-ordinates for next line.
-				TTFRect.x = TTFRectCheck.x;
-				TTFRect.y = TTFRectCheck.y;
-			}
-		}
-		// Add 1 to the pointer reference for the character to process.
-		textmsg++;
-		// Copy contents of the now-old buffer to somewhere else, so it can be referenced in next loop.
-		prevc = c;
-	}
-
-	// If the buffer was previously emptied by a line wrapping operation and
-	// no text came after that, don't print anything. Otherwise, print everything
-	// still in the buffer.
-	if (textbuffer != NULL)
-	{
-		// Render cached text to the SDL surface.
-		I_TTFRendSurface(textbuffer, font, quality, fontfgcolor, fontbgcolor);
-		// Empty text buffer.
-		memset(textbuffer, '\0', 1);
-		// Set stored co-ordinates for next line.
-		TTFRect.x = TTFRectCheck.x;
-		TTFRect.y = TTFRectCheck.y;
-	}
-}
-
-// Initialise SDL_ttf.
-void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
-{
-	char *fontpath = NULL;
-	INT32 fontstatus = -1;
-#ifdef _PS3
-	videoState state;
-	videoGetState(0, 0, &state);
-	videoGetResolution(state.displayMode.resolution, &res);
-	bitsperpixel = 24;
-#else
-	res.width = 320;
-	res.height = 200;
-	bitsperpixel = 8;
-#endif
-
-	// what's the point of trying to display an error?
-	// SDL_ttf is not started, can't display anything to screen (presumably)...
-	if (SDL_InitSubSystem(initflags) < 0)
-		I_Error("Couldn't initialize SDL: %s\n", SDL_GetError());
-
-	TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags);
-	if (!TTFSurface)
-		I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError());
-
-	if (TTF_Init() < 0)
-		I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError());
-
-	// look for default font in many directories
-#ifdef FONTSEARCHPATH1
-	fontpath = searchFont(FONTSEARCHPATH1);
-	if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-#endif
-#ifdef FONTSEARCHPATH2
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH2);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-#ifdef FONTSEARCHPATH3
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH3);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-#ifdef FONTSEARCHPATH4
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH4);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-#ifdef FONTSEARCHPATH5
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH5);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-#ifdef FONTSEARCHPATH6
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH6);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-#ifdef FONTSEARCHPATH7
-	if (fontstatus < 0)
-	{
-		fontpath = searchFont(FONTSEARCHPATH7);
-		if (fontpath) fontstatus = I_TTFLoadFont(fontpath, fontpointsize);
-	}
-#endif
-	// argh! no font file found! disable SDL_ttf code
-	if (fontstatus < 0)
-	{
-		I_ShutdownTTF();
-		CONS_Printf("Unable to find default font files! Not loading SDL_ttf\n");
-	}
-	else
-	{
-		// Get SDL_ttf compiled and linked version
-		SDL_version TTFcompiled;
-		const SDL_version *TTFlinked;
-
-		SDL_TTF_VERSION(&TTFcompiled);
-		TTFlinked = TTF_Linked_Version();
-
-		// Display it on screen
-		CONS_Printf("Compiled for SDL_ttf version: %d.%d.%d\n",
-			    TTFcompiled.major, TTFcompiled.minor, TTFcompiled.patch);
-		CONS_Printf("Linked with SDL_ttf version: %d.%d.%d\n",
-			    TTFlinked->major, TTFlinked->minor, TTFlinked->patch);
-	}
-}
-
-void I_ShutdownTTF(void)
-{
-	// close current font
-	TTF_CloseFont(currentfont);
-	// shutdown SDL_ttf
-	TTF_Quit();
-
-	// Free TTF rendering surfaces.
-	SDL_FreeSurface(TTFSurface);
-	SDL_FreeSurface(TTFRendSurface);
-}
-#endif
diff --git a/src/sdl12/i_ttf.h b/src/sdl12/i_ttf.h
deleted file mode 100644
index 929c8021ccfae374c30415afca9a09e68ccc1c50..0000000000000000000000000000000000000000
--- a/src/sdl12/i_ttf.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2011 by Callum Dickinson.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL_ttf interface code. Necessary for platforms with SDL inits that need to run immediately.
-
-#ifndef __I_TTF__
-#define __I_TTF__
-
-#include "../doomdef.h"
-#include "SDL_ttf.h"
-
-// Default name for standard TTF file.
-#define FONTFILE "srb2.ttf"
-#define FONTPOINTSIZE 12
-
-// Default font foreground colours
-#define DEFAULTFONTFGR 255
-#define DEFAULTFONTFGG 255
-#define DEFAULTFONTFGB 255
-#define DEFAULTFONTFGA 255
-
-// Default font background colours
-#define DEFAULTFONTBGR 0
-#define DEFAULTFONTBGG 0
-#define DEFAULTFONTBGB 0
-#define DEFAULTFONTBGA 255
-
-#ifndef SDL_TTF_COMPILEDVERSION
-#define SDL_TTF_COMPILEDVERSION \
-	SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL)
-#endif
-
-#ifndef SDL_TTF_VERSION_ATLEAST
-#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_TTF_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-#endif
-
-TTF_Font* currentfont;
-int currentfontpoint;
-int currentfontstyle;
-#if SDL_TTF_VERSION_ATLEAST(2,0,10)
-int currentfontkerning;
-int currentfonthinting;
-int currentfontoutline;
-#endif
-
-#ifndef _PS3
-typedef struct
-{
-	UINT16 width;
-	UINT16 height;
-} VideoResolution;
-#endif
-UINT8 bitsperpixel;
-
-typedef enum
-{
-	solid,
-	shaded,
-	blended
-} TextQuality;
-
-// Load TTF font from file.
-INT32 I_TTFLoadFont(const char *file, UINT32 ptsize);
-
-// Draw TTF text to screen. It will accept four colour vales (red, green, blue and alpha)
-// with foreground for draw modes Solid and Blended, and an extra four values for background
-// colour with draw type Shaded.
-void I_TTFDrawText(TTF_Font *font, TextQuality quality, INT32 fgR, INT32 fgG, INT32 fgB, INT32 fgA, INT32 bgR, INT32 bgG, INT32 bgB, INT32 bgA, const char *textmsg);
-
-// Initialise SDL_ttf.
-void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags);
-
-void I_ShutdownTTF(void);
-#endif
diff --git a/src/sdl12/i_video.c b/src/sdl12/i_video.c
deleted file mode 100644
index 0063fc09571f59f237199ab31c99729a2ce10076..0000000000000000000000000000000000000000
--- a/src/sdl12/i_video.c
+++ /dev/null
@@ -1,2104 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SRB2 graphics stuff for SDL
-
-#include <stdlib.h>
-
-#ifndef _WIN32_WCE
-#include <signal.h>
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#ifdef HAVE_SDL
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#if SDL_VERSION_ATLEAST(1,2,9) && defined (_arch_dreamcast)
-#define HAVE_DCSDL
-#include "SDL_dreamcast.h"
-#endif
-
-#if SDL_VERSION_ATLEAST(1,2,9) && defined (GP2X)
-#define HAVE_GP2XSDL
-#include "SDL_gp2x.h"
-#endif
-
-#if SDL_VERSION_ATLEAST(1,3,0)
-#define SDLK_EQUALS SDLK_KP_EQUALSAS400
-#define SDLK_LMETA SDLK_LGUI
-#define SDLK_RMETA SDLK_RGUI
-#else
-#define HAVE_SDLMETAKEYS
-#endif
-
-#ifdef HAVE_TTF
-#include "i_ttf.h"
-#endif
-
-#ifdef HAVE_IMAGE
-#include "SDL_image.h"
-#elseif !(defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X))
-#define LOAD_XPM //I want XPM!
-#include "IMG_xpm.c" //Alam: I don't want to add SDL_Image.dll/so
-#define HAVE_IMAGE //I have SDL_Image, sortof
-#endif
-
-#ifdef HAVE_IMAGE
-#include "SDL_icon.xpm"
-#endif
-
-#include "../doomdef.h"
-
-#if defined (_WIN32) && !defined (_XBOX)
-#include "SDL_syswm.h"
-#endif
-
-#ifdef _arch_dreamcast
-#include <conio/conio.h>
-#include <dc/maple.h>
-#include <dc/maple/vmu.h>
-//#include "SRB2DC/VMU.xbm"
-//#include <dc/pvr.h>
-//#define malloc pvr_mem_malloc
-//#define free pvr_mem_free
-#endif
-
-#if defined (_XBOX) && defined (__GNUC__)
-#include <openxdk/debug.h>
-#endif
-
-#include "../doomstat.h"
-#include "../i_system.h"
-#include "../v_video.h"
-#include "../m_argv.h"
-#include "../m_menu.h"
-#include "../d_main.h"
-#include "../s_sound.h"
-#include "../i_sound.h"  // midi pause/unpause
-#include "../i_joy.h"
-#include "../st_stuff.h"
-#include "../g_game.h"
-#include "../i_video.h"
-#include "../console.h"
-#include "../command.h"
-#include "sdlmain.h"
-#ifdef HWRENDER
-#include "../hardware/hw_main.h"
-#include "../hardware/hw_drv.h"
-// For dynamic referencing of HW rendering functions
-#include "hwsym_sdl.h"
-#include "ogl_sdl.h"
-#endif
-
-#ifdef REMOTE_DEBUGGING
-#ifdef _WII
-#include <debug.h>
-#endif
-#endif
-
-#ifdef HAVE_FILTER
-#define FILTERS
-#include "filter/filters.h"
-#endif
-
-// maximum number of windowed modes (see windowedModes[][])
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
-#define MAXWINMODES (1)
-#elif defined (WII)
-#define MAXWINMODES (8)
-#elif defined (_PS3)
-#define MAXWINMODES (26)
-#else
-#define MAXWINMODES (27)
-#endif
-
-/**	\brief
-*/
-static INT32 numVidModes = -1;
-
-/**	\brief
-*/
-static char vidModeName[33][32]; // allow 33 different modes
-
-rendermode_t rendermode=render_soft;
-
-boolean highcolor = false;
-
-// synchronize page flipping with screen refresh
-#if defined(DC) || (defined(GP2X) && !defined(HAVE_GP2XSDL))
-consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-#else
-consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-#endif
-static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-UINT8 graphics_started = 0; // Is used in console.c and screen.c
-
-// To disable fullscreen at startup; is set in VID_PrepareModeList
-boolean allow_fullscreen = false;
-static SDL_bool disable_fullscreen = SDL_FALSE;
-#define USE_FULLSCREEN (disable_fullscreen||!allow_fullscreen)?0:cv_fullscreen.value
-static SDL_bool disable_mouse = SDL_FALSE;
-#define USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && SDL_GetAppState() & SDL_APPACTIVE)
-#define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
-#define MOUSEBUTTONS_MAX MOUSEBUTTONS
-
-// first entry in the modelist which is not bigger than MAXVIDWIDTHxMAXVIDHEIGHT
-static      INT32          firstEntry = 0;
-
-// SDL vars
-#ifndef HWRENDER //[segabor] !!! I had problem compiling this source with gcc 3.3
-static      SDL_Surface *vidSurface = NULL;
-#endif
-static      SDL_Surface *bufSurface = NULL;
-static      SDL_Surface *icoSurface = NULL;
-static      SDL_Color    localPalette[256];
-static      SDL_Rect   **modeList = NULL;
-#ifdef DC
-static       Uint8       BitsPerPixel = 15;
-#else
-static       Uint8       BitsPerPixel = 16;
-#endif
-static       Uint16      realwidth = BASEVIDWIDTH;
-static       Uint16      realheight = BASEVIDHEIGHT;
-#ifdef _WIN32_WCE
-static const Uint32      surfaceFlagsW = SDL_HWPALETTE; //Can't handle WinCE changing sides
-#else
-static const Uint32      surfaceFlagsW = SDL_HWPALETTE/*|SDL_RESIZABLE*/;
-#endif
-#ifdef _PSP
-static const Uint32      surfaceFlagsF = SDL_HWSURFACE|SDL_FULLSCREEN;
-#else
-static const Uint32      surfaceFlagsF = SDL_HWPALETTE|SDL_FULLSCREEN;
-#endif
-static       SDL_bool    mousegrabok = SDL_TRUE;
-#define HalfWarpMouse(x,y) SDL_WarpMouse((Uint16)(x/2),(Uint16)(y/2))
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
-static       SDL_bool    videoblitok = SDL_TRUE;
-#else
-static       SDL_bool    videoblitok = SDL_FALSE;
-#endif
-static       SDL_bool    exposevideo = SDL_FALSE;
-
-// windowed video modes from which to choose from.
-static INT32 windowedModes[MAXWINMODES][2] =
-{
-#if !(defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined (GP2X))
-#ifndef WII
-#ifndef _PS3
-	{1920,1200}, // 1.60,6.00
-#endif
-	{1680,1050}, // 1.60,5.25
-	{1600,1200}, // 1.33,5.00
-	{1600,1000}, // 1.60,5.00
-	{1536,1152}, // 1.33,4.80
-	{1536, 960}, // 1.60,4.80
-	{1440, 900}, // 1.60,4.50
-	{1400,1050}, // 1.33,4.375
-	{1400, 875}, // 1.60,4.375
-	{1360, 850}, // 1.60,4.25
-	{1280, 960}, // 1.33,4.00
-	{1280, 800}, // 1.60,4.00
-	{1152, 864}, // 1.33,3.60
-	{1120, 700}, // 1.60,3.50
-	{1024, 768}, // 1.33,3.20
-	{ 960, 720}, // 1.33,3.00
-	{ 960, 600}, // 1.60,3.00
-	{ 800, 600}, // 1.33,2.50
-	{ 800, 500}, // 1.60,2.50
-#endif
-	{ 640, 480}, // 1.33,2.00
-	{ 640, 400}, // 1.60,2.00
-	{ 576, 432}, // 1.33,1.80
-	{ 512, 384}, // 1.33,1.60
-	{ 416, 312}, // 1.33,1.30
-	{ 400, 300}, // 1.33,1.25
-	{ 320, 240}, // 1.33,1.00
-#endif
-	{ 320, 200}, // 1.60,1.00
-};
-
-static void SDLSetMode(INT32 width, INT32 height, INT32 bpp, Uint32 flags)
-{
-	const char *SDLVD = I_GetEnv("SDL_VIDEODRIVER");
-#ifdef _WIN32_WCE
-	if (bpp < 16)
-		bpp = 16; // 256 mode poo
-#endif
-#ifdef _WII
-	bpp = 16; // 8-bit mode poo
-#endif
-#ifdef DC
-	if (bpp < 15)
-		bpp = 15;
-	height = 240;
-#endif
-#ifdef PSP
-	bpp = 16;
-#endif
-#ifdef GP2X
-	bpp = 16;
-#ifdef HAVE_GP2XSDL
-	height = 240;
-#endif
-#endif
-#ifdef FILTERS
-	bpp = Setupf2x(width, height, bpp);
-#endif
-	if (SDLVD && strncasecmp(SDLVD,"glSDL",6) == 0) //for glSDL videodriver
-		vidSurface = SDL_SetVideoMode(width, height,0,SDL_DOUBLEBUF);
-#ifdef _WII // don't want it to use HWSURFACE, so make it first here
-	else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF) >= bpp) // SDL Wii uses double buffering
-		vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE|SDL_DOUBLEBUF);
-#endif
-	else if (cv_vidwait.value && videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF) >= bpp)
-		vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE|SDL_DOUBLEBUF);
-	else if (videoblitok && SDL_VideoModeOK(width, height, bpp, flags|SDL_HWSURFACE) >= bpp)
-		vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_HWSURFACE);
-	else if (SDL_VideoModeOK(width, height, bpp, flags|SDL_SWSURFACE) >= bpp)
-		vidSurface = SDL_SetVideoMode(width, height, bpp, flags|SDL_SWSURFACE);
-	else return;
-	realwidth = (Uint16)width;
-	realheight = (Uint16)height;
-#ifdef HAVE_DCSDL
-	//SDL_DC_SetWindow(320,200);
-	SDL_DC_EmulateMouse(SDL_FALSE);
-	SDL_DC_EmulateKeyboard(SDL_TRUE);
-#endif
-#ifdef HAVE_GP2XSDL
-	SDL_ShowCursor(SDL_DISABLE); //For GP2X Open2x
-#endif
-#ifdef FILTERS
-	if (vidSurface && preSurface && f2xSurface)
-	{
-		vid.width = width/2;
-		vid.height = height/2;
-	}
-#endif
-}
-
-//
-//  Translates the SDL key into SRB2 key
-//
-
-static INT32 SDLatekey(SDLKey sym)
-{
-	INT32 rc = sym + 0x80;
-
-#ifdef _WIN32_WCE
-	if (sym == SDLK_KP8)
-		sym = SDLK_UP;
-	else if (sym == SDLK_KP4)
-		sym = SDLK_LEFT;
-	else if (sym == SDLK_KP6)
-		sym = SDLK_RIGHT;
-	else if (sym == SDLK_KP2)
-		sym = SDLK_DOWN;
-#endif
-
-	switch (sym)
-	{
-		case SDLK_LEFT:
-			rc = KEY_LEFTARROW;
-			break;
-		case SDLK_RIGHT:
-			rc = KEY_RIGHTARROW;
-			break;
-		case SDLK_DOWN:
-			rc = KEY_DOWNARROW;
-			break;
-		case SDLK_UP:
-			rc = KEY_UPARROW;
-			break;
-
-		case SDLK_ESCAPE:
-			rc = KEY_ESCAPE;
-			break;
-		case SDLK_SPACE:
-			rc = KEY_SPACE;
-			break;
-		case SDLK_RETURN:
-		case SDLK_KP_ENTER:
-			rc = KEY_ENTER;
-			break;
-		case SDLK_TAB:
-			rc = KEY_TAB;
-			break;
-		case SDLK_F1:
-			rc = KEY_F1;
-			break;
-		case SDLK_F2:
-			rc = KEY_F2;
-			break;
-		case SDLK_F3:
-			rc = KEY_F3;
-			break;
-		case SDLK_F4:
-			rc = KEY_F4;
-			break;
-		case SDLK_F5:
-			rc = KEY_F5;
-			break;
-		case SDLK_F6:
-			rc = KEY_F6;
-			break;
-		case SDLK_F7:
-			rc = KEY_F7;
-			break;
-		case SDLK_F8:
-			rc = KEY_F8;
-			break;
-		case SDLK_F9:
-			rc = KEY_F9;
-			break;
-		case SDLK_F10:
-			rc = KEY_F10;
-			break;
-		case SDLK_F11:
-			rc = KEY_F11;
-			break;
-		case SDLK_F12:
-			rc = KEY_F12;
-			break;
-
-		case SDLK_BACKSPACE:
-			rc = KEY_BACKSPACE;
-			break;
-		case SDLK_DELETE:
-			rc = KEY_DEL;
-			break;
-
-		case SDLK_KP_EQUALS: //Alam & Logan: WTF? Mac KB haves one! XD
-		case SDLK_PAUSE:
-			rc = KEY_PAUSE;
-			break;
-
-		case SDLK_EQUALS:
-		case SDLK_PLUS:
-			rc = KEY_EQUALS;
-			break;
-
-		case SDLK_MINUS:
-			rc = KEY_MINUS;
-			break;
-
-		case SDLK_LSHIFT:
-			rc = KEY_LSHIFT;
-			break;
-
-		case SDLK_RSHIFT:
-			rc = KEY_RSHIFT;
-			break;
-
-		case SDLK_CAPSLOCK:
-			rc = KEY_CAPSLOCK;
-			break;
-
-		case SDLK_LCTRL:
-			rc = KEY_LCTRL;
-			break;
-		case SDLK_RCTRL:
-			rc = KEY_RCTRL;
-			break;
-
-		case SDLK_LALT:
-			rc = KEY_LALT;
-			break;
-		case SDLK_RALT:
-			rc = KEY_RALT;
-			break;
-
-		case SDLK_NUMLOCK:
-			rc = KEY_NUMLOCK;
-			break;
-		case SDLK_SCROLLOCK:
-			rc = KEY_SCROLLLOCK;
-			break;
-
-		case SDLK_PAGEUP:
-			rc = KEY_PGUP;
-			break;
-		case SDLK_PAGEDOWN:
-			rc = KEY_PGDN;
-			break;
-		case SDLK_END:
-			rc = KEY_END;
-			break;
-		case SDLK_HOME:
-			rc = KEY_HOME;
-			break;
-		case SDLK_INSERT:
-			rc = KEY_INS;
-			break;
-
-		case SDLK_KP0:
-			rc = KEY_KEYPAD0;
-			break;
-		case SDLK_KP1:
-			rc = KEY_KEYPAD1;
-			break;
-		case SDLK_KP2:
-			rc = KEY_KEYPAD2;
-			break;
-		case SDLK_KP3:
-			rc = KEY_KEYPAD3;
-			break;
-		case SDLK_KP4:
-			rc = KEY_KEYPAD4;
-			break;
-		case SDLK_KP5:
-			rc = KEY_KEYPAD5;
-			break;
-		case SDLK_KP6:
-			rc = KEY_KEYPAD6;
-			break;
-		case SDLK_KP7:
-			rc = KEY_KEYPAD7;
-			break;
-		case SDLK_KP8:
-			rc = KEY_KEYPAD8;
-			break;
-		case SDLK_KP9:
-			rc = KEY_KEYPAD9;
-			break;
-
-		case SDLK_KP_PERIOD:
-			rc = KEY_KPADDEL;
-			break;
-		case SDLK_KP_DIVIDE:
-			rc = KEY_KPADSLASH;
-			break;
-		case SDLK_KP_MULTIPLY:
-			rc = '*';
-			break;
-		case SDLK_KP_MINUS:
-			rc = KEY_MINUSPAD;
-			break;
-		case SDLK_KP_PLUS:
-			rc = KEY_PLUSPAD;
-			break;
-
-#ifndef _arch_dreamcast
-		case SDLK_LSUPER:
-#ifdef HAVE_SDLMETAKEYS
-		case SDLK_LMETA:
-#endif
-			rc = KEY_LEFTWIN;
-			break;
-		case SDLK_RSUPER:
-#ifdef HAVE_SDLMETAKEYS
-		case SDLK_RMETA:
-#endif
-			rc = KEY_RIGHTWIN;
-			break;
-
-		case SDLK_MENU:
-			rc = KEY_MENU;
-			break;
-#endif
-
-		default:
-			if (sym >= SDLK_SPACE && sym <= SDLK_DELETE)
-				rc = sym - SDLK_SPACE + ' ';
-			else if (sym >= 'A' && sym <= 'Z')
-				rc = sym - 'A' + 'a';
-			else if (sym)
-			{
-				I_OutputMsg("Unknown Keycode %i, Name: %s\n",sym, SDL_GetKeyName( sym ));
-			}
-			else if (!sym) rc = 0;
-			break;
-	}
-
-	return rc;
-}
-
-static void SDLdoUngrabMouse(void)
-{
-	if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY))
-	{
-		SDL_WM_GrabInput(SDL_GRAB_OFF);
-	}
-}
-
-void SDLforceUngrabMouse(void)
-{
-	if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO)
-		SDL_WM_GrabInput(SDL_GRAB_OFF);
-}
-
-static void VID_Command_NumModes_f (void)
-{
-	CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes());
-}
-
-static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText)
-{
-	INT32 vfBPP;
-	const SDL_Surface *VidSur = SDL_GetVideoSurface();
-
-	if (!infoSurface)
-		return;
-
-	if (!SurfaceText)
-		SurfaceText = M_GetText("Unknown Surface");
-
-	vfBPP = infoSurface->format?infoSurface->format->BitsPerPixel:0;
-
-	CONS_Printf("\x82" "%s\n", SurfaceText);
-	CONS_Printf(M_GetText(" %ix%i at %i bit color\n"), infoSurface->w, infoSurface->h, vfBPP);
-
-	if (infoSurface->flags&SDL_HWSURFACE)
-		CONS_Printf("%s", M_GetText(" Stored in video memory\n"));
-	else if (infoSurface->flags&SDL_OPENGL)
-		CONS_Printf("%s", M_GetText(" Stored in an OpenGL context\n"));
-	else if (infoSurface->flags&SDL_PREALLOC)
-		CONS_Printf("%s", M_GetText(" Uses preallocated memory\n"));
-	else
-		CONS_Printf("%s", M_GetText(" Stored in system memory\n"));
-
-	if (infoSurface->flags&SDL_ASYNCBLIT)
-		CONS_Printf("%s", M_GetText(" Uses asynchronous blits if possible\n"));
-	else
-		CONS_Printf("%s", M_GetText(" Uses synchronous blits if possible\n"));
-
-	if (infoSurface->flags&SDL_ANYFORMAT)
-		CONS_Printf("%s", M_GetText(" Allows any pixel-format\n"));
-
-	if (infoSurface->flags&SDL_HWPALETTE)
-		CONS_Printf("%s", M_GetText(" Has exclusive palette access\n"));
-	else if (VidSur == infoSurface)
-		CONS_Printf("%s", M_GetText(" Has nonexclusive palette access\n"));
-
-	if (infoSurface->flags&SDL_DOUBLEBUF)
-		CONS_Printf("%s", M_GetText(" Double buffered\n"));
-	else if (VidSur == infoSurface)
-		CONS_Printf("%s", M_GetText(" No hardware flipping\n"));
-
-	if (infoSurface->flags&SDL_FULLSCREEN)
-		CONS_Printf("%s", M_GetText(" Full screen\n"));
-	else if (infoSurface->flags&SDL_RESIZABLE)
-		CONS_Printf("%s", M_GetText(" Resizable window\n"));
-	else if (VidSur == infoSurface)
-		CONS_Printf("%s", M_GetText(" Nonresizable window\n"));
-
-	if (infoSurface->flags&SDL_HWACCEL)
-		CONS_Printf("%s", M_GetText(" Uses hardware acceleration blit\n"));
-	if (infoSurface->flags&SDL_SRCCOLORKEY)
-		CONS_Printf("%s", M_GetText(" Use colorkey blitting\n"));
-	if (infoSurface->flags&SDL_RLEACCEL)
-		CONS_Printf("%s", M_GetText(" Colorkey RLE acceleration blit\n"));
-	if (infoSurface->flags&SDL_SRCALPHA)
-		CONS_Printf("%s", M_GetText(" Use alpha blending acceleration blit\n"));
-
-}
-
-static void VID_Command_Info_f (void)
-{
-	const SDL_VideoInfo *videoInfo;
-	videoInfo = SDL_GetVideoInfo(); //Alam: Double-Check
-	if (videoInfo)
-	{
-		CONS_Printf("%s", M_GetText("Video Interface Capabilities:\n"));
-		if (videoInfo->hw_available)
-			CONS_Printf("%s", M_GetText(" Hardware surfaces\n"));
-		if (videoInfo->wm_available)
-			CONS_Printf("%s", M_GetText(" Window manager\n"));
-		//UnusedBits1  :6
-		//UnusedBits2  :1
-		if (videoInfo->blit_hw)
-			CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW\n"));
-		if (videoInfo->blit_hw_CC)
-			CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW with Colorkey\n"));
-		if (videoInfo->wm_available)
-			CONS_Printf("%s", M_GetText(" Accelerated blits HW-2-HW with Alpha\n"));
-		if (videoInfo->blit_sw)
-		{
-			CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW\n"));
-			if (!M_CheckParm("-noblit")) videoblitok = SDL_TRUE;
-		}
-		if (videoInfo->blit_sw_CC)
-			CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW with Colorkey\n"));
-		if (videoInfo->blit_sw_A)
-			CONS_Printf("%s", M_GetText(" Accelerated blits SW-2-HW with Alpha\n"));
-		if (videoInfo->blit_fill)
-			CONS_Printf("%s", M_GetText(" Accelerated Color filling\n"));
-		//UnusedBits3  :16
-		if (videoInfo->video_mem)
-			CONS_Printf(M_GetText(" There is %i KB of video memory\n"), videoInfo->video_mem);
-		else
-			CONS_Printf("%s", M_GetText(" There no video memory for SDL\n"));
-		//*vfmt
-	}
-	SurfaceInfo(bufSurface, M_GetText("Current Engine Mode"));
-#ifdef FILTERS
-	SurfaceInfo(preSurface, M_GetText("Prebuffer Mode"));
-	SurfaceInfo(f2xSurface, M_GetText("Postbuffer Mode"));
-#endif
-	SurfaceInfo(vidSurface, M_GetText("Current Video Mode"));
-}
-
-static void VID_Command_ModeList_f(void)
-{
-#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) &&  !defined(GP2X)
-	INT32 i;
-#ifdef HWRENDER
-	if (rendermode == render_opengl)
-		modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN);
-	else
-#endif
-	modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
-
-	if (modeList == (SDL_Rect **)0 && cv_fullscreen.value)
-	{
-		CONS_Printf("%s", M_GetText("No video modes present\n"));
-		cv_fullscreen.value = 0;
-	}
-	else if (modeList != (SDL_Rect **)0)
-	{
-		numVidModes = 0;
-		if (modeList == (SDL_Rect **)-1)
-			numVidModes = -1; // should not happen with fullscreen modes
-		else while (modeList[numVidModes])
-			numVidModes++;
-	}
-	CONS_Printf(M_GetText("Found %d FullScreen Video Modes:\n"), numVidModes);
-	for (i=0 ; i<numVidModes; i++)
-	{ // fullscreen modes
-		INT32 modeNum = firstEntry + i;
-		if (modeNum >= numVidModes)
-			break;
-
-		CONS_Printf(M_GetText("%dx%d and "),
-				modeList[modeNum]->w,
-				modeList[modeNum]->h);
-	}
-	CONS_Printf("%s", M_GetText("None\n"));
-#endif
-}
-
-static void VID_Command_Mode_f (void)
-{
-	INT32 modenum;
-
-	if (COM_Argc()!= 2)
-	{
-		CONS_Printf(M_GetText("vid_mode <modenum> : set video mode, current video mode %i\n"), vid.modenum);
-		return;
-	}
-
-	modenum = atoi(COM_Argv(1));
-
-	if (modenum >= VID_NumModes())
-		CONS_Printf(M_GetText("Video mode not present\n"));
-	else
-		setmodeneeded = modenum+1; // request vid mode change
-}
-
-#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE)
-static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-	UNREFERENCED_PARAMETER(hWnd);
-	UNREFERENCED_PARAMETER(message);
-	UNREFERENCED_PARAMETER(wParam);
-	switch (message)
-	{
-		case WM_SETTEXT:
-			COM_BufAddText((LPCSTR)lParam);
-			break;
-	}
-}
-#endif
-
-#if 0 //#ifdef _WIN32
-	// Disable Composition in Vista DWM (Desktop Window Manager) ----------------
-static HMODULE DMdll = NULL;
-typedef HRESULT (CALLBACK *P_DwmIsCompositionEnabled) (BOOL *pfEnabled);
-static P_DwmIsCompositionEnabled pfnDwmIsCompositionEnabled = NULL;
-typedef HRESULT (CALLBACK *P_DwmEnableComposition) (BOOL   fEnable);
-static P_DwmEnableComposition pfnDwmEnableComposition = NULL;
-static BOOL AeroWasEnabled = FALSE;
-
-static inline VOID UnloadDM(VOID)
-{
-	pfnDwmEnableComposition = NULL;
-	pfnDwmIsCompositionEnabled = NULL;
-	if (DMdll) FreeLibrary(DMdll);
-	DMdll = NULL;
-}
-
-static inline BOOL LoadDM(VOID)
-{
-	if (DMdll)
-		return TRUE;
-
-	DMdll = LoadLibraryA("dwmapi.dll");
-	if (DMdll)
-		I_OutputMsg("dmwapi.dll loaded, Vista's Desktop Window Manager API\n");
-	else
-		return FALSE;
-
-	pfnDwmIsCompositionEnabled = (P_DwmIsCompositionEnabled)GetProcAddress(DMdll, "DwmIsCompositionEnabled");
-	if (pfnDwmIsCompositionEnabled)
-		I_OutputMsg("Composition Aero API found, DwmIsCompositionEnabled\n");
-
-	pfnDwmEnableComposition = (P_DwmEnableComposition)GetProcAddress(DMdll, "DwmEnableComposition");
-	if (pfnDwmEnableComposition)
-		I_OutputMsg("Composition Aero API found, DwmEnableComposition\n");
-
-	return TRUE;
-}
-
-static inline VOID DisableAero(VOID)
-{
-	BOOL pfnDwmEnableCompositiond = FALSE;
-	AeroWasEnabled = FALSE;
-
-	if (!LoadDM())
-		return;
-
-	if (pfnDwmIsCompositionEnabled && SUCCEEDED(pfnDwmIsCompositionEnabled(&pfnDwmEnableCompositiond)))
-		I_OutputMsg("Got the result of DwmIsCompositionEnabled, %i\n", pfnDwmEnableCompositiond);
-	else
-		return;
-
-	if ((AeroWasEnabled = pfnDwmEnableCompositiond))
-		I_OutputMsg("Disable the Aero rendering\n");
-	else
-		return;
-
-	if (pfnDwmEnableComposition && SUCCEEDED(pfnDwmEnableComposition(FALSE)))
-		I_OutputMsg("Aero rendering disabled\n");
-	else
-		I_OutputMsg("We failed to disable the Aero rendering\n");
-}
-
-static inline VOID ResetAero(VOID)
-{
-	if (pfnDwmEnableComposition && AeroWasEnabled)
-	{
-		if (SUCCEEDED(pfnDwmEnableComposition(AeroWasEnabled)))
-			I_OutputMsg("Aero rendering setting restored\n");
-		else
-			I_OutputMsg("We failed to restore Aero rendering\n");
-	}
-	UnloadDM();
-}
-#endif
-
-static inline void SDLJoyRemap(event_t *event)
-{
-#if defined(GP2X)
-#define GP2X_BUTTON_UP              (0)
-#define GP2X_BUTTON_DOWN            (4)
-#define GP2X_BUTTON_LEFT            (2)
-#define GP2X_BUTTON_RIGHT           (6)
-#define GP2X_BUTTON_UPLEFT          (1)
-#define GP2X_BUTTON_UPRIGHT         (7)
-#define GP2X_BUTTON_DOWNLEFT        (3)
-#define GP2X_BUTTON_DOWNRIGHT       (5)
-#define GP2X_BUTTON_CLICK           (18)
-#define GP2X_BUTTON_A               (12)
-#define GP2X_BUTTON_B               (13)
-#define GP2X_BUTTON_X               (14)
-#define GP2X_BUTTON_Y               (15)
-#define GP2X_BUTTON_L               (10)
-#define GP2X_BUTTON_R               (11)
-#define GP2X_BUTTON_START           (8)
-#define GP2X_BUTTON_SELECT          (9)
-#define GP2X_BUTTON_VOLUP           (16)
-#define GP2X_BUTTON_VOLDOWN         (17)
-	if ((event->type == ev_keydown || event->type == ev_keyup) && (KEY_JOY1 <= event->data1 && event->data1 <= KEY_JOY1+JOYBUTTONS))
-	{
-		INT32 button = event->data1-KEY_JOY1;
-		if (button <= 7)
-		{
-			static UINT8 DPAD = 0;
-			if (event->type == ev_keyup)
-			{
-				event->type = ev_console;
-				DPAD &= ~(1<<button);
-			}
-			else
-			{
-				event->type = ev_joystick;
-				DPAD |= 1<<button;
-			}
-			event->data2 = event->data3 = INT32_MAX;
-			if ((DPAD & (1<<GP2X_BUTTON_UP)) && ((DPAD & (1<<GP2X_BUTTON_UPLEFT)) || (DPAD & (1<<GP2X_BUTTON_UPRIGHT))))
-				button = GP2X_BUTTON_UP;
-			if ((DPAD & (1<<GP2X_BUTTON_LEFT)) && ((DPAD & (1<<GP2X_BUTTON_UPLEFT)) || (DPAD & (1<<GP2X_BUTTON_DOWNLEFT))))
-				button = GP2X_BUTTON_LEFT;
-			if ((DPAD & (1<<GP2X_BUTTON_DOWN)) && ((DPAD & (1<<GP2X_BUTTON_DOWNLEFT)) || (DPAD & (1<<GP2X_BUTTON_DOWNRIGHT))))
-				button = GP2X_BUTTON_DOWN;
-			if ((DPAD & (1<<GP2X_BUTTON_RIGHT)) && ((DPAD & (1<<GP2X_BUTTON_UPRIGHT)) || (DPAD & (1<<GP2X_BUTTON_DOWNRIGHT))))
-				button = GP2X_BUTTON_RIGHT;
-			if (DPAD == 0)
-			{
-				event->type = ev_joystick;
-				event->data2 = event->data3 = 0;
-			}
-			else switch (button)
-			{
-				case GP2X_BUTTON_UP:
-					event->data3 = -1;
-					break;
-				case GP2X_BUTTON_DOWN:
-					event->data3 = 1;
-					break;
-				case GP2X_BUTTON_LEFT:
-					event->data2 = -1;
-					break;
-				case GP2X_BUTTON_RIGHT:
-					event->data2 = 1;
-					break;
-				case GP2X_BUTTON_UPLEFT:
-					event->data2 = -1;
-					event->data3 = -1;
-					break;
-				case GP2X_BUTTON_UPRIGHT:
-					event->data2 = 1;
-					event->data3 = -1;
-					break;
-				case GP2X_BUTTON_DOWNLEFT:
-					event->data2 = -1;
-					event->data3 = 1;
-					break;
-				case GP2X_BUTTON_DOWNRIGHT:
-					event->data2 = 1;
-					event->data3 = 1;
-				default:
-					break;
-			}
-			event->data1 = 0;
-			return;
-		}
-		else switch (button)
-		{
-			case GP2X_BUTTON_CLICK:
-				event->data1 = KEY_ENTER;
-				break;
-			case GP2X_BUTTON_A:
-				event->data1 = KEY_JOY1+0;
-				break;
-			case GP2X_BUTTON_B:
-				event->data1 = KEY_JOY1+2;
-				break;
-			case GP2X_BUTTON_X:
-				event->data1 = KEY_JOY1+3;
-				break;
-			case GP2X_BUTTON_Y:
-				event->data1 = KEY_JOY1+1;
-				break;
-			case GP2X_BUTTON_L:
-				event->data1 = KEY_JOY1+4;
-				break;
-			case GP2X_BUTTON_R:
-				event->data1 = KEY_JOY1+5;
-				break;
-			case GP2X_BUTTON_START:
-				event->data1 = KEY_ESCAPE;
-				break;
-			case GP2X_BUTTON_SELECT:
-				event->data1 = KEY_JOY1+8;
-				break;
-			case GP2X_BUTTON_VOLUP:
-				event->data1 = KEY_JOY1+6;
-				break;
-			case GP2X_BUTTON_VOLDOWN:
-				event->data1 = KEY_JOY1+7;
-				break;
-			default:
-				break;
-		}
-		//I_OutputMsg("Button %i: event key %i and type: %i\n", button, event->data1, event->type);
-	}
-#elif defined(_PSP)
-	if (event->data1 > KEY_JOY1 + 9 + 2) // All button after D-Pad and Select/Start
-		event->data1 -= 4; // remap D-pad to Hats, offset of -4
-	else if (event->data1 == KEY_JOY1 + 6) // Down
-		event->data1 = KEY_HAT1+1;
-	else if (event->data1 == KEY_JOY1 + 7) // Left
-		event->data1 = KEY_HAT1+2;
-	else if (event->data1 == KEY_JOY1 + 8) // Up
-		event->data1 = KEY_HAT1+0;
-	else if (event->data1 == KEY_JOY1 + 9) // Right
-		event->data1 = KEY_HAT1+3;
-	else if (event->data1 == KEY_JOY1 + 10) // Select
-		event->data1 = KEY_TAB;
-	else if (event->data1 == KEY_JOY1 + 11) // Start
-		event->data1 = KEY_ESCAPE;
-#else
-	(void)event;
-#endif
-}
-
-static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
-{
-#ifdef _arch_dreamcast // -128 to 127 SDL for DC have give us a smaller range
-	INT32 raxis = axis*8;
-#else // -32768 to 32767
-	INT32 raxis = axis/32;
-#endif
-	if (which == ev_joystick)
-	{
-		if (Joystick.bGamepadStyle)
-		{
-			// gamepad control type, on or off, live or die
-			if (raxis < -(JOYAXISRANGE/2))
-				raxis = -1;
-			else if (raxis > (JOYAXISRANGE/2))
-				raxis = 1;
-			else
-				raxis = 0;
-		}
-		else
-		{
-			raxis = JoyInfo.scale!=1?((raxis/JoyInfo.scale)*JoyInfo.scale):raxis;
-
-#ifdef SDL_JDEADZONE
-			if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
-				raxis = 0;
-#endif
-		}
-	}
-	else if (which == ev_joystick2)
-	{
-		if (Joystick2.bGamepadStyle)
-		{
-			// gamepad control type, on or off, live or die
-			if (raxis < -(JOYAXISRANGE/2))
-				raxis = -1;
-			else if (raxis > (JOYAXISRANGE/2))
-				raxis = 1;
-			else raxis = 0;
-		}
-		else
-		{
-			raxis = JoyInfo2.scale!=1?((raxis/JoyInfo2.scale)*JoyInfo2.scale):raxis;
-
-#ifdef SDL_JDEADZONE
-			if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
-				raxis = 0;
-#endif
-		}
-	}
-	return raxis;
-}
-
-void I_GetEvent(void)
-{
-	SDL_Event inputEvent;
-	static SDL_bool sdlquit = SDL_FALSE; //Alam: once, just once
-	event_t event;
-
-	if (!graphics_started)
-		return;
-
-	memset(&inputEvent, 0x00, sizeof(inputEvent));
-	while (SDL_PollEvent(&inputEvent))
-	{
-		memset(&event,0x00,sizeof (event_t));
-		switch (inputEvent.type)
-		{
-			case SDL_ACTIVEEVENT:
-				if (inputEvent.active.state  & (SDL_APPACTIVE|SDL_APPINPUTFOCUS))
-				{
-					// pause music when alt-tab
-					if (inputEvent.active.gain /*&& !paused */)
-					{
-						static SDL_bool firsttimeonmouse = SDL_TRUE;
-						if (!firsttimeonmouse)
-						{
-							if (cv_usemouse.value) I_StartupMouse();
-						}
-						else firsttimeonmouse = SDL_FALSE;
-						//if (!netgame && !con_destlines) paused = false;
-						if (gamestate == GS_LEVEL)
-							if (!paused) I_ResumeSong(0); //resume it
-					}
-					else /*if (!paused)*/
-					{
-						if (!disable_mouse)
-							SDLforceUngrabMouse();
-						if (!netgame && gamestate == GS_LEVEL) paused = true;
-						memset(gamekeydown, 0, NUMKEYS);
-						//S_PauseSound();
-						if (gamestate == GS_LEVEL)
-							I_PauseSong(0); //pause it
-					}
-				}
-				if (MOUSE_MENU)
-				{
-					SDLdoUngrabMouse();
-					break;
-				}
-				if ((SDL_APPMOUSEFOCUS&inputEvent.active.state) && USE_MOUSEINPUT && inputEvent.active.gain)
-					HalfWarpMouse(realwidth, realheight);
-				break;
-			case SDL_KEYDOWN:
-			case SDL_KEYUP:
-				/// \todo inputEvent.key.which?
-				if (inputEvent.type == SDL_KEYUP)
-					event.type = ev_keyup;
-				else if (inputEvent.type == SDL_KEYDOWN)
-					event.type = ev_keydown;
-				else break;
-				event.data1 = SDLatekey(inputEvent.key.keysym.sym);
-				if (event.data1) D_PostEvent(&event);
-				break;
-			case SDL_MOUSEMOTION:
-				/// \todo inputEvent.motion.which
-				if (MOUSE_MENU)
-				{
-					SDLdoUngrabMouse();
-					break;
-				}
-				if (USE_MOUSEINPUT)
-				{
-					// If the event is from warping the pointer back to middle
-					// of the screen then ignore it.
-					if ((inputEvent.motion.x == realwidth/2) &&
-					    (inputEvent.motion.y == realheight/2))
-					{
-						break;
-					}
-					else
-					{
-						event.data2 = +inputEvent.motion.xrel;
-						event.data3 = -inputEvent.motion.yrel;
-					}
-					event.type = ev_mouse;
-					D_PostEvent(&event);
-					// Warp the pointer back to the middle of the window
-					//  or we cannot move any further if it's at a border.
-					if ((inputEvent.motion.x < (realwidth/2 )-(realwidth/4 )) ||
-					    (inputEvent.motion.y < (realheight/2)-(realheight/4)) ||
-					    (inputEvent.motion.x > (realwidth/2 )+(realwidth/4 )) ||
-					    (inputEvent.motion.y > (realheight/2)+(realheight/4) ) )
-					{
-						//if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY) || !mousegrabok)
-							HalfWarpMouse(realwidth, realheight);
-					}
-				}
-				break;
-			case SDL_MOUSEBUTTONDOWN:
-			case SDL_MOUSEBUTTONUP:
-				/// \todo inputEvent.button.which
-				if (USE_MOUSEINPUT)
-				{
-					if (inputEvent.type == SDL_MOUSEBUTTONUP)
-						event.type = ev_keyup;
-					else if (inputEvent.type == SDL_MOUSEBUTTONDOWN)
-						event.type = ev_keydown;
-					else break;
-					if (inputEvent.button.button==SDL_BUTTON_WHEELUP || inputEvent.button.button==SDL_BUTTON_WHEELDOWN)
-					{
-						if (inputEvent.type == SDL_MOUSEBUTTONUP)
-							event.data1 = 0; //Alam: dumb! this could be a real button with some mice
-						else
-							event.data1 = KEY_MOUSEWHEELUP + inputEvent.button.button - SDL_BUTTON_WHEELUP;
-					}
-					else if (inputEvent.button.button == SDL_BUTTON_MIDDLE)
-						event.data1 = KEY_MOUSE1+2;
-					else if (inputEvent.button.button == SDL_BUTTON_RIGHT)
-						event.data1 = KEY_MOUSE1+1;
-					else if (inputEvent.button.button <= MOUSEBUTTONS)
-						event.data1 = KEY_MOUSE1 + inputEvent.button.button - SDL_BUTTON_LEFT;
-					if (event.data1) D_PostEvent(&event);
-				}
-				break;
-			case SDL_JOYAXISMOTION:
-				inputEvent.jaxis.which++;
-				inputEvent.jaxis.axis++;
-				event.data1 = event.data2 = event.data3 = INT32_MAX;
-				if (cv_usejoystick.value == inputEvent.jaxis.which)
-				{
-					event.type = ev_joystick;
-				}
-				else if (cv_usejoystick.value == inputEvent.jaxis.which)
-				{
-					event.type = ev_joystick2;
-				}
-				else break;
-				//axis
-				if (inputEvent.jaxis.axis > JOYAXISSET*2)
-					break;
-				//vaule
-				if (inputEvent.jaxis.axis%2)
-				{
-					event.data1 = inputEvent.jaxis.axis / 2;
-					event.data2 = SDLJoyAxis(inputEvent.jaxis.value, event.type);
-				}
-				else
-				{
-					inputEvent.jaxis.axis--;
-					event.data1 = inputEvent.jaxis.axis / 2;
-					event.data3 = SDLJoyAxis(inputEvent.jaxis.value, event.type);
-				}
-				D_PostEvent(&event);
-				break;
-			case SDL_JOYBALLMOTION:
-			case SDL_JOYHATMOTION:
-				break; //NONE
-			case SDL_JOYBUTTONDOWN:
-			case SDL_JOYBUTTONUP:
-				inputEvent.jbutton.which++;
-				if (cv_usejoystick.value == inputEvent.jbutton.which)
-					event.data1 = KEY_JOY1;
-				else if (cv_usejoystick.value == inputEvent.jbutton.which)
-					event.data1 = KEY_2JOY1;
-				else break;
-				if (inputEvent.type == SDL_JOYBUTTONUP)
-					event.type = ev_keyup;
-				else if (inputEvent.type == SDL_JOYBUTTONDOWN)
-					event.type = ev_keydown;
-				else break;
-				if (inputEvent.jbutton.button < JOYBUTTONS)
-					event.data1 += inputEvent.jbutton.button;
-				else
-					break;
-				SDLJoyRemap(&event);
-				if (event.type != ev_console) D_PostEvent(&event);
-				break;
-#ifndef  _WIN32_WCE
-			case SDL_QUIT:
-				if (!sdlquit)
-				{
-					sdlquit = SDL_TRUE;
-					M_QuitResponse('y');
-				}
-				break;
-#endif
-#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE)
-			case SDL_SYSWMEVENT:
-				MainWndproc(inputEvent.syswm.msg->hwnd,
-					inputEvent.syswm.msg->msg,
-					inputEvent.syswm.msg->wParam,
-					inputEvent.syswm.msg->lParam);
-				break;
-#endif
-			case SDL_VIDEORESIZE:
-				if (gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN || gamestate == GS_EVALUATION)
-				    setmodeneeded = VID_GetModeForSize(inputEvent.resize.w,inputEvent.resize.h)+1;
-				if (render_soft == rendermode)
-				{
-#ifdef FILTERS
-					INT32 filtervalue = cv_filter.value;
-					if (blitfilter) CV_SetValue(&cv_filter,1);
-#endif
-					SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW);
-					if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256);
-#ifdef FILTERS
-					CV_SetValue(&cv_filter,filtervalue);
-#endif
-				}
-				else
-					SDLSetMode(realwidth, realheight, vid.bpp*8, surfaceFlagsW);
-				if (!vidSurface)
-					I_Error("Could not reset vidmode: %s\n",SDL_GetError());
-				break;
-			case SDL_VIDEOEXPOSE:
-				exposevideo = SDL_TRUE;
-				break;
-			default:
-				break;
-		}
-	}
-	//reset wheel like in win32, I don't understand it but works
-	gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0;
-}
-
-void I_StartupMouse(void)
-{
-	static SDL_bool firsttimeonmouse = SDL_TRUE;
-
-	if (disable_mouse)
-		return;
-
-	if (!firsttimeonmouse)
-		HalfWarpMouse(realwidth, realheight); // warp to center
-	else
-		firsttimeonmouse = SDL_FALSE;
-	if (cv_usemouse.value)
-		return;
-	else
-		SDLdoUngrabMouse();
-}
-
-//
-// I_OsPolling
-//
-void I_OsPolling(void)
-{
-	if (consolevent)
-		I_GetConsoleEvents();
-	if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
-	{
-		SDL_JoystickUpdate();
-		I_GetJoystickEvents();
-		I_GetJoystick2Events();
-	}
-#ifdef _arch_dreamcast
-	//vmu_set_icon(VMU_bits);
-#endif
-
-	I_GetMouseEvents();
-
-	I_GetEvent();
-}
-
-//
-// I_UpdateNoBlit
-//
-void I_UpdateNoBlit(void)
-{
-	if (!vidSurface)
-		return;
-#ifdef HWRENDER
-	if (rendermode != render_soft)
-		OglSdlFinishUpdate(cv_vidwait.value);
-	else
-#endif
-	if (vidSurface->flags&SDL_DOUBLEBUF)
-		SDL_Flip(vidSurface);
-	else if (exposevideo)
-		SDL_UpdateRect(vidSurface, 0, 0, 0, 0);
-	exposevideo = SDL_FALSE;
-}
-
-// I_SkipFrame
-//
-// Returns true if it thinks we can afford to skip this frame
-// from PrBoom's src/SDL/i_video.c
-static inline boolean I_SkipFrame(void)
-{
-	static boolean skip = false;
-
-	if (render_soft != rendermode)
-		return false;
-
-	skip = !skip;
-
-#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast))
-	return skip;
-#endif
-
-	switch (gamestate)
-	{
-		case GS_LEVEL:
-			if (!paused)
-				return false;
-		//case GS_TIMEATTACK: -- sorry optimisation but now we have a cool level platter and that being laggardly looks terrible
-		case GS_WAITINGPLAYERS:
-			return skip; // Skip odd frames
-		default:
-			return false;
-	}
-}
-
-static inline SDL_bool SDLmatchVideoformat(void)
-{
-	const SDL_PixelFormat *vidformat = vidSurface->format;
-	const INT32 vfBPP = vidformat?vidformat->BitsPerPixel:0;
-	return (((vfBPP == 8 && vid.bpp == 1 &&
-	 !vidformat->Rmask && !vidformat->Gmask && !vidformat->Bmask) ||
-	 (vfBPP == 15 && vid.bpp == 2 && vidformat->Rmask == 0x7C00 &&
-	 vidformat->Gmask == 0x03E0 && vidformat->Bmask == 0x001F )) &&
-	 !vidformat->Amask && (vidSurface->flags & SDL_RLEACCEL) == 0);
-}
-
-//
-// I_FinishUpdate
-//
-void I_FinishUpdate(void)
-{
-	if (!vidSurface)
-		return; //Alam: No software or OpenGl surface
-
-	if (I_SkipFrame())
-		return;
-
-	// draw captions if enabled
-	if (cv_closedcaptioning.value)
-		SCR_ClosedCaptions();
-
-	if (cv_ticrate.value)
-		SCR_DisplayTicRate();
-
-	if (render_soft == rendermode && screens[0])
-	{
-		SDL_Rect *dstrect = NULL;
-		SDL_Rect rect = {0, 0, 0, 0};
-		SDL_PixelFormat *vidformat = vidSurface->format;
-		int lockedsf = 0, blited = 0;
-
-		rect.w = (Sint16)vid.width;
-		rect.h = (Sint16)vid.height;
-
-		if (vidSurface->h > vid.height)
-			rect.y = (Sint16)((vidSurface->h-vid.height)/2);
-
-		dstrect = &rect;
-
-
-		if (!bufSurface && !vid.direct) //Double-Check
-		{
-			if (vid.bpp == 1) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,8,
-				(int)vid.rowbytes,0x00000000,0x00000000,0x00000000,0x00000000); // 256 mode
-			else if (vid.bpp == 2) bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15,
-				(int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode
-			if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256);
-			else I_OutputMsg("No system memory for SDL buffer surface\n");
-		}
-
-#ifdef FILTERS
-		FilterBlit(bufSurface);
-		if (f2xSurface) //Alam: filter!
-		{
-			//I_OutputMsg("2x Filter Code\n");
-			blited = SDL_BlitSurface(f2xSurface,NULL,vidSurface,NULL);
-		}
-		else
-#endif
-#if 0
-		if (SDLmatchVideoformat() && !vid.direct)//Alam: DOS Way
-		{
-			if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface);
-			if (lockedsf == 0)
-			{
-				if (vidSurface->pixels > vid.height)
-				{
-					UINT8 *ptr = vidSurface->pixels;
-					size_t half_excess = vidSurface->pitch*(vidSurface->height-vid.height)/2;
-					memset(ptr, 0x1F, half_excess);
-					ptr += half_excess;
-					VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height,
-					                     vid.rowbytes, vidSurface->pitch);
-					ptr += vid.height*vidSurface->pitch;
-					memset(ptr, 0x1F, half_excess);
-				}
-				else
-				VID_BlitLinearScreen(screens[0], vidSurface->pixels, vid.width*vid.bpp,
-				                     vid.height, vid.rowbytes, vidSurface->pitch );
-				if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface);
-			}
-		}
-		else
-#endif
-		if (bufSurface) //Alam: New Way to send video data
-		{
-			blited = SDL_BlitSurface(bufSurface,NULL,vidSurface,dstrect);
-		}
-		else if (vid.bpp == 1 && !vid.direct)
-		{
-			Uint8 *bP,*vP; //Src, Dst
-			Uint16 bW, vW; // Pitch Remainder
-			Sint32 pH, pW; //Height, Width
-			bP = (Uint8 *)screens[0];
-			bW = (Uint16)(vid.rowbytes - vid.width);
-			//I_OutputMsg("Old Copy Code\n");
-			if (SDL_MUSTLOCK(vidSurface)) lockedsf = SDL_LockSurface(vidSurface);
-			vP = (Uint8 *)vidSurface->pixels;
-			vW = (Uint16)(vidSurface->pitch - vidSurface->w*vidformat->BytesPerPixel);
-			if (vidSurface->h > vid.height)
-				vP += vidSurface->pitch*(vidSurface->h-vid.height)/2;
-			if (lockedsf == 0 && vidSurface->pixels)
-			{
-				if (vidformat->BytesPerPixel == 2)
-				{
-					for (pH=0;pH < vidSurface->h;pH++)
-					{
-						for (pW=0;pW < vidSurface->w;pW++)
-						{
-							*((Uint16 *)(void *)vP) = (Uint16)SDL_MapRGB(vidformat,
-								localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b);
-							bP++;
-							vP += 2;
-						}
-						bP += bW;
-						vP += vW;
-					}
-				}
-				else if (vidformat->BytesPerPixel == 3)
-				{
-					for (pH=0;pH < vidSurface->h;pH++)
-					{
-						for (pW=0;pW < vidSurface->w;pW++)
-						{
-							*((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat,
-								localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b);
-							bP++;
-							vP += 3;
-						}
-						bP += bW;
-						vP += vW;
-					}
-				}
-				else if (vidformat->BytesPerPixel == 4)
-				{
-					for (pH=0;pH < vidSurface->h;pH++)
-					{
-						for (pW=0;pW < vidSurface->w;pW++)
-						{
-							*((Uint32 *)(void *)vP) = SDL_MapRGB(vidformat,
-								localPalette[*bP].r,localPalette[*bP].g,localPalette[*bP].b);
-							bP++;
-							vP += 4;
-						}
-						bP += bW;
-						vP += vW;
-					}
-				}
-				else
-				{
-					;//NOP
-				}
-			}
-			if (SDL_MUSTLOCK(vidSurface)) SDL_UnlockSurface(vidSurface);
-		}
-		else /// \todo 15t15,15tN, others?
-		{
-			;//NOP
-		}
-
-#ifdef HAVE_GP2XSDL
-		//if (blited == 0)
-			SDL_GP2X_WaitForBlitter();
-#endif
-
-		if (lockedsf == 0 && blited == 0 && vidSurface->flags&SDL_DOUBLEBUF)
-			SDL_Flip(vidSurface);
-		else if (blited != -2 && lockedsf == 0) //Alam: -2 for Win32 Direct, yea, i know
-			SDL_UpdateRect(vidSurface, rect.x, rect.y, 0, 0); //Alam: almost always
-		else
-			I_OutputMsg("%s\n",SDL_GetError());
-	}
-#ifdef HWRENDER
-	else
-	{
-		OglSdlFinishUpdate(cv_vidwait.value);
-	}
-#endif
-	exposevideo = SDL_FALSE;
-}
-
-//
-// I_UpdateNoVsync
-//
-void I_UpdateNoVsync(void)
-{
-	INT32 real_vidwait = cv_vidwait.value;
-	cv_vidwait.value = 0;
-	I_FinishUpdate();
-	cv_vidwait.value = real_vidwait;
-}
-
-//
-// I_ReadScreen
-//
-void I_ReadScreen(UINT8 *scr)
-{
-	if (rendermode != render_soft)
-		I_Error ("I_ReadScreen: called while in non-software mode");
-	else
-		VID_BlitLinearScreen(screens[0], scr,
-			vid.width*vid.bpp, vid.height,
-			vid.rowbytes, vid.rowbytes);
-}
-
-//
-// I_SetPalette
-//
-void I_SetPalette(RGBA_t *palette)
-{
-	size_t i;
-	for (i=0; i<256; i++)
-	{
-		localPalette[i].r = palette[i].s.red;
-		localPalette[i].g = palette[i].s.green;
-		localPalette[i].b = palette[i].s.blue;
-	}
-	if (vidSurface) SDL_SetColors(vidSurface, localPalette, 0, 256);
-	if (bufSurface) SDL_SetColors(bufSurface, localPalette, 0, 256);
-}
-
-// return number of fullscreen + X11 modes
-INT32 VID_NumModes(void)
-{
-	if (USE_FULLSCREEN && numVidModes != -1)
-		return numVidModes - firstEntry;
-	else
-		return MAXWINMODES;
-}
-
-const char *VID_GetModeName(INT32 modeNum)
-{
-	if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
-	{
-		modeNum += firstEntry;
-		if (modeNum >= numVidModes)
-			return NULL;
-
-		sprintf(&vidModeName[modeNum][0], "%dx%d",
-			modeList[modeNum]->w,
-			modeList[modeNum]->h);
-	}
-	else // windowed modes
-	{
-		if (modeNum > MAXWINMODES)
-			return NULL;
-
-		sprintf(&vidModeName[modeNum][0], "%dx%d",
-			windowedModes[modeNum][0],
-			windowedModes[modeNum][1]);
-	}
-	return &vidModeName[modeNum][0];
-}
-
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
-{
-	INT32 matchMode = -1, i;
-	VID_PrepareModeList();
-	if (USE_FULLSCREEN && numVidModes != -1)
-	{
-		for (i=firstEntry; i<numVidModes; i++)
-		{
-			if (modeList[i]->w == w &&
-			    modeList[i]->h == h)
-			{
-				matchMode = i;
-				break;
-			}
-		}
-		if (-1 == matchMode) // use smaller mode
-		{
-			w -= w%BASEVIDWIDTH;
-			h -= h%BASEVIDHEIGHT;
-			for (i=firstEntry; i<numVidModes; i++)
-			{
-				if (modeList[i]->w == w &&
-				    modeList[i]->h == h)
-				{
-					matchMode = i;
-					break;
-				}
-			}
-			if (-1 == matchMode) // use smallest mode
-				matchMode = numVidModes-1;
-		}
-		matchMode -= firstEntry;
-	}
-	else
-	{
-		for (i=0; i<MAXWINMODES; i++)
-		{
-			if (windowedModes[i][0] == w &&
-			    windowedModes[i][1] == h)
-			{
-				matchMode = i;
-				break;
-			}
-		}
-		if (-1 == matchMode) // use smaller mode
-		{
-			w -= w%BASEVIDWIDTH;
-			h -= h%BASEVIDHEIGHT;
-			for (i=0; i<MAXWINMODES; i++)
-			{
-				if (windowedModes[i][0] == w &&
-				    windowedModes[i][1] == h)
-				{
-					matchMode = i;
-					break;
-				}
-			}
-			if (-1 == matchMode) // use smallest mode
-				matchMode = MAXWINMODES-1;
-		}
-	}
-	return matchMode;
-}
-
-void VID_PrepareModeList(void)
-{
-	INT32 i;
-
-	firstEntry = 0;
-
-#ifdef HWRENDER
-	if (rendermode == render_opengl)
-		modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN);
-	else
-#endif
-	modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
-
-	if (disable_fullscreen?0:cv_fullscreen.value) // only fullscreen needs preparation
-	{
-		if (-1 != numVidModes)
-		{
-			for (i=0; i<numVidModes; i++)
-			{
-				if (modeList[i]->w <= MAXVIDWIDTH &&
-					modeList[i]->h <= MAXVIDHEIGHT)
-				{
-					firstEntry = i;
-					break;
-				}
-			}
-		}
-	}
-	allow_fullscreen = true;
-}
-
-static inline void SDLESSet(void)
-{
-#ifdef HAVE_DCSDL
-	INT32 j;
-	SDL_DC_SetVideoDriver(SDL_DC_DIRECT_VIDEO); //SDL_DC_DMA_VIDEO
-	for (j=0;j<4;j++)
-	{
-		SDL_DC_MapKey(j,SDL_DC_START,SDLK_ESCAPE);
-		SDL_DC_MapKey(j,SDL_DC_A,SDLK_UNKNOWN);
-		SDL_DC_MapKey(j,SDL_DC_B,SDLK_UNKNOWN);
-		SDL_DC_MapKey(j,SDL_DC_X,SDLK_UNKNOWN);
-		SDL_DC_MapKey(j,SDL_DC_Y,SDLK_UNKNOWN);
-		SDL_DC_MapKey(j,SDL_DC_L,SDLK_UNKNOWN);
-		SDL_DC_MapKey(j,SDL_DC_R,SDLK_UNKNOWN);
-		//SDL_DC_MapKey(j,SDL_DC_LEFT,SDLK_UNKNOWN);
-		//SDL_DC_MapKey(j,SDL_DC_RIGHT,SDLK_UNKNOWN);
-		//SDL_DC_MapKey(j,SDL_DC_UP,SDLK_UNKNOWN);
-		//SDL_DC_MapKey(j,SDL_DC_DOWN,SDLK_UNKNOWN);
-	}
-	//SDL_DC_MapKey(0,SDL_DC_L,SDLK_LEFTBRACKET);
-	//SDL_DC_MapKey(0,SDL_DC_R,SDLK_RIGHTBRACKET);
-	//SDL_DC_MapKey(0,SDL_DC_START,SDLK_UNKNOWN);
-	//SDL_DC_MapKey(1,SDL_DC_L,SDLK_z);
-	//SDL_DC_MapKey(1,SDL_DC_R,SDLK_x);
-#endif
-#ifdef HAVE_GP2XSDL
-	SDL_GP2X_MiniDisplay(0,0);
-	//SDL_GP2X_DenyGfxMemory(NULL, 0);
-	SDL_GP2X_AllowGfxMemory(NULL, 0);
-#endif
-}
-
-static void SDLWMSet(void)
-{
-#ifdef RPC_NO_WINDOWS_H
-	SDL_SysWMinfo SDLWM;
-	memset(&SDLWM,0,sizeof (SDL_SysWMinfo));
-	SDL_VERSION(&SDLWM.version)
-	if (SDL_GetWMInfo(&SDLWM))
-		vid.WndParent = SDLWM.window;
-	else
-		vid.WndParent = INVALID_HANDLE_VALUE;
-	if (vid.WndParent != INVALID_HANDLE_VALUE)
-	{
-		SetFocus(vid.WndParent);
-		ShowWindow(vid.WndParent, SW_SHOW);
-	}
-#ifndef _WIN32_WCE
-	SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
-#endif
-#endif
-	SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE);
-}
-
-static void* SDLGetDirect(void)
-{
-#if 0 //#ifndef __MACH__ // Do not directly access the MacOSX's OpenGL memory
-	if (!SDL_MUSTLOCK(vidSurface) && SDLmatchVideoformat())
-	{
-		vid.rowbytes = vidSurface->pitch;
-		return vidSurface->pixels;
-	}
-#endif // you can not use the video memory in pixels member in fullscreen mode
-	return NULL;
-}
-
-INT32 VID_SetMode(INT32 modeNum)
-{
-#ifdef _WIN32_WCE
-	(void)modeNum;
-#else
-	SDLdoUngrabMouse();
-	vid.recalc = true;
-	BitsPerPixel = (Uint8)cv_scr_depth.value;
-	//vid.bpp = BitsPerPixel==8?1:2;
-	// Window title
-	SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2");
-
-	if (render_soft == rendermode)
-	{
-		//Alam: SDL_Video system free vidSurface for me
-		if (vid.buffer) free(vid.buffer);
-		vid.buffer = NULL;
-		if (bufSurface) SDL_FreeSurface(bufSurface);
-		bufSurface = NULL;
-	}
-
-	if (USE_FULLSCREEN)
-	{
-		if (numVidModes != -1)
-		{
-			modeNum += firstEntry;
-			vid.width = modeList[modeNum]->w;
-			vid.height = modeList[modeNum]->h;
-		}
-		else
-		{
-			vid.width = windowedModes[modeNum][0];
-			vid.height = windowedModes[modeNum][1];
-		}
-		if (render_soft == rendermode)
-		{
-			SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsF);
-
-			if (!vidSurface)
-			{
-				cv_fullscreen.value = 0;
-				modeNum = VID_GetModeForSize(vid.width,vid.height);
-				vid.width = windowedModes[modeNum][0];
-				vid.height = windowedModes[modeNum][1];
-				SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW);
-				if (!vidSurface)
-					I_Error("Could not set vidmode: %s\n",SDL_GetError());
-			}
-		}
-#ifdef HWRENDER
-		else // (render_soft != rendermode)
-		{
-			if (!OglSdlSurface(vid.width, vid.height, true))
-			{
-				cv_fullscreen.value = 0;
-				modeNum = VID_GetModeForSize(vid.width,vid.height);
-				vid.width = windowedModes[modeNum][0];
-				vid.height = windowedModes[modeNum][1];
-				if (!OglSdlSurface(vid.width, vid.height,false))
-					I_Error("Could not set vidmode: %s\n",SDL_GetError());
-			}
-
-			realwidth = (Uint16)vid.width;
-			realheight = (Uint16)vid.height;
-		}
-#endif
-	}
-	else //(cv_fullscreen.value)
-	{
-		vid.width = windowedModes[modeNum][0];
-		vid.height = windowedModes[modeNum][1];
-
-		if (render_soft == rendermode)
-		{
-			SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW);
-			if (!vidSurface)
-				I_Error("Could not set vidmode: %s\n",SDL_GetError());
-		}
-#ifdef HWRENDER
-		else //(render_soft != rendermode)
-		{
-			if (!OglSdlSurface(vid.width, vid.height, false))
-				I_Error("Could not set vidmode: %s\n",SDL_GetError());
-			realwidth = (Uint16)vid.width;
-			realheight = (Uint16)vid.height;
-		}
-#endif
-	}
-
-	vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h);
-
-	if (render_soft == rendermode)
-	{
-		vid.rowbytes = vid.width*vid.bpp;
-		vid.direct = SDLGetDirect();
-		vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
-		if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
-		else I_Error ("Not enough memory for video buffer\n");
-	}
-
-#if 0 // broken
-	if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
-		vid.height = (INT32)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
-#endif
-#endif
-	I_StartupMouse();
-
-	SDLWMSet();
-
-	return true;
-}
-
-void I_StartupGraphics(void)
-{
-	static char SDLNOMOUSE[] = "SDL_NOMOUSE=1";
-	static char SDLVIDEOMID[] = "SDL_VIDEO_CENTERED=center";
-
-	if (dedicated)
-	{
-		rendermode = render_none;
-		return;
-	}
-	if (graphics_started)
-		return;
-
-	COM_AddCommand ("vid_nummodes", VID_Command_NumModes_f);
-	COM_AddCommand ("vid_info", VID_Command_Info_f);
-	COM_AddCommand ("vid_modelist", VID_Command_ModeList_f);
-	COM_AddCommand ("vid_mode", VID_Command_Mode_f);
-	CV_RegisterVar (&cv_vidwait);
-	CV_RegisterVar (&cv_stretch);
-#ifdef FILTERS
-	CV_RegisterVar (&cv_filter);
-#endif
-#ifdef _PSP // pitch is 0, mod of 0 crash
-	disable_mouse = true;
-#else
-	disable_mouse = M_CheckParm("-nomouse");
-#endif
-	if (disable_mouse)
-		I_PutEnv(SDLNOMOUSE);
-	if (!I_GetEnv("SDL_VIDEO_CENTERED"))
-		I_PutEnv(SDLVIDEOMID);
-	disable_fullscreen = M_CheckParm("-win");
-
-	keyboard_started = true;
-#ifdef _arch_dreamcast
-	conio_shutdown();
-#endif
-
-#if !defined(HAVE_TTF)
-#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio
-	if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
-#else //SDL_OpenAudio will do SDL_InitSubSystem(SDL_INIT_AUDIO)
-	if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
-#endif
-	{
-#ifdef _WIN32
-		if (SDL_WasInit(SDL_INIT_AUDIO)==0)
-			CONS_Printf(M_GetText("Couldn't initialize SDL's Audio System with Video System: %s\n"), SDL_GetError());
-		if (SDL_WasInit(SDL_INIT_VIDEO)==0)
-#endif
-		{
-			CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError());
-			return;
-		}
-	}
-#ifdef REMOTE_DEBUGGING
-#ifdef _WII
-	_break(); // break for debugger
-#endif
-#endif
-#endif
-	{
-		char vd[100]; //stack space for video name
-		CONS_Printf(M_GetText("Starting up with video driver : %s\n"), SDL_VideoDriverName(vd,100));
-		if (strncasecmp(vd, "gcvideo", 8) == 0 || strncasecmp(vd, "fbcon", 6) == 0 || strncasecmp(vd, "wii", 4) == 0 || strncasecmp(vd, "psl1ght", 8) == 0)
-			framebuffer = SDL_TRUE;
-	}
-	if (M_CheckParm("-software"))
-		rendermode = render_soft;
-	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
-	SDLESSet();
-	VID_Command_ModeList_f();
-	vid.buffer = NULL;  // For software mode
-	vid.width = BASEVIDWIDTH; // Default size for startup
-	vid.height = BASEVIDHEIGHT; // BitsPerPixel is the SDL interface's
-	vid.recalc = true; // Set up the console stufff
-	vid.direct = NULL; // Maybe direct access?
-	vid.bpp = 1; // This is the game engine's Bpp
-	vid.WndParent = NULL; //For the window?
-
-#ifdef HAVE_TTF
-	I_ShutdownTTF();
-#endif
-
-	// Window title
-#ifdef _WIN32_WCE
-	SDL_WM_SetCaption("SRB2 "VERSIONSTRING, "SRB2");
-#else
-	SDL_WM_SetCaption("SRB2: Starting up", "SRB2");
-#endif
-
-	// Window icon
-#ifdef HAVE_IMAGE
-	icoSurface = IMG_ReadXPMFromArray(SDL_icon_xpm);
-#endif
-	SDL_WM_SetIcon(icoSurface, NULL);
-
-#ifdef _WIN32
-	//DisableAero(); //also disable Aero on Vista
-#endif
-
-#ifdef HWRENDER
-	if (M_CheckParm("-opengl") || rendermode == render_opengl)
-	{
-		rendermode = render_opengl;
-		HWD.pfnInit             = hwSym("Init",NULL);
-		HWD.pfnFinishUpdate     = NULL;
-		HWD.pfnDraw2DLine       = hwSym("Draw2DLine",NULL);
-		HWD.pfnDrawPolygon      = hwSym("DrawPolygon",NULL);
-		HWD.pfnSetBlend         = hwSym("SetBlend",NULL);
-		HWD.pfnClearBuffer      = hwSym("ClearBuffer",NULL);
-		HWD.pfnSetTexture       = hwSym("SetTexture",NULL);
-		HWD.pfnReadRect         = hwSym("ReadRect",NULL);
-		HWD.pfnGClipRect        = hwSym("GClipRect",NULL);
-		HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
-		HWD.pfnSetSpecialState  = hwSym("SetSpecialState",NULL);
-		HWD.pfnSetPalette       = hwSym("SetPalette",NULL);
-		HWD.pfnGetTextureUsed   = hwSym("GetTextureUsed",NULL);
-		HWD.pfnDrawMD2          = hwSym("DrawMD2",NULL);
-		HWD.pfnDrawMD2i         = hwSym("DrawMD2i",NULL);
-		HWD.pfnSetTransform     = hwSym("SetTransform",NULL);
-		HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
-#ifdef SHUFFLE
-		HWD.pfnPostImgRedraw    = hwSym("PostImgRedraw",NULL);
-#endif
-		HWD.pfnStartScreenWipe  = hwSym("StartScreenWipe",NULL);
-		HWD.pfnEndScreenWipe    = hwSym("EndScreenWipe",NULL);
-		HWD.pfnDoScreenWipe     = hwSym("DoScreenWipe",NULL);
-		HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
-		HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
-		// check gl renderer lib
-		if (HWD.pfnGetRenderVersion() != VERSION)
-			I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
-#if 1 //#ifdef  _WIN32_WCE
-		vid.width = BASEVIDWIDTH;
-		vid.height = BASEVIDHEIGHT;
-#else
-		vid.width = 640; // hack to make voodoo cards work in 640x480
-		vid.height = 480;
-#endif
-		if (HWD.pfnInit(I_Error)) // let load the OpenGL library
-		{
-			/*
-			* We want at least 1 bit R, G, and B,
-			* and at least 16 bpp. Why 1 bit? May be more?
-			*/
-			SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
-			SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);
-			SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1);
-			SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-			if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN)))
-				if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN)))
-					rendermode = render_soft;
-		}
-		else
-			rendermode = render_soft;
-	}
-#else
-	rendermode = render_soft; //force software mode when there no HWRENDER code
-#endif
-	if (render_soft == rendermode)
-	{
-#if defined(_WII)
-		vid.width = 640;
-		vid.height = 480;
-#elif defined(_PS3)
-		vid.width = 720;
-		vid.height = 480;
-#else
-		vid.width = BASEVIDWIDTH;
-		vid.height = BASEVIDHEIGHT;
-#endif
-		SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW);
-		if (!vidSurface)
-		{
-			CONS_Printf(M_GetText("Could not set vidmode: %s\n") ,SDL_GetError());
-			vid.rowbytes = 0;
-			graphics_started = true;
-			return;
-		}
-		vid.rowbytes = vid.width * vid.bpp;
-		vid.direct = SDLGetDirect();
-		vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
-		if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
-		else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n"));
-	}
-	if (M_CheckParm("-nomousegrab"))
-		mousegrabok = SDL_FALSE;
-#ifdef _DEBUG
-	else
-	{
-		char videodriver[4] = {'S','D','L',0};
-		if (!M_CheckParm("-mousegrab") &&
-		    SDL_VideoDriverName(videodriver,4) &&
-		    strncasecmp("X11",videodriver,4) == 0)
-			mousegrabok = SDL_FALSE; //X11's XGrabPointer not good
-	}
-#endif
-	realwidth = (Uint16)vid.width;
-	realheight = (Uint16)vid.height;
-
-	VID_Command_Info_f();
-	if (!disable_mouse) SDL_ShowCursor(SDL_DISABLE);
-	SDLdoUngrabMouse();
-
-	SDLWMSet();
-
-	graphics_started = true;
-}
-
-void I_ShutdownGraphics(void)
-{
-	const rendermode_t oldrendermode = rendermode;
-
-	rendermode = render_none;
-	if (icoSurface) SDL_FreeSurface(icoSurface);
-	icoSurface = NULL;
-	if (render_soft == oldrendermode)
-	{
-		vidSurface = NULL; //Alam: SDL_Video system free vidSurface for me
-		if (vid.buffer) free(vid.buffer);
-		vid.buffer = NULL;
-		if (bufSurface) SDL_FreeSurface(bufSurface);
-		bufSurface = NULL;
-#ifdef FILTERS
-		if (preSurface) SDL_FreeSurface(preSurface);
-		preSurface = NULL;
-		if (f2xSurface) SDL_FreeSurface(f2xSurface);
-		f2xSurface = NULL;
-#endif
-	}
-
-	// was graphics initialized anyway?
-	if (!graphics_started)
-		return;
-	CONS_Printf("I_ShutdownGraphics: ");
-#ifdef _WIN32
-	//ResetAero();
-#endif
-	graphics_started = false;
-	CONS_Printf("%s", M_GetText("shut down\n"));
-#ifdef HWRENDER
-	if (GLUhandle)
-		hwClose(GLUhandle);
-#endif
-#ifndef _arch_dreamcast
-	SDL_QuitSubSystem(SDL_INIT_VIDEO);
-#endif
-	framebuffer = SDL_FALSE;
-}
-#endif
diff --git a/src/sdl12/macosx/English.lproj/InfoPlist.strings b/src/sdl12/macosx/English.lproj/InfoPlist.strings
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/src/sdl12/macosx/Info.plist b/src/sdl12/macosx/Info.plist
deleted file mode 100644
index ae0ce24de8e9ca4e07340ceb7851c1b13ec474bd..0000000000000000000000000000000000000000
--- a/src/sdl12/macosx/Info.plist
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>${EXECUTABLE_NAME}</string>
-	<key>CFBundleIconFile</key>
-	<string>Srb2mac.icns</string>
-	<key>CFBundleIdentifier</key>
-	<string>com.yourcompany.Srb2mac</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>${PRODUCT_NAME}</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>1.0</string>
-	<key>NSMainNibFile</key>
-	<string>SDLMain</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>
diff --git a/src/sdl12/macosx/Srb2mac.icns b/src/sdl12/macosx/Srb2mac.icns
deleted file mode 100644
index 4baedc1c5a091a3917d2a33bc3780da5b1b5e996..0000000000000000000000000000000000000000
Binary files a/src/sdl12/macosx/Srb2mac.icns and /dev/null differ
diff --git a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj
deleted file mode 100644
index de12201f5dc080390a9accea387021637c75aee5..0000000000000000000000000000000000000000
--- a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj
+++ /dev/null
@@ -1,3546 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 38;
-	objects = {
-		6726EB5E10190F860074DCBA = {
-			buildActionMask = 2147483647;
-			dstPath = "";
-			dstSubfolderSpec = 7;
-			files = (
-				6755C8D0101802C300A80195,
-				6755C8D1101802C300A80195,
-				6755C8D2101802C300A80195,
-				6755C8D3101802C300A80195,
-				6755C8D4101802C300A80195,
-				6755C8D5101802C300A80195,
-				6755C8D6101802C300A80195,
-				6755C8D7101802C300A80195,
-				6755C8D8101802C300A80195,
-			);
-			isa = PBXCopyFilesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		6726EB5F10190FFC0074DCBA = {
-			buildActionMask = 2147483647;
-			files = (
-			);
-			generatedFileNames = (
-			);
-			isa = PBXShellScriptBuildPhase;
-			neededFileNames = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "touch -c $SRCROOT/../../comptime.c";
-		};
-		6755C7A91017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = lzf.c;
-			path = ../../lzf.c;
-			refType = 2;
-		};
-		6755C7AA1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = lzf.h;
-			path = ../../lzf.h;
-			refType = 2;
-		};
-		6755C7AB1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_dllist.h;
-			path = ../../m_dllist.h;
-			refType = 2;
-		};
-		6755C7AC1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_queue.c;
-			path = ../../m_queue.c;
-			refType = 2;
-		};
-		6755C7AD1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_queue.h;
-			path = ../../m_queue.h;
-			refType = 2;
-		};
-		6755C7AE1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_polyobj.c;
-			path = ../../p_polyobj.c;
-			refType = 2;
-		};
-		6755C7AF1017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_polyobj.h;
-			path = ../../p_polyobj.h;
-			refType = 2;
-		};
-		6755C7B11017FE2500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = string.c;
-			path = ../../string.c;
-			refType = 2;
-		};
-		6755C7B21017FE2500A80195 = {
-			fileRef = 6755C7A91017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7B31017FE2500A80195 = {
-			fileRef = 6755C7AA1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7B51017FE2500A80195 = {
-			fileRef = 6755C7AC1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7B71017FE2500A80195 = {
-			fileRef = 6755C7AE1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7B81017FE2500A80195 = {
-			fileRef = 6755C7AF1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7BB1017FE2500A80195 = {
-			fileRef = 6755C7A91017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7BC1017FE2500A80195 = {
-			fileRef = 6755C7AA1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7BD1017FE2500A80195 = {
-			fileRef = 6755C7AB1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7BE1017FE2500A80195 = {
-			fileRef = 6755C7AC1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7BF1017FE2500A80195 = {
-			fileRef = 6755C7AD1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7C01017FE2500A80195 = {
-			fileRef = 6755C7AE1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7C11017FE2500A80195 = {
-			fileRef = 6755C7AF1017FE2500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C7C41017FE4400A80195 = {
-			children = (
-				6755C7FA1017FE4500A80195,
-				6755C7FB1017FE4500A80195,
-			);
-			isa = PBXGroup;
-			name = macosx;
-			path = "";
-			refType = 2;
-		};
-		6755C7FA1017FE4500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = mac_alert.c;
-			refType = 2;
-		};
-		6755C7FB1017FE4500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = mac_alert.h;
-			refType = 2;
-		};
-		6755C82A1017FE4500A80195 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = sdlmain.h;
-			path = ../sdlmain.h;
-			refType = 2;
-		};
-		6755C84B1017FE4500A80195 = {
-			fileRef = 6755C7FA1017FE4500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8651017FE4500A80195 = {
-			fileRef = 6755C82A1017FE4500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8861017FE4500A80195 = {
-			fileRef = 6755C7FA1017FE4500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8871017FE4500A80195 = {
-			fileRef = 6755C7FB1017FE4500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8A01017FE4500A80195 = {
-			fileRef = 6755C82A1017FE4500A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8A41017FE8000A80195 = {
-			children = (
-				84177748085A1097000C01D8,
-				84177749085A1097000C01D8,
-				8417774A085A1097000C01D8,
-				8417774B085A1097000C01D8,
-				8417774C085A1097000C01D8,
-				8417774D085A1097000C01D8,
-				8417774E085A1097000C01D8,
-				8417774F085A1097000C01D8,
-				84177750085A1097000C01D8,
-				84177751085A1097000C01D8,
-				84177752085A1097000C01D8,
-				84177753085A1097000C01D8,
-				84177754085A1097000C01D8,
-				84177755085A10AA000C01D8,
-				84177756085A10AA000C01D8,
-				6755C82A1017FE4500A80195,
-				84177757085A10AA000C01D8,
-				6755C7C41017FE4400A80195,
-			);
-			isa = PBXGroup;
-			name = SDL;
-			path = "";
-			refType = 2;
-		};
-		6755C8BE101802C300A80195 = {
-			isa = PBXFileReference;
-			name = drill.dta;
-			path = ../../../bin/Resources/drill.dta;
-			refType = 2;
-		};
-		6755C8BF101802C300A80195 = {
-			isa = PBXFileReference;
-			name = fmod.dll;
-			path = ../../../bin/Resources/fmod.dll;
-			refType = 2;
-		};
-		6755C8C0101802C300A80195 = {
-			isa = PBXFileReference;
-			name = knux.plr;
-			path = ../../../bin/Resources/knux.plr;
-			refType = 2;
-		};
-		6755C8C1101802C300A80195 = {
-			isa = PBXFileReference;
-			name = music.dta;
-			path = ../../../bin/Resources/music.dta;
-			refType = 2;
-		};
-		6755C8C2101802C300A80195 = {
-			isa = PBXFileReference;
-			name = rings.wpn;
-			path = ../../../bin/Resources/rings.wpn;
-			refType = 2;
-		};
-		6755C8C3101802C300A80195 = {
-			isa = PBXFileReference;
-			name = soar.dta;
-			path = ../../../bin/Resources/soar.dta;
-			refType = 2;
-		};
-		6755C8C4101802C300A80195 = {
-			isa = PBXFileReference;
-			name = sonic.plr;
-			path = ../../../bin/Resources/sonic.plr;
-			refType = 2;
-		};
-		6755C8C5101802C300A80195 = {
-			isa = PBXFileReference;
-			name = srb2.wad;
-			path = ../../../bin/Resources/srb2.wad;
-			refType = 2;
-		};
-		6755C8C6101802C300A80195 = {
-			isa = PBXFileReference;
-			name = tails.plr;
-			path = ../../../bin/Resources/tails.plr;
-			refType = 2;
-		};
-		6755C8C7101802C300A80195 = {
-			fileRef = 6755C8BE101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8C8101802C300A80195 = {
-			fileRef = 6755C8BF101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8C9101802C300A80195 = {
-			fileRef = 6755C8C0101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CA101802C300A80195 = {
-			fileRef = 6755C8C1101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CB101802C300A80195 = {
-			fileRef = 6755C8C2101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CC101802C300A80195 = {
-			fileRef = 6755C8C3101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CD101802C300A80195 = {
-			fileRef = 6755C8C4101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CE101802C300A80195 = {
-			fileRef = 6755C8C5101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8CF101802C300A80195 = {
-			fileRef = 6755C8C6101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D0101802C300A80195 = {
-			fileRef = 6755C8BE101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D1101802C300A80195 = {
-			fileRef = 6755C8BF101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D2101802C300A80195 = {
-			fileRef = 6755C8C0101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D3101802C300A80195 = {
-			fileRef = 6755C8C1101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D4101802C300A80195 = {
-			fileRef = 6755C8C2101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D5101802C300A80195 = {
-			fileRef = 6755C8C3101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D6101802C300A80195 = {
-			fileRef = 6755C8C4101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D7101802C300A80195 = {
-			fileRef = 6755C8C5101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		6755C8D8101802C300A80195 = {
-			fileRef = 6755C8C6101802C300A80195;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		677B5EC810180D4E00A80195 = {
-			fileRef = 84177758085A10D2000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		677B5EC910180D6600A80195 = {
-			children = (
-				84177758085A10D2000C01D8,
-			);
-			isa = PBXGroup;
-			name = r_opengl;
-			refType = 4;
-		};
-		677B5ECA10180D7100A80195 = {
-			children = (
-				84F202CA08A92AA0000C01D8,
-			);
-			isa = PBXGroup;
-			name = s_openal;
-			refType = 4;
-		};
-		67B2D0C91018779900A80195 = {
-			fileRef = 84177748085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		67B2D0CA1018779D00A80195 = {
-			fileRef = 84177748085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-//670
-//671
-//672
-//673
-//674
-//840
-//841
-//842
-//843
-//844
-		840CE6B009198AA7000C01D8 = {
-			buildActionMask = 2147483647;
-			dstPath = "";
-			dstSubfolderSpec = 10;
-			files = (
-				840CE6B309198ABB000C01D8,
-				840CE6B409198ABB000C01D8,
-				849BD32D0A7E471D000C01D8,
-			);
-			isa = PBXCopyFilesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		840CE6B309198ABB000C01D8 = {
-			fileRef = 84C4E04B08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		840CE6B409198ABB000C01D8 = {
-			fileRef = 84C4E04C08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		841776FE085A0C64000C01D8 = {
-			children = (
-				84C4E00D0862063C000C01D8,
-				84177705085A0CDB000C01D8,
-				84177706085A0D9D000C01D8,
-				84177708085A0DB5000C01D8,
-				84177709085A0DD1000C01D8,
-				84177712085A0EB5000C01D8,
-				8417770B085A0E17000C01D8,
-				8417770C085A0E40000C01D8,
-				8417770D085A0E4E000C01D8,
-				8417770E085A0E5B000C01D8,
-				8417770F085A0E66000C01D8,
-				84177710085A0E71000C01D8,
-				84177711085A0E77000C01D8,
-				841779E2085A138F000C01D8,
-				84F202C708A92A5D000C01D8,
-				84C4E03F0862096F000C01D8,
-				84C4E0420862098A000C01D8,
-				84C4E045086209D3000C01D8,
-				84C4E048086209FF000C01D8,
-				84C4E04C08620A46000C01D8,
-				84C4E04B08620A46000C01D8,
-				849BD31C0A7E45B3000C01D8,
-			);
-			isa = PBXGroup;
-			refType = 4;
-		};
-		84177700085A0C64000C01D8 = {
-			buildRules = (
-			);
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-			};
-			isa = PBXBuildStyle;
-			name = Development;
-		};
-		84177701085A0C64000C01D8 = {
-			buildRules = (
-			);
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-			};
-			isa = PBXBuildStyle;
-			name = Deployment;
-		};
-		84177702085A0C64000C01D8 = {
-			buildStyles = (
-				84177700085A0C64000C01D8,
-				84177701085A0C64000C01D8,
-			);
-			hasScannedForEncodings = 1;
-			isa = PBXProject;
-			mainGroup = 841776FE085A0C64000C01D8;
-			productRefGroup = 841779E2085A138F000C01D8;
-			projectDirPath = "";
-			targets = (
-				841779E0085A138F000C01D8,
-				841779E9085A13B1000C01D8,
-			);
-		};
-		84177705085A0CDB000C01D8 = {
-			children = (
-				849603A80A791C11000C01D8,
-				84177713085A0FCE000C01D8,
-				84177714085A0FCE000C01D8,
-				84177716085A0FCE000C01D8,
-				84177717085A0FCE000C01D8,
-				84177718085A0FCE000C01D8,
-				84177719085A0FCE000C01D8,
-				8417771A085A0FCE000C01D8,
-				8417771B085A0FCE000C01D8,
-				8417771C085A0FCE000C01D8,
-				8417771D085A0FCE000C01D8,
-				8417771E085A0FCE000C01D8,
-				8417771F085A0FCE000C01D8,
-				84177720085A0FCE000C01D8,
-				84177721085A0FCE000C01D8,
-				84177722085A0FCE000C01D8,
-				84177723085A0FCE000C01D8,
-				84177724085A0FF2000C01D8,
-				84177725085A0FF2000C01D8,
-				84177726085A0FF2000C01D8,
-				84177727085A0FF2000C01D8,
-				6755C7B11017FE2500A80195,
-			);
-			isa = PBXGroup;
-			name = D_SRB2;
-			path = "";
-			refType = 2;
-		};
-		84177706085A0D9D000C01D8 = {
-			children = (
-				8417772A085A100E000C01D8,
-				8417772B085A100E000C01D8,
-				8417772C085A100E000C01D8,
-			);
-			isa = PBXGroup;
-			name = F_Frame;
-			path = "";
-			refType = 2;
-		};
-		84177708085A0DB5000C01D8 = {
-			children = (
-				841779DA085A1347000C01D8,
-				841778C6085A1295000C01D8,
-				841778C4085A1295000C01D8,
-				841778C5085A1295000C01D8,
-				8417772D085A1029000C01D8,
-				8417772E085A1029000C01D8,
-				8417772F085A1029000C01D8,
-				84177730085A1029000C01D8,
-				84177731085A1029000C01D8,
-				841779D4085A1296000C01D8,
-				841779D5085A1296000C01D8,
-			);
-			isa = PBXGroup;
-			name = G_Game;
-			path = "";
-			refType = 2;
-		};
-		84177709085A0DD1000C01D8 = {
-			children = (
-				841778BE085A1295000C01D8,
-				841778BF085A1295000C01D8,
-				841778C2085A1295000C01D8,
-				841778C3085A1295000C01D8,
-				841778C0085A1295000C01D8,
-				841778C1085A1295000C01D8,
-				84177732085A1040000C01D8,
-				84177733085A1040000C01D8,
-				841779D2085A1296000C01D8,
-				841779D3085A1296000C01D8,
-				841779D8085A1296000C01D8,
-				8490D433085DF537000C01D8,
-			);
-			isa = PBXGroup;
-			name = H_Hud;
-			path = "";
-			refType = 2;
-		};
-		8417770B085A0E17000C01D8 = {
-			children = (
-				6755C8A41017FE8000A80195,
-				84177759085A10D2000C01D8,
-				841777A4085A1200000C01D8,
-				841777A5085A1200000C01D8,
-				841777A6085A1200000C01D8,
-				841777A8085A1200000C01D8,
-				841777A9085A1200000C01D8,
-				841777AA085A1200000C01D8,
-				841777AB085A1200000C01D8,
-				841777AC085A1200000C01D8,
-				841777AD085A1200000C01D8,
-				841777AE085A1200000C01D8,
-			);
-			isa = PBXGroup;
-			name = I_Interface;
-			path = "";
-			refType = 2;
-		};
-		8417770C085A0E40000C01D8 = {
-			children = (
-				8417775A085A10EB000C01D8,
-				8417775B085A10EB000C01D8,
-				8417775C085A10EB000C01D8,
-				8417775D085A10EB000C01D8,
-				8417775E085A10EB000C01D8,
-				8417775F085A10EB000C01D8,
-				6755C7AB1017FE2500A80195,
-				84177760085A10EB000C01D8,
-				84177761085A10EB000C01D8,
-				84177762085A10EB000C01D8,
-				84177763085A10EB000C01D8,
-				84177764085A10EB000C01D8,
-				84177765085A10EB000C01D8,
-				6755C7AC1017FE2500A80195,
-				6755C7AD1017FE2500A80195,
-				84177766085A10EB000C01D8,
-				84177767085A10EB000C01D8,
-				84177768085A10EB000C01D8,
-			);
-			isa = PBXGroup;
-			name = M_Misc;
-			path = "";
-			refType = 2;
-		};
-		8417770D085A0E4E000C01D8 = {
-			children = (
-				84177769085A1104000C01D8,
-				8417776A085A1104000C01D8,
-				8417776B085A1104000C01D8,
-				8417776C085A1104000C01D8,
-				8417776D085A1104000C01D8,
-				8417776E085A1104000C01D8,
-				8417776F085A1104000C01D8,
-				84177770085A1104000C01D8,
-				84177771085A1104000C01D8,
-				84177772085A1104000C01D8,
-				84177773085A1104000C01D8,
-				84177774085A1104000C01D8,
-				6755C7AE1017FE2500A80195,
-				6755C7AF1017FE2500A80195,
-				84177775085A1104000C01D8,
-				84177776085A1104000C01D8,
-				84177777085A1104000C01D8,
-				84177778085A1104000C01D8,
-				84177779085A1104000C01D8,
-				8417777A085A1104000C01D8,
-				8417777B085A1104000C01D8,
-				8417777C085A1104000C01D8,
-				8417777D085A1104000C01D8,
-				8417777E085A1104000C01D8,
-				8417777F085A1104000C01D8,
-				84177780085A1104000C01D8,
-			);
-			isa = PBXGroup;
-			name = P_Play;
-			path = "";
-			refType = 2;
-		};
-		8417770E085A0E5B000C01D8 = {
-			children = (
-				84177781085A111B000C01D8,
-				84177782085A111B000C01D8,
-				84177783085A111B000C01D8,
-				84177784085A111B000C01D8,
-				84177785085A111B000C01D8,
-				84177786085A111B000C01D8,
-				84177787085A111B000C01D8,
-				84177788085A111B000C01D8,
-				84177789085A111B000C01D8,
-				8417778A085A111B000C01D8,
-				8417778B085A111B000C01D8,
-				8417778C085A111B000C01D8,
-				8417778D085A111B000C01D8,
-				8417778E085A111B000C01D8,
-				8417778F085A111B000C01D8,
-				84177790085A111B000C01D8,
-				84177791085A111B000C01D8,
-				84177792085A111B000C01D8,
-				84177793085A111B000C01D8,
-				84177794085A111B000C01D8,
-				84177795085A111B000C01D8,
-				84177796085A111B000C01D8,
-				84177797085A111B000C01D8,
-				841777A2085A1197000C01D8,
-				841777A3085A1197000C01D8,
-				8490D436085DF57B000C01D8,
-				841779D7085A1296000C01D8,
-			);
-			isa = PBXGroup;
-			name = R_Rend;
-			path = "";
-			refType = 2;
-		};
-		8417770F085A0E66000C01D8 = {
-			children = (
-				84177798085A1138000C01D8,
-				84177799085A1138000C01D8,
-				8417779A085A1138000C01D8,
-				8417779B085A1138000C01D8,
-			);
-			isa = PBXGroup;
-			name = S_Sounds;
-			path = "";
-			refType = 2;
-		};
-		84177710085A0E71000C01D8 = {
-			children = (
-				8417779C085A114C000C01D8,
-				8417779D085A114C000C01D8,
-				8417779E085A116B000C01D8,
-				8417779F085A116B000C01D8,
-			);
-			isa = PBXGroup;
-			name = SDL_main;
-			path = "";
-			refType = 2;
-		};
-		84177711085A0E77000C01D8 = {
-			children = (
-				6755C7A91017FE2500A80195,
-				6755C7AA1017FE2500A80195,
-				841777AF085A1228000C01D8,
-				841777B0085A1228000C01D8,
-				841777A0085A117F000C01D8,
-				841777A1085A117F000C01D8,
-				841778BC085A122A000C01D8,
-				841778BD085A122A000C01D8,
-			);
-			isa = PBXGroup;
-			name = W_Wad;
-			path = "";
-			refType = 2;
-		};
-		84177712085A0EB5000C01D8 = {
-			children = (
-				677B5EC910180D6600A80195,
-				677B5ECA10180D7100A80195,
-				84177734085A106C000C01D8,
-				84177735085A106C000C01D8,
-				84177736085A106C000C01D8,
-				84177737085A106C000C01D8,
-				84177738085A106C000C01D8,
-				84177739085A106C000C01D8,
-				8417773A085A106C000C01D8,
-				8417773B085A106C000C01D8,
-				8417773C085A106C000C01D8,
-				8417773D085A106C000C01D8,
-				8417773E085A106C000C01D8,
-				8417773F085A106C000C01D8,
-				84177740085A106C000C01D8,
-				84177741085A106C000C01D8,
-				84177742085A106C000C01D8,
-				84177743085A106C000C01D8,
-				84177744085A106C000C01D8,
-				84177745085A106C000C01D8,
-				84177746085A106C000C01D8,
-				84177747085A106C000C01D8,
-			);
-			isa = PBXGroup;
-			name = Hw_Hardware;
-			path = "";
-			refType = 2;
-		};
-		84177713085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_clisrv.c;
-			path = ../../d_clisrv.c;
-			refType = 2;
-		};
-		84177714085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_clisrv.h;
-			path = ../../d_clisrv.h;
-			refType = 2;
-		};
-		84177716085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_event.h;
-			path = ../../d_event.h;
-			refType = 2;
-		};
-		84177717085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_main.c;
-			path = ../../d_main.c;
-			refType = 2;
-		};
-		84177718085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_main.h;
-			path = ../../d_main.h;
-			refType = 2;
-		};
-		84177719085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_net.c;
-			path = ../../d_net.c;
-			refType = 2;
-		};
-		8417771A085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_net.h;
-			path = ../../d_net.h;
-			refType = 2;
-		};
-		8417771B085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_netcmd.c;
-			path = ../../d_netcmd.c;
-			refType = 2;
-		};
-		8417771C085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_netcmd.h;
-			path = ../../d_netcmd.h;
-			refType = 2;
-		};
-		8417771D085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_netfil.c;
-			path = ../../d_netfil.c;
-			refType = 2;
-		};
-		8417771E085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_netfil.h;
-			path = ../../d_netfil.h;
-			refType = 2;
-		};
-		8417771F085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_player.h;
-			path = ../../d_player.h;
-			refType = 2;
-		};
-		84177720085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_think.h;
-			path = ../../d_think.h;
-			refType = 2;
-		};
-		84177721085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = d_ticcmd.h;
-			path = ../../d_ticcmd.h;
-			refType = 2;
-		};
-		84177722085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = dehacked.c;
-			path = ../../dehacked.c;
-			refType = 2;
-		};
-		84177723085A0FCE000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = dehacked.h;
-			path = ../../dehacked.h;
-			refType = 2;
-		};
-		84177724085A0FF2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = doomdata.h;
-			path = ../../doomdata.h;
-			refType = 2;
-		};
-		84177725085A0FF2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = doomdef.h;
-			path = ../../doomdef.h;
-			refType = 2;
-		};
-		84177726085A0FF2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = doomstat.h;
-			path = ../../doomstat.h;
-			refType = 2;
-		};
-		84177727085A0FF2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = doomtype.h;
-			path = ../../doomtype.h;
-			refType = 2;
-		};
-		8417772A085A100E000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = f_finale.c;
-			path = ../../f_finale.c;
-			refType = 2;
-		};
-		8417772B085A100E000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = f_finale.h;
-			path = ../../f_finale.h;
-			refType = 2;
-		};
-		8417772C085A100E000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = f_wipe.c;
-			path = ../../f_wipe.c;
-			refType = 2;
-		};
-		8417772D085A1029000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = g_game.c;
-			path = ../../g_game.c;
-			refType = 2;
-		};
-		8417772E085A1029000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = g_game.h;
-			path = ../../g_game.h;
-			refType = 2;
-		};
-		8417772F085A1029000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = g_input.c;
-			path = ../../g_input.c;
-			refType = 2;
-		};
-		84177730085A1029000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = g_input.h;
-			path = ../../g_input.h;
-			refType = 2;
-		};
-		84177731085A1029000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = g_state.h;
-			path = ../../g_state.h;
-			refType = 2;
-		};
-		84177732085A1040000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hu_stuff.c;
-			path = ../../hu_stuff.c;
-			refType = 2;
-		};
-		84177733085A1040000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hu_stuff.h;
-			path = ../../hu_stuff.h;
-			refType = 2;
-		};
-		84177734085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_bsp.c;
-			path = ../../hardware/hw_bsp.c;
-			refType = 2;
-		};
-		84177735085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_cache.c;
-			path = ../../hardware/hw_cache.c;
-			refType = 2;
-		};
-		84177736085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_data.h;
-			path = ../../hardware/hw_data.h;
-			refType = 2;
-		};
-		84177737085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_defs.h;
-			path = ../../hardware/hw_defs.h;
-			refType = 2;
-		};
-		84177738085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_dll.h;
-			path = ../../hardware/hw_dll.h;
-			refType = 2;
-		};
-		84177739085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_draw.c;
-			path = ../../hardware/hw_draw.c;
-			refType = 2;
-		};
-		8417773A085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_drv.h;
-			path = ../../hardware/hw_drv.h;
-			refType = 2;
-		};
-		8417773B085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_glide.h;
-			path = ../../hardware/hw_glide.h;
-			refType = 2;
-		};
-		8417773C085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_glob.h;
-			path = ../../hardware/hw_glob.h;
-			refType = 2;
-		};
-		8417773D085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_light.c;
-			path = ../../hardware/hw_light.c;
-			refType = 2;
-		};
-		8417773E085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_light.h;
-			path = ../../hardware/hw_light.h;
-			refType = 2;
-		};
-		8417773F085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_main.c;
-			path = ../../hardware/hw_main.c;
-			refType = 2;
-		};
-		84177740085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_main.h;
-			path = ../../hardware/hw_main.h;
-			refType = 2;
-		};
-		84177741085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_md2.c;
-			path = ../../hardware/hw_md2.c;
-			refType = 2;
-		};
-		84177742085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_md2.h;
-			path = ../../hardware/hw_md2.h;
-			refType = 2;
-		};
-		84177743085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw_trick.c;
-			path = ../../hardware/hw_trick.c;
-			refType = 2;
-		};
-		84177744085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw3dsdrv.h;
-			path = ../../hardware/hw3dsdrv.h;
-			refType = 2;
-		};
-		84177745085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw3sound.c;
-			path = ../../hardware/hw3sound.c;
-			refType = 2;
-		};
-		84177746085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hw3sound.h;
-			path = ../../hardware/hw3sound.h;
-			refType = 2;
-		};
-		84177747085A106C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hws_data.h;
-			path = ../../hardware/hws_data.h;
-			refType = 2;
-		};
-		84177748085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = dosstr.c;
-			path = ../dosstr.c;
-			refType = 2;
-		};
-		84177749085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = endtxt.c;
-			path = ../endtxt.c;
-			refType = 2;
-		};
-		8417774A085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = endtxt.h;
-			path = ../endtxt.h;
-			refType = 2;
-		};
-		8417774B085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = filesrch.c;
-			path = ../../filesrch.c;
-			refType = 2;
-		};
-		8417774C085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hwsym_sdl.c;
-			path = ../hwsym_sdl.c;
-			refType = 2;
-		};
-		8417774D085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = hwsym_sdl.h;
-			path = ../hwsym_sdl.h;
-			refType = 2;
-		};
-		8417774E085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_cdmus.c;
-			path = ../i_cdmus.c;
-			refType = 2;
-		};
-		8417774F085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_main.c;
-			path = ../i_main.c;
-			refType = 2;
-		};
-		84177750085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_net.c;
-			path = ../i_net.c;
-			refType = 2;
-		};
-		84177751085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_sound.c;
-			path = ../i_sound.c;
-			refType = 2;
-		};
-		84177752085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_system.c;
-			path = ../i_system.c;
-			refType = 2;
-		};
-		84177753085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_video.c;
-			path = ../i_video.c;
-			refType = 2;
-		};
-		84177754085A1097000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = IMG_xpm.c;
-			path = ../IMG_xpm.c;
-			refType = 2;
-		};
-		84177755085A10AA000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = ogl_sdl.c;
-			path = ../ogl_sdl.c;
-			refType = 2;
-		};
-		84177756085A10AA000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = ogl_sdl.h;
-			path = ../ogl_sdl.h;
-			refType = 2;
-		};
-		84177757085A10AA000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = SDL_icon.xpm;
-			path = ../SDL_icon.xpm;
-			refType = 2;
-		};
-		84177758085A10D2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_opengl.c;
-			path = ../../hardware/r_opengl/r_opengl.c;
-			refType = 2;
-		};
-		84177759085A10D2000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_opengl.h;
-			path = ../../hardware/r_opengl/r_opengl.h;
-			refType = 2;
-		};
-		8417775A085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_argv.c;
-			path = ../../m_argv.c;
-			refType = 2;
-		};
-		8417775B085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_argv.h;
-			path = ../../m_argv.h;
-			refType = 2;
-		};
-		8417775C085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_bbox.c;
-			path = ../../m_bbox.c;
-			refType = 2;
-		};
-		8417775D085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_bbox.h;
-			path = ../../m_bbox.h;
-			refType = 2;
-		};
-		8417775E085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_cheat.c;
-			path = ../../m_cheat.c;
-			refType = 2;
-		};
-		8417775F085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_cheat.h;
-			path = ../../m_cheat.h;
-			refType = 2;
-		};
-		84177760085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_fixed.c;
-			path = ../../m_fixed.c;
-			refType = 2;
-		};
-		84177761085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_fixed.h;
-			path = ../../m_fixed.h;
-			refType = 2;
-		};
-		84177762085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_menu.c;
-			path = ../../m_menu.c;
-			refType = 2;
-		};
-		84177763085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_menu.h;
-			path = ../../m_menu.h;
-			refType = 2;
-		};
-		84177764085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_misc.c;
-			path = ../../m_misc.c;
-			refType = 2;
-		};
-		84177765085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_misc.h;
-			path = ../../m_misc.h;
-			refType = 2;
-		};
-		84177766085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_random.c;
-			path = ../../m_random.c;
-			refType = 2;
-		};
-		84177767085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_random.h;
-			path = ../../m_random.h;
-			refType = 2;
-		};
-		84177768085A10EB000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = m_swap.h;
-			path = ../../m_swap.h;
-			refType = 2;
-		};
-		84177769085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_ceilng.c;
-			path = ../../p_ceilng.c;
-			refType = 2;
-		};
-		8417776A085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_enemy.c;
-			path = ../../p_enemy.c;
-			refType = 2;
-		};
-		8417776B085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_fab.c;
-			path = ../../p_fab.c;
-			refType = 2;
-		};
-		8417776C085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_floor.c;
-			path = ../../p_floor.c;
-			refType = 2;
-		};
-		8417776D085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_inter.c;
-			path = ../../p_inter.c;
-			refType = 2;
-		};
-		8417776E085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_lights.c;
-			path = ../../p_lights.c;
-			refType = 2;
-		};
-		8417776F085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_local.h;
-			path = ../../p_local.h;
-			refType = 2;
-		};
-		84177770085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_map.c;
-			path = ../../p_map.c;
-			refType = 2;
-		};
-		84177771085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_maputl.c;
-			path = ../../p_maputl.c;
-			refType = 2;
-		};
-		84177772085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_maputl.h;
-			path = ../../p_maputl.h;
-			refType = 2;
-		};
-		84177773085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_mobj.c;
-			path = ../../p_mobj.c;
-			refType = 2;
-		};
-		84177774085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_mobj.h;
-			path = ../../p_mobj.h;
-			refType = 2;
-		};
-		84177775085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_pspr.h;
-			path = ../../p_pspr.h;
-			refType = 2;
-		};
-		84177776085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_saveg.c;
-			path = ../../p_saveg.c;
-			refType = 2;
-		};
-		84177777085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_saveg.h;
-			path = ../../p_saveg.h;
-			refType = 2;
-		};
-		84177778085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_setup.c;
-			path = ../../p_setup.c;
-			refType = 2;
-		};
-		84177779085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_setup.h;
-			path = ../../p_setup.h;
-			refType = 2;
-		};
-		8417777A085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_sight.c;
-			path = ../../p_sight.c;
-			refType = 2;
-		};
-		8417777B085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_spec.c;
-			path = ../../p_spec.c;
-			refType = 2;
-		};
-		8417777C085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_spec.h;
-			path = ../../p_spec.h;
-			refType = 2;
-		};
-		8417777D085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_telept.c;
-			path = ../../p_telept.c;
-			refType = 2;
-		};
-		8417777E085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_tick.c;
-			path = ../../p_tick.c;
-			refType = 2;
-		};
-		8417777F085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_tick.h;
-			path = ../../p_tick.h;
-			refType = 2;
-		};
-		84177780085A1104000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = p_user.c;
-			path = ../../p_user.c;
-			refType = 2;
-		};
-		84177781085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_bsp.c;
-			path = ../../r_bsp.c;
-			refType = 2;
-		};
-		84177782085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_bsp.h;
-			path = ../../r_bsp.h;
-			refType = 2;
-		};
-		84177783085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_data.c;
-			path = ../../r_data.c;
-			refType = 2;
-		};
-		84177784085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_data.h;
-			path = ../../r_data.h;
-			refType = 2;
-		};
-		84177785085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_defs.h;
-			path = ../../r_defs.h;
-			refType = 2;
-		};
-		84177786085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_draw.c;
-			path = ../../r_draw.c;
-			refType = 2;
-		};
-		84177787085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_draw.h;
-			path = ../../r_draw.h;
-			refType = 2;
-		};
-		84177788085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_draw8.c;
-			path = ../../r_draw8.c;
-			refType = 2;
-		};
-		84177789085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_draw16.c;
-			path = ../../r_draw16.c;
-			refType = 2;
-		};
-		8417778A085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_local.h;
-			path = ../../r_local.h;
-			refType = 2;
-		};
-		8417778B085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_main.c;
-			path = ../../r_main.c;
-			refType = 2;
-		};
-		8417778C085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_main.h;
-			path = ../../r_main.h;
-			refType = 2;
-		};
-		8417778D085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_plane.c;
-			path = ../../r_plane.c;
-			refType = 2;
-		};
-		8417778E085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_plane.h;
-			path = ../../r_plane.h;
-			refType = 2;
-		};
-		8417778F085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_segs.c;
-			path = ../../r_segs.c;
-			refType = 2;
-		};
-		84177790085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_segs.h;
-			path = ../../r_segs.h;
-			refType = 2;
-		};
-		84177791085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_sky.c;
-			path = ../../r_sky.c;
-			refType = 2;
-		};
-		84177792085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_sky.h;
-			path = ../../r_sky.h;
-			refType = 2;
-		};
-		84177793085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_splats.c;
-			path = ../../r_splats.c;
-			refType = 2;
-		};
-		84177794085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_splats.h;
-			path = ../../r_splats.h;
-			refType = 2;
-		};
-		84177795085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_state.h;
-			path = ../../r_state.h;
-			refType = 2;
-		};
-		84177796085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_things.c;
-			path = ../../r_things.c;
-			refType = 2;
-		};
-		84177797085A111B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = r_things.h;
-			path = ../../r_things.h;
-			refType = 2;
-		};
-		84177798085A1138000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = s_sound.c;
-			path = ../../s_sound.c;
-			refType = 2;
-		};
-		84177799085A1138000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = s_sound.h;
-			path = ../../s_sound.h;
-			refType = 2;
-		};
-		8417779A085A1138000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = sounds.c;
-			path = ../../sounds.c;
-			refType = 2;
-		};
-		8417779B085A1138000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = sounds.h;
-			path = ../../sounds.h;
-			refType = 2;
-		};
-		8417779C085A114C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = mac_alert.c;
-			refType = 2;
-		};
-		8417779D085A114C000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = mac_alert.h;
-			refType = 2;
-		};
-		8417779E085A116B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = SDL_macosx_main.h;
-			path = ../SDL_main/SDL_macosx_main.h;
-			refType = 2;
-		};
-		8417779F085A116B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = SDL_macosx_main.m;
-			path = ../SDL_main/SDL_macosx_main.m;
-			refType = 2;
-		};
-		841777A0085A117F000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = w_wad.c;
-			path = ../../w_wad.c;
-			refType = 2;
-		};
-		841777A1085A117F000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = w_wad.h;
-			path = ../../w_wad.h;
-			refType = 2;
-		};
-		841777A2085A1197000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = screen.c;
-			path = ../../screen.c;
-			refType = 2;
-		};
-		841777A3085A1197000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = screen.h;
-			path = ../../screen.h;
-			refType = 2;
-		};
-		841777A4085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = filesrch.h;
-			path = ../../filesrch.h;
-			refType = 2;
-		};
-		841777A5085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_joy.h;
-			path = ../../i_joy.h;
-			refType = 2;
-		};
-		841777A6085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_net.h;
-			path = ../../i_net.h;
-			refType = 2;
-		};
-		841777A8085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_sound.h;
-			path = ../../i_sound.h;
-			refType = 2;
-		};
-		841777A9085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_system.h;
-			path = ../../i_system.h;
-			refType = 2;
-		};
-		841777AA085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_tcp.c;
-			path = ../../i_tcp.c;
-			refType = 2;
-		};
-		841777AB085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_tcp.h;
-			path = ../../i_tcp.h;
-			refType = 2;
-		};
-		841777AC085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = i_video.h;
-			path = ../../i_video.h;
-			refType = 2;
-		};
-		841777AD085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = mserv.c;
-			path = ../../mserv.c;
-			refType = 2;
-		};
-		841777AE085A1200000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = mserv.h;
-			path = ../../mserv.h;
-			refType = 2;
-		};
-		841777AF085A1228000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = md5.c;
-			path = ../../md5.c;
-			refType = 2;
-		};
-		841777B0085A1228000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = md5.h;
-			path = ../../md5.h;
-			refType = 2;
-		};
-		841778BC085A122A000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = z_zone.c;
-			path = ../../z_zone.c;
-			refType = 2;
-		};
-		841778BD085A122A000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = z_zone.h;
-			path = ../../z_zone.h;
-			refType = 2;
-		};
-		841778BE085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = am_map.c;
-			path = ../../am_map.c;
-			refType = 2;
-		};
-		841778BF085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = am_map.h;
-			path = ../../am_map.h;
-			refType = 2;
-		};
-		841778C0085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = command.c;
-			path = ../../command.c;
-			refType = 2;
-		};
-		841778C1085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = command.h;
-			path = ../../command.h;
-			refType = 2;
-		};
-		841778C2085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = console.c;
-			path = ../../console.c;
-			refType = 2;
-		};
-		841778C3085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = console.h;
-			path = ../../console.h;
-			refType = 2;
-		};
-		841778C4085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = info.c;
-			path = ../../info.c;
-			refType = 2;
-		};
-		841778C5085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = info.h;
-			path = ../../info.h;
-			refType = 2;
-		};
-		841778C6085A1295000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = keys.h;
-			path = ../../keys.h;
-			refType = 2;
-		};
-		841779D2085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = st_stuff.c;
-			path = ../../st_stuff.c;
-			refType = 2;
-		};
-		841779D3085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = st_stuff.h;
-			path = ../../st_stuff.h;
-			refType = 2;
-		};
-		841779D4085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = tables.c;
-			path = ../../tables.c;
-			refType = 2;
-		};
-		841779D5085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = tables.h;
-			path = ../../tables.h;
-			refType = 2;
-		};
-		841779D7085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = v_video.h;
-			path = ../../v_video.h;
-			refType = 2;
-		};
-		841779D8085A1296000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = y_inter.c;
-			path = ../../y_inter.c;
-			refType = 2;
-		};
-		841779DA085A1347000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = byteptr.h;
-			path = ../../byteptr.h;
-			refType = 2;
-		};
-		841779DC085A138F000C01D8 = {
-			buildActionMask = 2147483647;
-			files = (
-				6755C8C7101802C300A80195,
-				6755C8C8101802C300A80195,
-				6755C8C9101802C300A80195,
-				6755C8CA101802C300A80195,
-				6755C8CB101802C300A80195,
-				6755C8CC101802C300A80195,
-				6755C8CD101802C300A80195,
-				6755C8CE101802C300A80195,
-				6755C8CF101802C300A80195,
-			);
-			isa = PBXResourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		841779DD085A138F000C01D8 = {
-			buildActionMask = 2147483647;
-			files = (
-				84177A2A085A18A8000C01D8,
-				84177A2E085A18D2000C01D8,
-				84177A30085A18D3000C01D8,
-				84177A32085A18D4000C01D8,
-				84177A34085A18D5000C01D8,
-				84177A39085A18D8000C01D8,
-				84177A3F085A18DC000C01D8,
-				84177A41085A18E0000C01D8,
-				84177A43085A18E1000C01D8,
-				84177A46085A18E8000C01D8,
-				84177A4A085A18EA000C01D8,
-				84177A4E085A18EC000C01D8,
-				84177A50085A18F2000C01D8,
-				84177A52085A193F000C01D8,
-				84177A53085A1940000C01D8,
-				84177A54085A1942000C01D8,
-				84177A55085A1943000C01D8,
-				84177A56085A195A000C01D8,
-				84177A57085A195B000C01D8,
-				84177A58085A1968000C01D8,
-				84177A59085A1969000C01D8,
-				84177A5A085A196B000C01D8,
-				84177A5B085A197A000C01D8,
-				84177A5C085A197C000C01D8,
-				84177A5D085A197D000C01D8,
-				84177A5E085A197E000C01D8,
-				84177A5F085A1980000C01D8,
-				84177A61085A1985000C01D8,
-				84177A62085A1986000C01D8,
-				84177A63085A1988000C01D8,
-				84177A64085A1989000C01D8,
-				84177A65085A198A000C01D8,
-				84177A66085A198A000C01D8,
-				84177A67085A198B000C01D8,
-				84177A68085A198C000C01D8,
-				84177A69085A198E000C01D8,
-				84177A6B085A1994000C01D8,
-				84177A6C085A1995000C01D8,
-				84177A6D085A199D000C01D8,
-				84177A6E085A19A0000C01D8,
-				84177A6F085A19A1000C01D8,
-				84177A70085A19A2000C01D8,
-				84177A71085A19A4000C01D8,
-				84177A72085A19A5000C01D8,
-				84177A73085A19A6000C01D8,
-				84177A74085A19A7000C01D8,
-				84177A75085A19AC000C01D8,
-				84177A76085A19AD000C01D8,
-				84177A77085A19AE000C01D8,
-				84177A78085A19AE000C01D8,
-				84177A79085A19AF000C01D8,
-				84177A7A085A19B0000C01D8,
-				84177A7B085A19B3000C01D8,
-				84177A7C085A19B4000C01D8,
-				84177A7D085A19B5000C01D8,
-				84177A7E085A19B7000C01D8,
-				84177A7F085A19B8000C01D8,
-				84177A80085A19B9000C01D8,
-				84177A81085A19BA000C01D8,
-				84177A82085A19BB000C01D8,
-				84177A83085A19BB000C01D8,
-				84177A84085A19BC000C01D8,
-				84177A85085A19C1000C01D8,
-				84177A86085A19C2000C01D8,
-				84177A87085A19C3000C01D8,
-				84177A88085A19C6000C01D8,
-				84177A89085A19C7000C01D8,
-				84177A8A085A19C9000C01D8,
-				84177A8B085A19CC000C01D8,
-				84177A8C085A19CD000C01D8,
-				84177A8D085A19CF000C01D8,
-				84177A8E085A19D0000C01D8,
-				84177A90085A19D8000C01D8,
-				84177A91085A19D9000C01D8,
-				84177A92085A19DD000C01D8,
-				84177A93085A19DF000C01D8,
-				84177A94085A19E1000C01D8,
-				84177A95085A19E3000C01D8,
-				84177A96085A19E6000C01D8,
-				8490D438085DF57B000C01D8,
-				849603AA0A791C11000C01D8,
-				6755C7B21017FE2500A80195,
-				6755C7B31017FE2500A80195,
-				6755C7B51017FE2500A80195,
-				6755C7B71017FE2500A80195,
-				6755C7B81017FE2500A80195,
-				6755C84B1017FE4500A80195,
-				6755C8651017FE4500A80195,
-				677B5EC810180D4E00A80195,
-				67B2D0C91018779900A80195,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		841779DE085A138F000C01D8 = {
-			buildActionMask = 2147483647;
-			files = (
-				84C4E0410862096F000C01D8,
-				84C4E0440862098A000C01D8,
-				84C4E047086209D3000C01D8,
-				84C4E04A086209FF000C01D8,
-				84C4E04F08620A46000C01D8,
-				84C4E05008620A46000C01D8,
-				849BD31E0A7E45B3000C01D8,
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		841779E0085A138F000C01D8 = {
-			buildPhases = (
-				841779DC085A138F000C01D8,
-				841779DD085A138F000C01D8,
-				841779DE085A138F000C01D8,
-			);
-			buildSettings = {
-				DEBUGGING_SYMBOLS = NO;
-				FRAMEWORK_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks\"";
-				HEADER_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_mixer.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/OpenAL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/libpng.framework/Headers\"";
-				INSTALL_PATH = "$(HOME)/Applications";
-				JAVA_COMPILER_DEBUGGING_SYMBOLS = NO;
-				OPTIMIZATION_CFLAGS = "-O2";
-				OTHER_CFLAGS = "-DMAC_ALERT -DUNIXCOMMON -DSDLMAIN -DHAVE_MIXER -DHAVE_PNG -D_BIG_ENDIAN -DSTDC_HEADERS -DSDL -Wall -Winline -fno-strict-aliasing";
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = Srb2;
-				SECTORDER_FLAGS = "";
-				USE_GCC3_PFE_SUPPORT = NO;
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-long-double";
-				WRAPPER_EXTENSION = app;
-			};
-			dependencies = (
-			);
-			isa = PBXApplicationTarget;
-			name = Srb2;
-			productInstallPath = "$(HOME)/Applications";
-			productName = Srb2;
-			productReference = 841779E1085A138F000C01D8;
-			productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-<plist version=\"1.0\">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>Srb2</string>
-	<key>CFBundleGetInfoString</key>
-	<string></string>
-	<key>CFBundleIconFile</key>
-	<string>Srb2mac</string>
-	<key>CFBundleIdentifier</key>
-	<string></string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>Sonic Robo Blast 2</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.09</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>1.09</string>
-	<key>NSMainNibFile</key>
-	<string>SDL_Main.nib</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>
-";
-		};
-		841779E1085A138F000C01D8 = {
-			isa = PBXApplicationReference;
-			path = Srb2.app;
-			refType = 3;
-		};
-		841779E2085A138F000C01D8 = {
-			children = (
-				841779E1085A138F000C01D8,
-				841779EA085A13B1000C01D8,
-			);
-			isa = PBXGroup;
-			name = Products;
-			refType = 4;
-		};
-		841779E6085A13B1000C01D8 = {
-			buildActionMask = 2147483647;
-			files = (
-				84177A98085A1A0B000C01D8,
-				84177A99085A1A0E000C01D8,
-				84177A9A085A1A0F000C01D8,
-				84177A9B085A1A11000C01D8,
-				84177A9C085A1A12000C01D8,
-				84177A9D085A1A14000C01D8,
-				84177A9E085A1A16000C01D8,
-				84177A9F085A1A1E000C01D8,
-				84177AA0085A1A1F000C01D8,
-				84177AA1085A1A24000C01D8,
-				84177AA2085A1A25000C01D8,
-				84177AA3085A1A27000C01D8,
-				84177AA4085A1A28000C01D8,
-				84177AA5085A1A2B000C01D8,
-				84177AA6085A1A2C000C01D8,
-				84177AA7085A1A2D000C01D8,
-				84177AA8085A1A2F000C01D8,
-				84177AA9085A1A30000C01D8,
-				84177AAA085A1A31000C01D8,
-				84177AB4085A1A5E000C01D8,
-				84177AB5085A1A60000C01D8,
-				84177AB8085A1A65000C01D8,
-				84177AB9085A1A65000C01D8,
-				84177ABA085A1A66000C01D8,
-				84177ABB085A1A67000C01D8,
-				84177ABC085A1A67000C01D8,
-				84177ABD085A1A68000C01D8,
-				84177AC1085A1A70000C01D8,
-				84177AC2085A1A72000C01D8,
-				84177AC3085A1A77000C01D8,
-				84177AC4085A1A78000C01D8,
-				84177AC5085A1A7A000C01D8,
-				84177AC6085A1A7B000C01D8,
-				84177AC7085A1A7C000C01D8,
-				84177AC8085A1A7D000C01D8,
-				84177AC9085A1A7F000C01D8,
-				84177ACA085A1A87000C01D8,
-				84177ACB085A1A88000C01D8,
-				84177ACC085A1A88000C01D8,
-				84177ACD085A1A89000C01D8,
-				84177ACE085A1A8A000C01D8,
-				84177ACF085A1A8B000C01D8,
-				84177AD0085A1A8C000C01D8,
-				84177AD1085A1A8D000C01D8,
-				84177AD2085A1A90000C01D8,
-				84177AD4085A1A92000C01D8,
-				84177AD5085A1A93000C01D8,
-				84177AD6085A1A94000C01D8,
-				84177AD7085A1A97000C01D8,
-				84177AD8085A1A97000C01D8,
-				84177AD9085A1A99000C01D8,
-				84177ADA085A1A9F000C01D8,
-				84177ADB085A1AA0000C01D8,
-				84177ADC085A1AA2000C01D8,
-				84177ADF085A1AA4000C01D8,
-				84177AE0085A1AA6000C01D8,
-				84177AE1085A1AA7000C01D8,
-				84177AE2085A1AA8000C01D8,
-				84177AE3085A1AA9000C01D8,
-				84177AE4085A1AAA000C01D8,
-				84177AE5085A1AAE000C01D8,
-				84177AE7085A1AB5000C01D8,
-				84177AE8085A1AB6000C01D8,
-				84177AEB085A1ABD000C01D8,
-				84177AEC085A1ABF000C01D8,
-				84177AED085A1ABF000C01D8,
-				8490D432085DF3D6000C01D8,
-				8490D437085DF57B000C01D8,
-				8490D43C085E0518000C01D8,
-				8490D43D085E05F6000C01D8,
-				8490D43E085E05F7000C01D8,
-				8490D43F085E05F8000C01D8,
-				8490D440085E05FA000C01D8,
-				8490D441085E05FB000C01D8,
-				8490D442085E05FC000C01D8,
-				8490D443085E05FE000C01D8,
-				8490D444085E05FF000C01D8,
-				8490D445085E0606000C01D8,
-				8490D446085E060A000C01D8,
-				8490D447085E060B000C01D8,
-				8490D448085E067E000C01D8,
-				849603A90A791C11000C01D8,
-				6755C7BB1017FE2500A80195,
-				6755C7BC1017FE2500A80195,
-				6755C7BD1017FE2500A80195,
-				6755C7BE1017FE2500A80195,
-				6755C7BF1017FE2500A80195,
-				6755C7C01017FE2500A80195,
-				6755C7C11017FE2500A80195,
-				6755C8861017FE4500A80195,
-				6755C8871017FE4500A80195,
-				6755C8A01017FE4500A80195,
-				67B2D0CA1018779D00A80195,
-			);
-			isa = PBXSourcesBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		841779E7085A13B1000C01D8 = {
-			buildActionMask = 2147483647;
-			files = (
-				84C4E0400862096F000C01D8,
-				84C4E0430862098A000C01D8,
-				84C4E046086209D3000C01D8,
-				84C4E049086209FF000C01D8,
-				84C4E04E08620A46000C01D8,
-				8494DFE80886EA0D000C01D8,
-				849BD31D0A7E45B3000C01D8,
-			);
-			isa = PBXFrameworksBuildPhase;
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-		841779E9085A13B1000C01D8 = {
-			buildPhases = (
-				840CE6B009198AA7000C01D8,
-				6726EB5E10190F860074DCBA,
-				6726EB5F10190FFC0074DCBA,
-				841779E6085A13B1000C01D8,
-				841779E7085A13B1000C01D8,
-			);
-			buildSettings = {
-				FRAMEWORK_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks\"";
-				HEADER_SEARCH_PATHS = "\"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/SDL_mixer.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/OpenAL.framework/Headers\" \"$(LOCAL_LIBRARY_DIR)/Frameworks/libpng.framework/Headers\"";
-				INSTALL_PATH = "$(HOME)/Applications";
-				OPTIMIZATION_CFLAGS = "-O0";
-				OTHER_CFLAGS = "-DMAC_ALERT -DUNIXCOMMON  -DSDLMAIN -DHAVE_MIXER -DHAVE_PNG -D_BIG_ENDIAN -DSTDC_HEADERS -DSDL -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wsign-compare -Waggregate-return -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -fno-exceptions -D_DEBUG";
-				OTHER_REZFLAGS = "";
-				PREBINDING = NO;
-				PRODUCT_NAME = Srb2Debug;
-				SECTORDER_FLAGS = "";
-				USE_GCC3_PFE_SUPPORT = NO;
-				WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-long-double";
-				WRAPPER_EXTENSION = app;
-			};
-			dependencies = (
-			);
-			isa = PBXApplicationTarget;
-			name = Srb2Debug;
-			productInstallPath = "$(HOME)/Applications";
-			productName = Srb2Debug;
-			productReference = 841779EA085A13B1000C01D8;
-			productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-<plist version=\"1.0\">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>Srb2Debug</string>
-	<key>CFBundleGetInfoString</key>
-	<string></string>
-	<key>CFBundleIconFile</key>
-	<string>srb2mac</string>
-	<key>CFBundleIdentifier</key>
-	<string></string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>Sonic Robo Blast 2</string>
-	<key>CFBundlePackageType</key>
-	<string>APPL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.09</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>1.09 Debug</string>
-	<key>NSMainNibFile</key>
-	<string>SDL_Main.nib</string>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
-</dict>
-</plist>
-";
-		};
-		841779EA085A13B1000C01D8 = {
-			isa = PBXApplicationReference;
-			path = Srb2Debug.app;
-			refType = 3;
-		};
-		84177A2A085A18A8000C01D8 = {
-			fileRef = 84177713085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A2E085A18D2000C01D8 = {
-			fileRef = 84177717085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A30085A18D3000C01D8 = {
-			fileRef = 84177719085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A32085A18D4000C01D8 = {
-			fileRef = 8417771B085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A34085A18D5000C01D8 = {
-			fileRef = 8417771D085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A39085A18D8000C01D8 = {
-			fileRef = 84177722085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A41085A18E0000C01D8 = {
-			fileRef = 8417772A085A100E000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A43085A18E1000C01D8 = {
-			fileRef = 8417772C085A100E000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A46085A18E8000C01D8 = {
-			fileRef = 841778C4085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A4A085A18EA000C01D8 = {
-			fileRef = 8417772D085A1029000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A4E085A18EC000C01D8 = {
-			fileRef = 841779D4085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A50085A18F2000C01D8 = {
-			fileRef = 8417772F085A1029000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A52085A193F000C01D8 = {
-			fileRef = 841778C2085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A53085A1940000C01D8 = {
-			fileRef = 841778C0085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A54085A1942000C01D8 = {
-			fileRef = 841778BE085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A55085A1943000C01D8 = {
-			fileRef = 84177732085A1040000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A56085A195A000C01D8 = {
-			fileRef = 841779D2085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A57085A195B000C01D8 = {
-			fileRef = 841779D8085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A58085A1968000C01D8 = {
-			fileRef = 84177734085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A59085A1969000C01D8 = {
-			fileRef = 84177735085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5A085A196B000C01D8 = {
-			fileRef = 84177739085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5B085A197A000C01D8 = {
-			fileRef = 8417773D085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5C085A197C000C01D8 = {
-			fileRef = 8417773F085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5D085A197D000C01D8 = {
-			fileRef = 84177741085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5E085A197E000C01D8 = {
-			fileRef = 84177743085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A5F085A1980000C01D8 = {
-			fileRef = 84177745085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A61085A1985000C01D8 = {
-			fileRef = 84177749085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A62085A1986000C01D8 = {
-			fileRef = 8417774B085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A63085A1988000C01D8 = {
-			fileRef = 8417774E085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A64085A1989000C01D8 = {
-			fileRef = 8417774F085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A65085A198A000C01D8 = {
-			fileRef = 84177750085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A66085A198A000C01D8 = {
-			fileRef = 84177751085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A67085A198B000C01D8 = {
-			fileRef = 84177752085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A68085A198C000C01D8 = {
-			fileRef = 84177753085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A69085A198E000C01D8 = {
-			fileRef = 84177755085A10AA000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A6B085A1994000C01D8 = {
-			fileRef = 841777AA085A1200000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A6C085A1995000C01D8 = {
-			fileRef = 841777AD085A1200000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A6D085A199D000C01D8 = {
-			fileRef = 8417774C085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A6E085A19A0000C01D8 = {
-			fileRef = 8417775A085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A6F085A19A1000C01D8 = {
-			fileRef = 8417775C085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A70085A19A2000C01D8 = {
-			fileRef = 8417775E085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A71085A19A4000C01D8 = {
-			fileRef = 84177760085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A72085A19A5000C01D8 = {
-			fileRef = 84177762085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A73085A19A6000C01D8 = {
-			fileRef = 84177764085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A74085A19A7000C01D8 = {
-			fileRef = 84177766085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A75085A19AC000C01D8 = {
-			fileRef = 84177769085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A76085A19AD000C01D8 = {
-			fileRef = 8417776A085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A77085A19AE000C01D8 = {
-			fileRef = 8417776B085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A78085A19AE000C01D8 = {
-			fileRef = 8417776C085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A79085A19AF000C01D8 = {
-			fileRef = 8417776D085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7A085A19B0000C01D8 = {
-			fileRef = 8417776E085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7B085A19B3000C01D8 = {
-			fileRef = 84177770085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7C085A19B4000C01D8 = {
-			fileRef = 84177771085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7D085A19B5000C01D8 = {
-			fileRef = 84177773085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7E085A19B7000C01D8 = {
-			fileRef = 84177776085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A7F085A19B8000C01D8 = {
-			fileRef = 84177778085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A80085A19B9000C01D8 = {
-			fileRef = 8417777A085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A81085A19BA000C01D8 = {
-			fileRef = 8417777B085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A82085A19BB000C01D8 = {
-			fileRef = 8417777D085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A83085A19BB000C01D8 = {
-			fileRef = 8417777E085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A84085A19BC000C01D8 = {
-			fileRef = 84177780085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A85085A19C1000C01D8 = {
-			fileRef = 84177781085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A86085A19C2000C01D8 = {
-			fileRef = 84177783085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A87085A19C3000C01D8 = {
-			fileRef = 84177786085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A88085A19C6000C01D8 = {
-			fileRef = 8417778B085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A89085A19C7000C01D8 = {
-			fileRef = 8417778D085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A8A085A19C9000C01D8 = {
-			fileRef = 8417778F085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A8B085A19CC000C01D8 = {
-			fileRef = 84177791085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A8C085A19CD000C01D8 = {
-			fileRef = 84177793085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A8D085A19CF000C01D8 = {
-			fileRef = 84177796085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A8E085A19D0000C01D8 = {
-			fileRef = 841777A2085A1197000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A90085A19D8000C01D8 = {
-			fileRef = 84177798085A1138000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A91085A19D9000C01D8 = {
-			fileRef = 8417779A085A1138000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A92085A19DD000C01D8 = {
-			fileRef = 8417779C085A114C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A93085A19DF000C01D8 = {
-			fileRef = 8417779F085A116B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A94085A19E1000C01D8 = {
-			fileRef = 841777A0085A117F000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A95085A19E3000C01D8 = {
-			fileRef = 841777AF085A1228000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A96085A19E6000C01D8 = {
-			fileRef = 841778BC085A122A000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A98085A1A0B000C01D8 = {
-			fileRef = 84177713085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A99085A1A0E000C01D8 = {
-			fileRef = 84177717085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A9A085A1A0F000C01D8 = {
-			fileRef = 84177719085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A9B085A1A11000C01D8 = {
-			fileRef = 8417771B085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A9C085A1A12000C01D8 = {
-			fileRef = 8417771D085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A9D085A1A14000C01D8 = {
-			fileRef = 84177722085A0FCE000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177A9F085A1A1E000C01D8 = {
-			fileRef = 8417772A085A100E000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA0085A1A1F000C01D8 = {
-			fileRef = 8417772C085A100E000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA1085A1A24000C01D8 = {
-			fileRef = 841778C4085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA2085A1A25000C01D8 = {
-			fileRef = 8417772D085A1029000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA3085A1A27000C01D8 = {
-			fileRef = 8417772F085A1029000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA4085A1A28000C01D8 = {
-			fileRef = 841779D4085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA5085A1A2B000C01D8 = {
-			fileRef = 841778BE085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA6085A1A2C000C01D8 = {
-			fileRef = 841778C2085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA7085A1A2D000C01D8 = {
-			fileRef = 841778C0085A1295000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA8085A1A2F000C01D8 = {
-			fileRef = 84177732085A1040000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AA9085A1A30000C01D8 = {
-			fileRef = 841779D2085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AAA085A1A31000C01D8 = {
-			fileRef = 841779D8085A1296000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AB4085A1A5E000C01D8 = {
-			fileRef = 84177749085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AB5085A1A60000C01D8 = {
-			fileRef = 8417774B085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AB8085A1A65000C01D8 = {
-			fileRef = 8417774E085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AB9085A1A65000C01D8 = {
-			fileRef = 8417774F085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ABA085A1A66000C01D8 = {
-			fileRef = 84177750085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ABB085A1A67000C01D8 = {
-			fileRef = 84177751085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ABC085A1A67000C01D8 = {
-			fileRef = 84177752085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ABD085A1A68000C01D8 = {
-			fileRef = 84177753085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC1085A1A70000C01D8 = {
-			fileRef = 841777AA085A1200000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC2085A1A72000C01D8 = {
-			fileRef = 841777AD085A1200000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC3085A1A77000C01D8 = {
-			fileRef = 8417775A085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC4085A1A78000C01D8 = {
-			fileRef = 8417775C085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC5085A1A7A000C01D8 = {
-			fileRef = 8417775E085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC6085A1A7B000C01D8 = {
-			fileRef = 84177760085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC7085A1A7C000C01D8 = {
-			fileRef = 84177762085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC8085A1A7D000C01D8 = {
-			fileRef = 84177764085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AC9085A1A7F000C01D8 = {
-			fileRef = 84177766085A10EB000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACA085A1A87000C01D8 = {
-			fileRef = 84177769085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACB085A1A88000C01D8 = {
-			fileRef = 8417776A085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACC085A1A88000C01D8 = {
-			fileRef = 8417776B085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACD085A1A89000C01D8 = {
-			fileRef = 8417776C085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACE085A1A8A000C01D8 = {
-			fileRef = 8417776D085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ACF085A1A8B000C01D8 = {
-			fileRef = 8417776E085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD0085A1A8C000C01D8 = {
-			fileRef = 84177770085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD1085A1A8D000C01D8 = {
-			fileRef = 84177771085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD2085A1A90000C01D8 = {
-			fileRef = 84177773085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD4085A1A92000C01D8 = {
-			fileRef = 84177778085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD5085A1A93000C01D8 = {
-			fileRef = 8417777A085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD6085A1A94000C01D8 = {
-			fileRef = 8417777B085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD7085A1A97000C01D8 = {
-			fileRef = 8417777D085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD8085A1A97000C01D8 = {
-			fileRef = 8417777E085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AD9085A1A99000C01D8 = {
-			fileRef = 84177780085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ADA085A1A9F000C01D8 = {
-			fileRef = 84177781085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ADB085A1AA0000C01D8 = {
-			fileRef = 84177783085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ADC085A1AA2000C01D8 = {
-			fileRef = 84177786085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177ADF085A1AA4000C01D8 = {
-			fileRef = 8417778B085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE0085A1AA6000C01D8 = {
-			fileRef = 8417778D085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE1085A1AA7000C01D8 = {
-			fileRef = 8417778F085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE2085A1AA8000C01D8 = {
-			fileRef = 84177791085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE3085A1AA9000C01D8 = {
-			fileRef = 84177793085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE4085A1AAA000C01D8 = {
-			fileRef = 84177796085A111B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE5085A1AAE000C01D8 = {
-			fileRef = 841777A2085A1197000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE7085A1AB5000C01D8 = {
-			fileRef = 84177798085A1138000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AE8085A1AB6000C01D8 = {
-			fileRef = 8417779A085A1138000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AEB085A1ABD000C01D8 = {
-			fileRef = 841777AF085A1228000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AEC085A1ABF000C01D8 = {
-			fileRef = 841777A0085A117F000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84177AED085A1ABF000C01D8 = {
-			fileRef = 841778BC085A122A000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D432085DF3D6000C01D8 = {
-			fileRef = 84177776085A1104000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D433085DF537000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = y_inter.h;
-			path = ../../y_inter.h;
-			refType = 2;
-		};
-		8490D436085DF57B000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = v_video.c;
-			path = ../../v_video.c;
-			refType = 2;
-		};
-		8490D437085DF57B000C01D8 = {
-			fileRef = 8490D436085DF57B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D438085DF57B000C01D8 = {
-			fileRef = 8490D436085DF57B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D43C085E0518000C01D8 = {
-			fileRef = 8417779F085A116B000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D43D085E05F6000C01D8 = {
-			fileRef = 84177734085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D43E085E05F7000C01D8 = {
-			fileRef = 84177735085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D43F085E05F8000C01D8 = {
-			fileRef = 84177739085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D440085E05FA000C01D8 = {
-			fileRef = 8417773D085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D441085E05FB000C01D8 = {
-			fileRef = 8417773F085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D442085E05FC000C01D8 = {
-			fileRef = 84177741085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D443085E05FE000C01D8 = {
-			fileRef = 84177743085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D444085E05FF000C01D8 = {
-			fileRef = 84177745085A106C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D445085E0606000C01D8 = {
-			fileRef = 8417774C085A1097000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D446085E060A000C01D8 = {
-			fileRef = 84177755085A10AA000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D447085E060B000C01D8 = {
-			fileRef = 84177758085A10D2000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8490D448085E067E000C01D8 = {
-			fileRef = 8417779C085A114C000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		8494DFE80886EA0D000C01D8 = {
-			fileRef = 84C4E04B08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		849603A80A791C11000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = comptime.c;
-			path = ../../comptime.c;
-			refType = 2;
-		};
-		849603A90A791C11000C01D8 = {
-			fileRef = 849603A80A791C11000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		849603AA0A791C11000C01D8 = {
-			fileRef = 849603A80A791C11000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		849BD31C0A7E45B3000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = libpng.framework;
-			path = /Library/Frameworks/libpng.framework;
-			refType = 0;
-		};
-		849BD31D0A7E45B3000C01D8 = {
-			fileRef = 849BD31C0A7E45B3000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		849BD31E0A7E45B3000C01D8 = {
-			fileRef = 849BD31C0A7E45B3000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		849BD32D0A7E471D000C01D8 = {
-			fileRef = 849BD31C0A7E45B3000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E00D0862063C000C01D8 = {
-			children = (
-				6755C8BE101802C300A80195,
-				6755C8BF101802C300A80195,
-				6755C8C0101802C300A80195,
-				6755C8C1101802C300A80195,
-				6755C8C2101802C300A80195,
-				6755C8C3101802C300A80195,
-				6755C8C4101802C300A80195,
-				6755C8C5101802C300A80195,
-				6755C8C6101802C300A80195,
-			);
-			isa = PBXGroup;
-			name = Data;
-			refType = 4;
-		};
-		84C4E03F0862096F000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = AppKit.framework;
-			path = /System/Library/Frameworks/AppKit.framework;
-			refType = 0;
-		};
-		84C4E0400862096F000C01D8 = {
-			fileRef = 84C4E03F0862096F000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E0410862096F000C01D8 = {
-			fileRef = 84C4E03F0862096F000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E0420862098A000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = Foundation.framework;
-			path = /System/Library/Frameworks/Foundation.framework;
-			refType = 0;
-		};
-		84C4E0430862098A000C01D8 = {
-			fileRef = 84C4E0420862098A000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E0440862098A000C01D8 = {
-			fileRef = 84C4E0420862098A000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E045086209D3000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = CoreFoundation.framework;
-			path = /System/Library/Frameworks/CoreFoundation.framework;
-			refType = 0;
-		};
-		84C4E046086209D3000C01D8 = {
-			fileRef = 84C4E045086209D3000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E047086209D3000C01D8 = {
-			fileRef = 84C4E045086209D3000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E048086209FF000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = ApplicationServices.framework;
-			path = /System/Library/Frameworks/ApplicationServices.framework;
-			refType = 0;
-		};
-		84C4E049086209FF000C01D8 = {
-			fileRef = 84C4E048086209FF000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E04A086209FF000C01D8 = {
-			fileRef = 84C4E048086209FF000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E04B08620A46000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = SDL_mixer.framework;
-			path = /Library/Frameworks/SDL_mixer.framework;
-			refType = 0;
-		};
-		84C4E04C08620A46000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = SDL.framework;
-			path = /Library/Frameworks/SDL.framework;
-			refType = 0;
-		};
-		84C4E04E08620A46000C01D8 = {
-			fileRef = 84C4E04C08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E04F08620A46000C01D8 = {
-			fileRef = 84C4E04B08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84C4E05008620A46000C01D8 = {
-			fileRef = 84C4E04C08620A46000C01D8;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
-		84F202C708A92A5D000C01D8 = {
-			isa = PBXFrameworkReference;
-			name = OpenAL.framework;
-			path = /Library/Frameworks/OpenAL.framework;
-			refType = 0;
-		};
-		84F202CA08A92AA0000C01D8 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			name = s_openal.c;
-			path = ../../hardware/s_openal/s_openal.c;
-			refType = 2;
-		};
-	};
-	rootObject = 84177702085A0C64000C01D8;
-}
diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
deleted file mode 100644
index fada7849c2a2305aed694cd3ebb52f10597f5217..0000000000000000000000000000000000000000
--- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,1510 +0,0 @@
-// !$*UTF8*$!
-{
-	archiveVersion = 1;
-	classes = {
-	};
-	objectVersion = 44;
-	objects = {
-
-/* Begin PBXBuildFile section */
-		002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
-		002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 002F39F909D0881F00EBEB88 /* SDL.framework */; };
-		1E308E720B71172D0015728C /* lzf.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44B2240B67EADE00BAD059 /* lzf.c */; };
-		1E32C4290B6E6D5D0029E058 /* libpng.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E32C4140B6E6D5D0029E058 /* libpng.framework */; };
-		1E32C42B0B6E6D6E0029E058 /* libpng.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 1E32C4140B6E6D5D0029E058 /* libpng.framework */; };
-		1E44AE750B67CC2B00BAD059 /* hw_bsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE610B67CC2B00BAD059 /* hw_bsp.c */; };
-		1E44AE770B67CC2B00BAD059 /* hw3sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE630B67CC2B00BAD059 /* hw3sound.c */; };
-		1E44AE780B67CC2B00BAD059 /* hw_cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE640B67CC2B00BAD059 /* hw_cache.c */; };
-		1E44AE7C0B67CC2B00BAD059 /* hw_light.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE680B67CC2B00BAD059 /* hw_light.c */; };
-		1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */; };
-		1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE6E0B67CC2B00BAD059 /* hw_main.c */; };
-		1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE700B67CC2B00BAD059 /* hw_md2.c */; };
-		1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE720B67CC2B00BAD059 /* hw_trick.c */; };
-		1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */; };
-		1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE900B67CC8400BAD059 /* d_main.c */; };
-		1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE910B67CC8500BAD059 /* d_net.c */; };
-		1E44AEAB0B67CC8500BAD059 /* d_netfil.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE940B67CC8500BAD059 /* d_netfil.c */; };
-		1E44AEAF0B67CC8500BAD059 /* d_netcmd.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE980B67CC8500BAD059 /* d_netcmd.c */; };
-		1E44AEB30B67CC8500BAD059 /* dehacked.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AE9C0B67CC8500BAD059 /* dehacked.c */; };
-		1E44AEBF0B67CCA900BAD059 /* f_wipe.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEBC0B67CCA900BAD059 /* f_wipe.c */; };
-		1E44AEC00B67CCA900BAD059 /* f_finale.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEBD0B67CCA900BAD059 /* f_finale.c */; };
-		1E44AEC80B67CCC600BAD059 /* g_game.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEC30B67CCC600BAD059 /* g_game.c */; };
-		1E44AECC0B67CCC600BAD059 /* g_input.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEC70B67CCC600BAD059 /* g_input.c */; };
-		1E44AED00B67CCEE00BAD059 /* hu_stuff.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */; };
-		1E44AEDC0B67CD1300BAD059 /* i_tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AED50B67CD1200BAD059 /* i_tcp.c */; };
-		1E44AEE30B67CD2B00BAD059 /* am_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEE10B67CD2B00BAD059 /* am_map.c */; };
-		1E44AEE90B67CD3F00BAD059 /* command.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEE70B67CD3F00BAD059 /* command.c */; };
-		1E44AEEC0B67CD4400BAD059 /* comptime.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEEB0B67CD4400BAD059 /* comptime.c */; };
-		1E44AEEF0B67CD5400BAD059 /* console.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEED0B67CD5400BAD059 /* console.c */; };
-		1E44AEF30B67CD7F00BAD059 /* filesrch.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEF10B67CD7F00BAD059 /* filesrch.c */; };
-		1E44AF070B67CDE900BAD059 /* m_argv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEF80B67CDE900BAD059 /* m_argv.c */; };
-		1E44AF0A0B67CDE900BAD059 /* m_cheat.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFB0B67CDE900BAD059 /* m_cheat.c */; };
-		1E44AF0B0B67CDE900BAD059 /* m_bbox.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFC0B67CDE900BAD059 /* m_bbox.c */; };
-		1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; };
-		1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; };
-		1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; };
-		1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; };
-		1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; };
-		1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; };
-		1E44AF220B67CE4100BAD059 /* mserv.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF200B67CE4100BAD059 /* mserv.c */; };
-		1E44AF3C0B67CE5F00BAD059 /* p_enemy.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF240B67CE5F00BAD059 /* p_enemy.c */; };
-		1E44AF3D0B67CE5F00BAD059 /* p_inter.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF250B67CE5F00BAD059 /* p_inter.c */; };
-		1E44AF3E0B67CE5F00BAD059 /* p_fab.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF260B67CE5F00BAD059 /* p_fab.c */; };
-		1E44AF3F0B67CE5F00BAD059 /* p_lights.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF270B67CE5F00BAD059 /* p_lights.c */; };
-		1E44AF400B67CE5F00BAD059 /* p_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF280B67CE5F00BAD059 /* p_map.c */; };
-		1E44AF410B67CE5F00BAD059 /* p_maputl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF290B67CE5F00BAD059 /* p_maputl.c */; };
-		1E44AF430B67CE5F00BAD059 /* p_mobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */; };
-		1E44AF450B67CE5F00BAD059 /* p_floor.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF2D0B67CE5F00BAD059 /* p_floor.c */; };
-		1E44AF480B67CE5F00BAD059 /* p_saveg.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF300B67CE5F00BAD059 /* p_saveg.c */; };
-		1E44AF4A0B67CE5F00BAD059 /* p_setup.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF320B67CE5F00BAD059 /* p_setup.c */; };
-		1E44AF4C0B67CE5F00BAD059 /* p_sight.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF340B67CE5F00BAD059 /* p_sight.c */; };
-		1E44AF4D0B67CE5F00BAD059 /* p_spec.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF350B67CE5F00BAD059 /* p_spec.c */; };
-		1E44AF4F0B67CE5F00BAD059 /* p_telept.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF370B67CE5F00BAD059 /* p_telept.c */; };
-		1E44AF500B67CE5F00BAD059 /* p_tick.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF380B67CE5F00BAD059 /* p_tick.c */; };
-		1E44AF520B67CE5F00BAD059 /* p_user.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF3A0B67CE5F00BAD059 /* p_user.c */; };
-		1E44AF530B67CE5F00BAD059 /* p_ceilng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */; };
-		1E44AF6C0B67CEC200BAD059 /* r_bsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF550B67CEC100BAD059 /* r_bsp.c */; };
-		1E44AF6F0B67CEC200BAD059 /* r_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF580B67CEC100BAD059 /* r_data.c */; };
-		1E44AF700B67CEC200BAD059 /* r_draw.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF590B67CEC100BAD059 /* r_draw.c */; };
-		1E44AF730B67CEC200BAD059 /* r_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF5C0B67CEC100BAD059 /* r_main.c */; };
-		1E44AF780B67CEC200BAD059 /* r_plane.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF610B67CEC100BAD059 /* r_plane.c */; };
-		1E44AF7A0B67CEC200BAD059 /* r_segs.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF630B67CEC100BAD059 /* r_segs.c */; };
-		1E44AF7C0B67CEC200BAD059 /* r_sky.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF650B67CEC200BAD059 /* r_sky.c */; };
-		1E44AF7E0B67CEC200BAD059 /* r_splats.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF670B67CEC200BAD059 /* r_splats.c */; };
-		1E44AF810B67CEC200BAD059 /* r_things.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF6A0B67CEC200BAD059 /* r_things.c */; };
-		1E44AF870B67CEE000BAD059 /* s_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF850B67CEE000BAD059 /* s_sound.c */; };
-		1E44AF8B0B67CEE900BAD059 /* screen.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF890B67CEE900BAD059 /* screen.c */; };
-		1E44AF8F0B67CEF000BAD059 /* sounds.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF8D0B67CEF000BAD059 /* sounds.c */; };
-		1E44AF930B67CEFF00BAD059 /* st_stuff.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF910B67CEFF00BAD059 /* st_stuff.c */; };
-		1E44AF9B0B67CF2E00BAD059 /* tables.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF990B67CF2E00BAD059 /* tables.c */; };
-		1E44AFA50B67CF5D00BAD059 /* v_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFA30B67CF5D00BAD059 /* v_video.c */; };
-		1E44AFA90B67CF6400BAD059 /* w_wad.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFA70B67CF6400BAD059 /* w_wad.c */; };
-		1E44AFAD0B67CF6F00BAD059 /* y_inter.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFAB0B67CF6F00BAD059 /* y_inter.c */; };
-		1E44AFB10B67CF7A00BAD059 /* z_zone.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFAF0B67CF7A00BAD059 /* z_zone.c */; };
-		1E44AFC40B67CFDC00BAD059 /* dosstr.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB40B67CFDC00BAD059 /* dosstr.c */; };
-		1E44AFC50B67CFDC00BAD059 /* endtxt.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB50B67CFDC00BAD059 /* endtxt.c */; };
-		1E44AFC70B67CFDC00BAD059 /* hwsym_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */; };
-		1E44AFC90B67CFDC00BAD059 /* i_cdmus.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */; };
-		1E44AFCA0B67CFDC00BAD059 /* i_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBA0B67CFDC00BAD059 /* i_main.c */; };
-		1E44AFCB0B67CFDC00BAD059 /* i_net.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBB0B67CFDC00BAD059 /* i_net.c */; };
-		1E44AFCD0B67CFDC00BAD059 /* i_system.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBD0B67CFDC00BAD059 /* i_system.c */; };
-		1E44AFCE0B67CFDC00BAD059 /* i_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFBE0B67CFDC00BAD059 /* i_video.c */; };
-		1E44AFD00B67CFDC00BAD059 /* ogl_sdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */; };
-		1E44AFEA0B67D06200BAD059 /* Srb2mac.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1E44AFE70B67D06200BAD059 /* Srb2mac.icns */; };
-		1E44AFEB0B67D06200BAD059 /* mac_alert.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFE80B67D06200BAD059 /* mac_alert.c */; };
-		1E44AFED0B67D0AB00BAD059 /* r_opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */; };
-		1E44B0590B67D81E00BAD059 /* SDL_macosx_main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */; };
-		1E66921C0B690C5B00B7313A /* SDL_mixer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */; };
-		1E66921D0B690C6B00B7313A /* SDL_mixer.framework in Copy Frameworks into .app bundle */ = {isa = PBXBuildFile; fileRef = 1E66921B0B690C5B00B7313A /* SDL_mixer.framework */; };
-		67259DFD18D2687D00F02971 /* lua_hudlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFB18D2687D00F02971 /* lua_hudlib.c */; };
-		67259DFE18D2687D00F02971 /* lua_skinlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFC18D2687D00F02971 /* lua_skinlib.c */; };
-		67259E0118D268AE00F02971 /* m_anigif.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259DFF18D268AE00F02971 /* m_anigif.c */; };
-		67259E0618D268F700F02971 /* i_ttf.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0218D268F600F02971 /* i_ttf.c */; };
-		67259E0718D268F700F02971 /* mixer_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0418D268F600F02971 /* mixer_sound.c */; };
-		67259E0818D268F700F02971 /* sdl_sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 67259E0518D268F600F02971 /* sdl_sound.c */; };
-		67259E2E18D26D5700F02971 /* patch.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2B18D26D5700F02971 /* patch.dta */; };
-		67259E2F18D26D5700F02971 /* rings.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2C18D26D5700F02971 /* rings.dta */; };
-		67259E3018D26D5700F02971 /* srb2.srb in Resources */ = {isa = PBXBuildFile; fileRef = 67259E2D18D26D5700F02971 /* srb2.srb */; };
-		67259E3218D26DD200F02971 /* music.dta in Resources */ = {isa = PBXBuildFile; fileRef = 1E44AE440B67CBE800BAD059 /* music.dta */; };
-		67259E3318D26DD300F02971 /* player.dta in Resources */ = {isa = PBXBuildFile; fileRef = 67A1F91813FAD026009FA3E5 /* player.dta */; };
-		67259E3518D26DD500F02971 /* zones.dta in Resources */ = {isa = PBXBuildFile; fileRef = 6766C0AE11B057E50065F389 /* zones.dta */; };
-		676BB5200E0DE06100C95963 /* m_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 676BB51C0E0DE06100C95963 /* m_queue.c */; };
-		676BB5220E0DE06100C95963 /* p_polyobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 676BB51E0E0DE06100C95963 /* p_polyobj.c */; };
-		67B83BFA14F57EAB00AAAE4E /* lapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCB14F57EAB00AAAE4E /* lapi.c */; };
-		67B83BFB14F57EAB00AAAE4E /* lauxlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCD14F57EAB00AAAE4E /* lauxlib.c */; };
-		67B83BFC14F57EAB00AAAE4E /* lbaselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BCF14F57EAB00AAAE4E /* lbaselib.c */; };
-		67B83BFD14F57EAB00AAAE4E /* lcode.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD014F57EAB00AAAE4E /* lcode.c */; };
-		67B83BFE14F57EAB00AAAE4E /* ldebug.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD214F57EAB00AAAE4E /* ldebug.c */; };
-		67B83BFF14F57EAB00AAAE4E /* ldo.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD414F57EAB00AAAE4E /* ldo.c */; };
-		67B83C0014F57EAB00AAAE4E /* ldump.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD614F57EAB00AAAE4E /* ldump.c */; };
-		67B83C0114F57EAB00AAAE4E /* lfunc.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD714F57EAB00AAAE4E /* lfunc.c */; };
-		67B83C0214F57EAB00AAAE4E /* lgc.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BD914F57EAB00AAAE4E /* lgc.c */; };
-		67B83C0314F57EAB00AAAE4E /* linit.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDB14F57EAB00AAAE4E /* linit.c */; };
-		67B83C0414F57EAB00AAAE4E /* llex.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDC14F57EAB00AAAE4E /* llex.c */; };
-		67B83C0514F57EAB00AAAE4E /* lmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BDF14F57EAB00AAAE4E /* lmem.c */; };
-		67B83C0614F57EAB00AAAE4E /* lobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE114F57EAB00AAAE4E /* lobject.c */; };
-		67B83C0714F57EAB00AAAE4E /* lopcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE314F57EAB00AAAE4E /* lopcodes.c */; };
-		67B83C0814F57EAB00AAAE4E /* lparser.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE514F57EAB00AAAE4E /* lparser.c */; };
-		67B83C0914F57EAB00AAAE4E /* lstate.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE714F57EAB00AAAE4E /* lstate.c */; };
-		67B83C0A14F57EAB00AAAE4E /* lstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BE914F57EAB00AAAE4E /* lstring.c */; };
-		67B83C0B14F57EAB00AAAE4E /* lstrlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEB14F57EAB00AAAE4E /* lstrlib.c */; };
-		67B83C0C14F57EAB00AAAE4E /* ltable.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEC14F57EAB00AAAE4E /* ltable.c */; };
-		67B83C0D14F57EAB00AAAE4E /* ltablib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEE14F57EAB00AAAE4E /* ltablib.c */; };
-		67B83C0E14F57EAB00AAAE4E /* ltm.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BEF14F57EAB00AAAE4E /* ltm.c */; };
-		67B83C0F14F57EAB00AAAE4E /* lundump.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF414F57EAB00AAAE4E /* lundump.c */; };
-		67B83C1014F57EAB00AAAE4E /* lvm.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF614F57EAB00AAAE4E /* lvm.c */; };
-		67B83C1114F57EAB00AAAE4E /* lzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83BF814F57EAB00AAAE4E /* lzio.c */; };
-		67B83C1414F57ECA00AAAE4E /* b_bot.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1214F57ECA00AAAE4E /* b_bot.c */; };
-		67B83C2214F57EE600AAAE4E /* lua_baselib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1514F57EE600AAAE4E /* lua_baselib.c */; };
-		67B83C2314F57EE600AAAE4E /* lua_consolelib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1614F57EE600AAAE4E /* lua_consolelib.c */; };
-		67B83C2414F57EE600AAAE4E /* lua_hooklib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1814F57EE600AAAE4E /* lua_hooklib.c */; };
-		67B83C2514F57EE600AAAE4E /* lua_infolib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1914F57EE600AAAE4E /* lua_infolib.c */; };
-		67B83C2614F57EE600AAAE4E /* lua_maplib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1B14F57EE600AAAE4E /* lua_maplib.c */; };
-		67B83C2714F57EE600AAAE4E /* lua_mathlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */; };
-		67B83C2814F57EE600AAAE4E /* lua_mobjlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */; };
-		67B83C2914F57EE600AAAE4E /* lua_playerlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */; };
-		67B83C2A14F57EE600AAAE4E /* lua_script.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C1F14F57EE600AAAE4E /* lua_script.c */; };
-		67B83C2B14F57EE600AAAE4E /* lua_thinkerlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */; };
-		67B83C3314F57F1500AAAE4E /* m_cond.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B83C2F14F57F1500AAAE4E /* m_cond.c */; };
-		8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
-		8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
-		002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 12;
-			dstPath = "";
-			dstSubfolderSpec = 10;
-			files = (
-				1E32C42B0B6E6D6E0029E058 /* libpng.framework in Copy Frameworks into .app bundle */,
-				1E66921D0B690C6B00B7313A /* SDL_mixer.framework in Copy Frameworks into .app bundle */,
-				002F3A0009D0884600EBEB88 /* SDL.framework in Copy Frameworks into .app bundle */,
-			);
-			name = "Copy Frameworks into .app bundle";
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
-		002F39F909D0881F00EBEB88 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
-		089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
-		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
-		1E32C4140B6E6D5D0029E058 /* libpng.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libpng.framework; path = /Library/Frameworks/libpng.framework; sourceTree = "<absolute>"; };
-		1E44AE440B67CBE800BAD059 /* music.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = music.dta; path = ../../../bin/Resources/music.dta; sourceTree = SOURCE_ROOT; };
-		1E44AE4B0B67CBE800BAD059 /* srb2.wad */ = {isa = PBXFileReference; lastKnownFileType = text; name = srb2.wad; path = ../../../bin/Resources/srb2.wad; sourceTree = SOURCE_ROOT; };
-		1E44AE600B67CC2B00BAD059 /* hw3dsdrv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3dsdrv.h; path = ../../hardware/hw3dsdrv.h; sourceTree = SOURCE_ROOT; };
-		1E44AE610B67CC2B00BAD059 /* hw_bsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_bsp.c; path = ../../hardware/hw_bsp.c; sourceTree = SOURCE_ROOT; };
-		1E44AE620B67CC2B00BAD059 /* hw_defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_defs.h; path = ../../hardware/hw_defs.h; sourceTree = SOURCE_ROOT; };
-		1E44AE630B67CC2B00BAD059 /* hw3sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw3sound.c; path = ../../hardware/hw3sound.c; sourceTree = SOURCE_ROOT; };
-		1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
-		1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
-		1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
-		1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; };
-		1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
-		1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
-		1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
-		1E44AE6B0B67CC2B00BAD059 /* hw_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_data.h; path = ../../hardware/hw_data.h; sourceTree = SOURCE_ROOT; };
-		1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_draw.c; path = ../../hardware/hw_draw.c; sourceTree = SOURCE_ROOT; };
-		1E44AE6D0B67CC2B00BAD059 /* hw_glob.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glob.h; path = ../../hardware/hw_glob.h; sourceTree = SOURCE_ROOT; };
-		1E44AE6E0B67CC2B00BAD059 /* hw_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_main.c; path = ../../hardware/hw_main.c; sourceTree = SOURCE_ROOT; };
-		1E44AE6F0B67CC2B00BAD059 /* hw_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_main.h; path = ../../hardware/hw_main.h; sourceTree = SOURCE_ROOT; };
-		1E44AE700B67CC2B00BAD059 /* hw_md2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_md2.c; path = ../../hardware/hw_md2.c; sourceTree = SOURCE_ROOT; };
-		1E44AE710B67CC2B00BAD059 /* hw_md2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_md2.h; path = ../../hardware/hw_md2.h; sourceTree = SOURCE_ROOT; };
-		1E44AE720B67CC2B00BAD059 /* hw_trick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_trick.c; path = ../../hardware/hw_trick.c; sourceTree = SOURCE_ROOT; };
-		1E44AE730B67CC2B00BAD059 /* hws_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hws_data.h; path = ../../hardware/hws_data.h; sourceTree = SOURCE_ROOT; };
-		1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.pascal; name = asm_defs.inc; path = ../../asm_defs.inc; sourceTree = SOURCE_ROOT; };
-		1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_clisrv.c; path = ../../d_clisrv.c; sourceTree = SOURCE_ROOT; };
-		1E44AE8E0B67CC8400BAD059 /* d_clisrv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_clisrv.h; path = ../../d_clisrv.h; sourceTree = SOURCE_ROOT; };
-		1E44AE8F0B67CC8400BAD059 /* d_event.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_event.h; path = ../../d_event.h; sourceTree = SOURCE_ROOT; };
-		1E44AE900B67CC8400BAD059 /* d_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_main.c; path = ../../d_main.c; sourceTree = SOURCE_ROOT; };
-		1E44AE910B67CC8500BAD059 /* d_net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_net.c; path = ../../d_net.c; sourceTree = SOURCE_ROOT; };
-		1E44AE920B67CC8500BAD059 /* d_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_net.h; path = ../../d_net.h; sourceTree = SOURCE_ROOT; };
-		1E44AE930B67CC8500BAD059 /* d_netcmd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_netcmd.h; path = ../../d_netcmd.h; sourceTree = SOURCE_ROOT; };
-		1E44AE940B67CC8500BAD059 /* d_netfil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_netfil.c; path = ../../d_netfil.c; sourceTree = SOURCE_ROOT; };
-		1E44AE950B67CC8500BAD059 /* d_player.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_player.h; path = ../../d_player.h; sourceTree = SOURCE_ROOT; };
-		1E44AE960B67CC8500BAD059 /* d_think.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_think.h; path = ../../d_think.h; sourceTree = SOURCE_ROOT; };
-		1E44AE980B67CC8500BAD059 /* d_netcmd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = d_netcmd.c; path = ../../d_netcmd.c; sourceTree = SOURCE_ROOT; };
-		1E44AE990B67CC8500BAD059 /* d_ticcmd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_ticcmd.h; path = ../../d_ticcmd.h; sourceTree = SOURCE_ROOT; };
-		1E44AE9A0B67CC8500BAD059 /* d_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_main.h; path = ../../d_main.h; sourceTree = SOURCE_ROOT; };
-		1E44AE9B0B67CC8500BAD059 /* d_netfil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = d_netfil.h; path = ../../d_netfil.h; sourceTree = SOURCE_ROOT; };
-		1E44AE9C0B67CC8500BAD059 /* dehacked.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dehacked.c; path = ../../dehacked.c; sourceTree = SOURCE_ROOT; };
-		1E44AE9D0B67CC8500BAD059 /* dehacked.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dehacked.h; path = ../../dehacked.h; sourceTree = SOURCE_ROOT; };
-		1E44AE9E0B67CC8500BAD059 /* doomdata.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomdata.h; path = ../../doomdata.h; sourceTree = SOURCE_ROOT; };
-		1E44AE9F0B67CC8500BAD059 /* doomdef.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomdef.h; path = ../../doomdef.h; sourceTree = SOURCE_ROOT; };
-		1E44AEA00B67CC8500BAD059 /* doomstat.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomstat.h; path = ../../doomstat.h; sourceTree = SOURCE_ROOT; };
-		1E44AEA10B67CC8500BAD059 /* doomtype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = doomtype.h; path = ../../doomtype.h; sourceTree = SOURCE_ROOT; };
-		1E44AEBC0B67CCA900BAD059 /* f_wipe.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = f_wipe.c; path = ../../f_wipe.c; sourceTree = SOURCE_ROOT; };
-		1E44AEBD0B67CCA900BAD059 /* f_finale.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = f_finale.c; path = ../../f_finale.c; sourceTree = SOURCE_ROOT; };
-		1E44AEBE0B67CCA900BAD059 /* f_finale.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = f_finale.h; path = ../../f_finale.h; sourceTree = SOURCE_ROOT; };
-		1E44AEC30B67CCC600BAD059 /* g_game.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = g_game.c; path = ../../g_game.c; sourceTree = SOURCE_ROOT; };
-		1E44AEC40B67CCC600BAD059 /* g_game.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_game.h; path = ../../g_game.h; sourceTree = SOURCE_ROOT; };
-		1E44AEC50B67CCC600BAD059 /* g_input.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_input.h; path = ../../g_input.h; sourceTree = SOURCE_ROOT; };
-		1E44AEC60B67CCC600BAD059 /* g_state.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = g_state.h; path = ../../g_state.h; sourceTree = SOURCE_ROOT; };
-		1E44AEC70B67CCC600BAD059 /* g_input.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = g_input.c; path = ../../g_input.c; sourceTree = SOURCE_ROOT; };
-		1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hu_stuff.c; path = ../../hu_stuff.c; sourceTree = SOURCE_ROOT; };
-		1E44AECF0B67CCEE00BAD059 /* hu_stuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hu_stuff.h; path = ../../hu_stuff.h; sourceTree = SOURCE_ROOT; };
-		1E44AED30B67CD1200BAD059 /* i_net.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_net.h; path = ../../i_net.h; sourceTree = SOURCE_ROOT; };
-		1E44AED40B67CD1200BAD059 /* i_sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_sound.h; path = ../../i_sound.h; sourceTree = SOURCE_ROOT; };
-		1E44AED50B67CD1200BAD059 /* i_tcp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_tcp.c; path = ../../i_tcp.c; sourceTree = SOURCE_ROOT; };
-		1E44AED60B67CD1200BAD059 /* i_tcp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_tcp.h; path = ../../i_tcp.h; sourceTree = SOURCE_ROOT; };
-		1E44AED70B67CD1200BAD059 /* i_system.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_system.h; path = ../../i_system.h; sourceTree = SOURCE_ROOT; };
-		1E44AED80B67CD1200BAD059 /* i_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_video.h; path = ../../i_video.h; sourceTree = SOURCE_ROOT; };
-		1E44AED90B67CD1300BAD059 /* i_joy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = i_joy.h; path = ../../i_joy.h; sourceTree = SOURCE_ROOT; };
-		1E44AEE10B67CD2B00BAD059 /* am_map.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = am_map.c; path = ../../am_map.c; sourceTree = SOURCE_ROOT; };
-		1E44AEE20B67CD2B00BAD059 /* am_map.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = am_map.h; path = ../../am_map.h; sourceTree = SOURCE_ROOT; };
-		1E44AEE50B67CD3200BAD059 /* byteptr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = byteptr.h; path = ../../byteptr.h; sourceTree = SOURCE_ROOT; };
-		1E44AEE70B67CD3F00BAD059 /* command.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = command.c; path = ../../command.c; sourceTree = SOURCE_ROOT; };
-		1E44AEE80B67CD3F00BAD059 /* command.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = command.h; path = ../../command.h; sourceTree = SOURCE_ROOT; };
-		1E44AEEB0B67CD4400BAD059 /* comptime.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = comptime.c; path = ../../comptime.c; sourceTree = SOURCE_ROOT; };
-		1E44AEED0B67CD5400BAD059 /* console.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = console.c; path = ../../console.c; sourceTree = SOURCE_ROOT; };
-		1E44AEEE0B67CD5400BAD059 /* console.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = console.h; path = ../../console.h; sourceTree = SOURCE_ROOT; };
-		1E44AEF10B67CD7F00BAD059 /* filesrch.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = filesrch.c; path = ../../filesrch.c; sourceTree = SOURCE_ROOT; };
-		1E44AEF20B67CD7F00BAD059 /* filesrch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = filesrch.h; path = ../../filesrch.h; sourceTree = SOURCE_ROOT; };
-		1E44AEF50B67CD9F00BAD059 /* keys.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = keys.h; path = ../../keys.h; sourceTree = SOURCE_ROOT; };
-		1E44AEF80B67CDE900BAD059 /* m_argv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_argv.c; path = ../../m_argv.c; sourceTree = SOURCE_ROOT; };
-		1E44AEF90B67CDE900BAD059 /* m_bbox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_bbox.h; path = ../../m_bbox.h; sourceTree = SOURCE_ROOT; };
-		1E44AEFA0B67CDE900BAD059 /* m_argv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_argv.h; path = ../../m_argv.h; sourceTree = SOURCE_ROOT; };
-		1E44AEFB0B67CDE900BAD059 /* m_cheat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_cheat.c; path = ../../m_cheat.c; sourceTree = SOURCE_ROOT; };
-		1E44AEFC0B67CDE900BAD059 /* m_bbox.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_bbox.c; path = ../../m_bbox.c; sourceTree = SOURCE_ROOT; };
-		1E44AEFD0B67CDE900BAD059 /* m_cheat.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_cheat.h; path = ../../m_cheat.h; sourceTree = SOURCE_ROOT; };
-		1E44AEFE0B67CDE900BAD059 /* m_fixed.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_fixed.c; path = ../../m_fixed.c; sourceTree = SOURCE_ROOT; };
-		1E44AEFF0B67CDE900BAD059 /* m_fixed.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_fixed.h; path = ../../m_fixed.h; sourceTree = SOURCE_ROOT; };
-		1E44AF000B67CDE900BAD059 /* m_menu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_menu.c; path = ../../m_menu.c; sourceTree = SOURCE_ROOT; };
-		1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; };
-		1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; };
-		1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; };
-		1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; };
-		1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; };
-		1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; };
-		1E44AF180B67CE2A00BAD059 /* info.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = info.c; path = ../../info.c; sourceTree = SOURCE_ROOT; };
-		1E44AF190B67CE2A00BAD059 /* info.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = info.h; path = ../../info.h; sourceTree = SOURCE_ROOT; };
-		1E44AF1C0B67CE3600BAD059 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = md5.c; path = ../../md5.c; sourceTree = SOURCE_ROOT; };
-		1E44AF1D0B67CE3600BAD059 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = md5.h; path = ../../md5.h; sourceTree = SOURCE_ROOT; };
-		1E44AF200B67CE4100BAD059 /* mserv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mserv.c; path = ../../mserv.c; sourceTree = SOURCE_ROOT; };
-		1E44AF210B67CE4100BAD059 /* mserv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = mserv.h; path = ../../mserv.h; sourceTree = SOURCE_ROOT; };
-		1E44AF240B67CE5F00BAD059 /* p_enemy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_enemy.c; path = ../../p_enemy.c; sourceTree = SOURCE_ROOT; };
-		1E44AF250B67CE5F00BAD059 /* p_inter.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_inter.c; path = ../../p_inter.c; sourceTree = SOURCE_ROOT; };
-		1E44AF260B67CE5F00BAD059 /* p_fab.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_fab.c; path = ../../p_fab.c; sourceTree = SOURCE_ROOT; };
-		1E44AF270B67CE5F00BAD059 /* p_lights.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_lights.c; path = ../../p_lights.c; sourceTree = SOURCE_ROOT; };
-		1E44AF280B67CE5F00BAD059 /* p_map.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_map.c; path = ../../p_map.c; sourceTree = SOURCE_ROOT; };
-		1E44AF290B67CE5F00BAD059 /* p_maputl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_maputl.c; path = ../../p_maputl.c; sourceTree = SOURCE_ROOT; };
-		1E44AF2A0B67CE5F00BAD059 /* p_maputl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_maputl.h; path = ../../p_maputl.h; sourceTree = SOURCE_ROOT; };
-		1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_mobj.c; path = ../../p_mobj.c; sourceTree = SOURCE_ROOT; };
-		1E44AF2C0B67CE5F00BAD059 /* p_mobj.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_mobj.h; path = ../../p_mobj.h; sourceTree = SOURCE_ROOT; };
-		1E44AF2D0B67CE5F00BAD059 /* p_floor.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_floor.c; path = ../../p_floor.c; sourceTree = SOURCE_ROOT; };
-		1E44AF2E0B67CE5F00BAD059 /* p_local.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_local.h; path = ../../p_local.h; sourceTree = SOURCE_ROOT; };
-		1E44AF2F0B67CE5F00BAD059 /* p_pspr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_pspr.h; path = ../../p_pspr.h; sourceTree = SOURCE_ROOT; };
-		1E44AF300B67CE5F00BAD059 /* p_saveg.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_saveg.c; path = ../../p_saveg.c; sourceTree = SOURCE_ROOT; };
-		1E44AF310B67CE5F00BAD059 /* p_saveg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_saveg.h; path = ../../p_saveg.h; sourceTree = SOURCE_ROOT; };
-		1E44AF320B67CE5F00BAD059 /* p_setup.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_setup.c; path = ../../p_setup.c; sourceTree = SOURCE_ROOT; };
-		1E44AF330B67CE5F00BAD059 /* p_setup.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_setup.h; path = ../../p_setup.h; sourceTree = SOURCE_ROOT; };
-		1E44AF340B67CE5F00BAD059 /* p_sight.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_sight.c; path = ../../p_sight.c; sourceTree = SOURCE_ROOT; };
-		1E44AF350B67CE5F00BAD059 /* p_spec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_spec.c; path = ../../p_spec.c; sourceTree = SOURCE_ROOT; };
-		1E44AF360B67CE5F00BAD059 /* p_spec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_spec.h; path = ../../p_spec.h; sourceTree = SOURCE_ROOT; };
-		1E44AF370B67CE5F00BAD059 /* p_telept.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_telept.c; path = ../../p_telept.c; sourceTree = SOURCE_ROOT; };
-		1E44AF380B67CE5F00BAD059 /* p_tick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_tick.c; path = ../../p_tick.c; sourceTree = SOURCE_ROOT; };
-		1E44AF390B67CE5F00BAD059 /* p_tick.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = p_tick.h; path = ../../p_tick.h; sourceTree = SOURCE_ROOT; };
-		1E44AF3A0B67CE5F00BAD059 /* p_user.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_user.c; path = ../../p_user.c; sourceTree = SOURCE_ROOT; };
-		1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = p_ceilng.c; path = ../../p_ceilng.c; sourceTree = SOURCE_ROOT; };
-		1E44AF550B67CEC100BAD059 /* r_bsp.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_bsp.c; path = ../../r_bsp.c; sourceTree = SOURCE_ROOT; };
-		1E44AF560B67CEC100BAD059 /* r_bsp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_bsp.h; path = ../../r_bsp.h; sourceTree = SOURCE_ROOT; };
-		1E44AF570B67CEC100BAD059 /* r_defs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_defs.h; path = ../../r_defs.h; sourceTree = SOURCE_ROOT; };
-		1E44AF580B67CEC100BAD059 /* r_data.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_data.c; path = ../../r_data.c; sourceTree = SOURCE_ROOT; };
-		1E44AF590B67CEC100BAD059 /* r_draw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw.c; path = ../../r_draw.c; sourceTree = SOURCE_ROOT; };
-		1E44AF5A0B67CEC100BAD059 /* r_draw16.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw16.c; path = ../../r_draw16.c; sourceTree = SOURCE_ROOT; };
-		1E44AF5B0B67CEC100BAD059 /* r_draw8.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_draw8.c; path = ../../r_draw8.c; sourceTree = SOURCE_ROOT; };
-		1E44AF5C0B67CEC100BAD059 /* r_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_main.c; path = ../../r_main.c; sourceTree = SOURCE_ROOT; };
-		1E44AF5D0B67CEC100BAD059 /* r_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_main.h; path = ../../r_main.h; sourceTree = SOURCE_ROOT; };
-		1E44AF5E0B67CEC100BAD059 /* r_data.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_data.h; path = ../../r_data.h; sourceTree = SOURCE_ROOT; };
-		1E44AF5F0B67CEC100BAD059 /* r_draw.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_draw.h; path = ../../r_draw.h; sourceTree = SOURCE_ROOT; };
-		1E44AF600B67CEC100BAD059 /* r_local.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_local.h; path = ../../r_local.h; sourceTree = SOURCE_ROOT; };
-		1E44AF610B67CEC100BAD059 /* r_plane.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_plane.c; path = ../../r_plane.c; sourceTree = SOURCE_ROOT; };
-		1E44AF620B67CEC100BAD059 /* r_plane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_plane.h; path = ../../r_plane.h; sourceTree = SOURCE_ROOT; };
-		1E44AF630B67CEC100BAD059 /* r_segs.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_segs.c; path = ../../r_segs.c; sourceTree = SOURCE_ROOT; };
-		1E44AF640B67CEC100BAD059 /* r_segs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_segs.h; path = ../../r_segs.h; sourceTree = SOURCE_ROOT; };
-		1E44AF650B67CEC200BAD059 /* r_sky.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_sky.c; path = ../../r_sky.c; sourceTree = SOURCE_ROOT; };
-		1E44AF660B67CEC200BAD059 /* r_sky.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_sky.h; path = ../../r_sky.h; sourceTree = SOURCE_ROOT; };
-		1E44AF670B67CEC200BAD059 /* r_splats.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_splats.c; path = ../../r_splats.c; sourceTree = SOURCE_ROOT; };
-		1E44AF680B67CEC200BAD059 /* r_splats.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_splats.h; path = ../../r_splats.h; sourceTree = SOURCE_ROOT; };
-		1E44AF690B67CEC200BAD059 /* r_state.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_state.h; path = ../../r_state.h; sourceTree = SOURCE_ROOT; };
-		1E44AF6A0B67CEC200BAD059 /* r_things.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_things.c; path = ../../r_things.c; sourceTree = SOURCE_ROOT; };
-		1E44AF6B0B67CEC200BAD059 /* r_things.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = r_things.h; path = ../../r_things.h; sourceTree = SOURCE_ROOT; };
-		1E44AF850B67CEE000BAD059 /* s_sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = s_sound.c; path = ../../s_sound.c; sourceTree = SOURCE_ROOT; };
-		1E44AF860B67CEE000BAD059 /* s_sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = s_sound.h; path = ../../s_sound.h; sourceTree = SOURCE_ROOT; };
-		1E44AF890B67CEE900BAD059 /* screen.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = screen.c; path = ../../screen.c; sourceTree = SOURCE_ROOT; };
-		1E44AF8A0B67CEE900BAD059 /* screen.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = screen.h; path = ../../screen.h; sourceTree = SOURCE_ROOT; };
-		1E44AF8D0B67CEF000BAD059 /* sounds.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sounds.c; path = ../../sounds.c; sourceTree = SOURCE_ROOT; };
-		1E44AF8E0B67CEF000BAD059 /* sounds.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sounds.h; path = ../../sounds.h; sourceTree = SOURCE_ROOT; };
-		1E44AF910B67CEFF00BAD059 /* st_stuff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = st_stuff.c; path = ../../st_stuff.c; sourceTree = SOURCE_ROOT; };
-		1E44AF920B67CEFF00BAD059 /* st_stuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = st_stuff.h; path = ../../st_stuff.h; sourceTree = SOURCE_ROOT; };
-		1E44AF950B67CF1300BAD059 /* string.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = string.c; path = ../../string.c; sourceTree = SOURCE_ROOT; };
-		1E44AF990B67CF2E00BAD059 /* tables.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = tables.c; path = ../../tables.c; sourceTree = SOURCE_ROOT; };
-		1E44AF9A0B67CF2E00BAD059 /* tables.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = tables.h; path = ../../tables.h; sourceTree = SOURCE_ROOT; };
-		1E44AF9D0B67CF3D00BAD059 /* tmap.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap.nas; path = ../../tmap.nas; sourceTree = SOURCE_ROOT; };
-		1E44AF9F0B67CF4900BAD059 /* tmap_mmx.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap_mmx.nas; path = ../../tmap_mmx.nas; sourceTree = SOURCE_ROOT; };
-		1E44AFA00B67CF4900BAD059 /* tmap_vc.nas */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = tmap_vc.nas; path = ../../tmap_vc.nas; sourceTree = SOURCE_ROOT; };
-		1E44AFA30B67CF5D00BAD059 /* v_video.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = v_video.c; path = ../../v_video.c; sourceTree = SOURCE_ROOT; };
-		1E44AFA40B67CF5D00BAD059 /* v_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = v_video.h; path = ../../v_video.h; sourceTree = SOURCE_ROOT; };
-		1E44AFA70B67CF6400BAD059 /* w_wad.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = w_wad.c; path = ../../w_wad.c; sourceTree = SOURCE_ROOT; };
-		1E44AFA80B67CF6400BAD059 /* w_wad.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = w_wad.h; path = ../../w_wad.h; sourceTree = SOURCE_ROOT; };
-		1E44AFAB0B67CF6F00BAD059 /* y_inter.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = y_inter.c; path = ../../y_inter.c; sourceTree = SOURCE_ROOT; };
-		1E44AFAC0B67CF6F00BAD059 /* y_inter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = y_inter.h; path = ../../y_inter.h; sourceTree = SOURCE_ROOT; };
-		1E44AFAF0B67CF7A00BAD059 /* z_zone.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = z_zone.c; path = ../../z_zone.c; sourceTree = SOURCE_ROOT; };
-		1E44AFB00B67CF7A00BAD059 /* z_zone.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = z_zone.h; path = ../../z_zone.h; sourceTree = SOURCE_ROOT; };
-		1E44AFB40B67CFDC00BAD059 /* dosstr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dosstr.c; path = ../dosstr.c; sourceTree = SOURCE_ROOT; };
-		1E44AFB50B67CFDC00BAD059 /* endtxt.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = endtxt.c; path = ../endtxt.c; sourceTree = SOURCE_ROOT; };
-		1E44AFB60B67CFDC00BAD059 /* endtxt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = endtxt.h; path = ../endtxt.h; sourceTree = SOURCE_ROOT; };
-		1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hwsym_sdl.c; path = ../hwsym_sdl.c; sourceTree = SOURCE_ROOT; };
-		1E44AFB80B67CFDC00BAD059 /* hwsym_sdl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hwsym_sdl.h; path = ../hwsym_sdl.h; sourceTree = SOURCE_ROOT; };
-		1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_cdmus.c; path = ../i_cdmus.c; sourceTree = SOURCE_ROOT; };
-		1E44AFBA0B67CFDC00BAD059 /* i_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_main.c; path = ../i_main.c; sourceTree = SOURCE_ROOT; };
-		1E44AFBB0B67CFDC00BAD059 /* i_net.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_net.c; path = ../i_net.c; sourceTree = SOURCE_ROOT; };
-		1E44AFBD0B67CFDC00BAD059 /* i_system.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_system.c; path = ../i_system.c; sourceTree = SOURCE_ROOT; };
-		1E44AFBE0B67CFDC00BAD059 /* i_video.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = i_video.c; path = ../i_video.c; sourceTree = SOURCE_ROOT; };
-		1E44AFBF0B67CFDC00BAD059 /* IMG_xpm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = IMG_xpm.c; path = ../IMG_xpm.c; sourceTree = SOURCE_ROOT; };
-		1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ogl_sdl.c; path = ../ogl_sdl.c; sourceTree = SOURCE_ROOT; };
-		1E44AFC10B67CFDC00BAD059 /* ogl_sdl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ogl_sdl.h; path = ../ogl_sdl.h; sourceTree = SOURCE_ROOT; };
-		1E44AFC20B67CFDC00BAD059 /* SDL_icon.xpm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = SDL_icon.xpm; path = ../SDL_icon.xpm; sourceTree = SOURCE_ROOT; };
-		1E44AFC30B67CFDC00BAD059 /* sdlmain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sdlmain.h; path = ../sdlmain.h; sourceTree = SOURCE_ROOT; };
-		1E44AFD50B67D03100BAD059 /* filters.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = filters.c; path = ../filter/filters.c; sourceTree = SOURCE_ROOT; };
-		1E44AFD60B67D03100BAD059 /* filters.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = filters.h; path = ../filter/filters.h; sourceTree = SOURCE_ROOT; };
-		1E44AFD70B67D03100BAD059 /* hq2x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hq2x.c; path = ../filter/hq2x.c; sourceTree = SOURCE_ROOT; };
-		1E44AFD80B67D03100BAD059 /* hq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq2x.h; path = ../filter/hq2x.h; sourceTree = SOURCE_ROOT; };
-		1E44AFD90B67D03100BAD059 /* interp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = interp.h; path = ../filter/interp.h; sourceTree = SOURCE_ROOT; };
-		1E44AFDA0B67D03100BAD059 /* lq2x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lq2x.c; path = ../filter/lq2x.c; sourceTree = SOURCE_ROOT; };
-		1E44AFDB0B67D03100BAD059 /* lq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lq2x.h; path = ../filter/lq2x.h; sourceTree = SOURCE_ROOT; };
-		1E44AFDC0B67D03100BAD059 /* main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../filter/main.c; sourceTree = SOURCE_ROOT; };
-		1E44AFE60B67D06200BAD059 /* mac_alert.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mac_alert.h; sourceTree = SOURCE_ROOT; };
-		1E44AFE70B67D06200BAD059 /* Srb2mac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Srb2mac.icns; sourceTree = SOURCE_ROOT; };
-		1E44AFE80B67D06200BAD059 /* mac_alert.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = mac_alert.c; sourceTree = SOURCE_ROOT; };
-		1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = r_opengl.c; path = ../../hardware/r_opengl/r_opengl.c; sourceTree = SOURCE_ROOT; };
-		1E44B0560B67D81E00BAD059 /* SDL_macosx_main.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_macosx_main.h; path = ../SDL_main/SDL_macosx_main.h; sourceTree = SOURCE_ROOT; };
-		1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SDL_macosx_main.m; path = ../SDL_main/SDL_macosx_main.m; sourceTree = SOURCE_ROOT; };
-		1E44B2240B67EADE00BAD059 /* lzf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = lzf.c; path = ../../lzf.c; sourceTree = SOURCE_ROOT; };
-		1E44B2250B67EADE00BAD059 /* lzf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = lzf.h; path = ../../lzf.h; sourceTree = SOURCE_ROOT; };
-		1E66921B0B690C5B00B7313A /* SDL_mixer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL_mixer.framework; path = /Library/Frameworks/SDL_mixer.framework; sourceTree = "<absolute>"; };
-		29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
-		29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
-		67259DFA18D2687D00F02971 /* lua_hud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_hud.h; path = ../../lua_hud.h; sourceTree = SOURCE_ROOT; };
-		67259DFB18D2687D00F02971 /* lua_hudlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_hudlib.c; path = ../../lua_hudlib.c; sourceTree = SOURCE_ROOT; };
-		67259DFC18D2687D00F02971 /* lua_skinlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_skinlib.c; path = ../../lua_skinlib.c; sourceTree = SOURCE_ROOT; };
-		67259DFF18D268AE00F02971 /* m_anigif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_anigif.c; path = ../../m_anigif.c; sourceTree = SOURCE_ROOT; };
-		67259E0018D268AE00F02971 /* m_anigif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_anigif.h; path = ../../m_anigif.h; sourceTree = SOURCE_ROOT; };
-		67259E0218D268F600F02971 /* i_ttf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = i_ttf.c; path = ../i_ttf.c; sourceTree = SOURCE_ROOT; };
-		67259E0318D268F600F02971 /* i_ttf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_ttf.h; path = ../i_ttf.h; sourceTree = SOURCE_ROOT; };
-		67259E0418D268F600F02971 /* mixer_sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mixer_sound.c; path = ../mixer_sound.c; sourceTree = SOURCE_ROOT; };
-		67259E0518D268F600F02971 /* sdl_sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sdl_sound.c; path = ../sdl_sound.c; sourceTree = SOURCE_ROOT; };
-		67259E2B18D26D5700F02971 /* patch.dta */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = patch.dta; path = ../../../bin/Resources/patch.dta; sourceTree = SOURCE_ROOT; };
-		67259E2C18D26D5700F02971 /* rings.dta */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rings.dta; path = ../../../bin/Resources/rings.dta; sourceTree = SOURCE_ROOT; };
-		67259E2D18D26D5700F02971 /* srb2.srb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = srb2.srb; path = ../../../bin/Resources/srb2.srb; sourceTree = SOURCE_ROOT; };
-		6766C0AE11B057E50065F389 /* zones.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = zones.dta; path = ../../../bin/Resources/zones.dta; sourceTree = SOURCE_ROOT; };
-		676BB51C0E0DE06100C95963 /* m_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_queue.c; path = ../../m_queue.c; sourceTree = SOURCE_ROOT; };
-		676BB51D0E0DE06100C95963 /* m_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_queue.h; path = ../../m_queue.h; sourceTree = SOURCE_ROOT; };
-		676BB51E0E0DE06100C95963 /* p_polyobj.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = p_polyobj.c; path = ../../p_polyobj.c; sourceTree = SOURCE_ROOT; };
-		676BB51F0E0DE06100C95963 /* p_polyobj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = p_polyobj.h; path = ../../p_polyobj.h; sourceTree = SOURCE_ROOT; };
-		67A1F91813FAD026009FA3E5 /* player.dta */ = {isa = PBXFileReference; lastKnownFileType = text; name = player.dta; path = ../../../bin/Resources/player.dta; sourceTree = SOURCE_ROOT; };
-		67B2071C1180FA8200E93654 /* vid_copy.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = vid_copy.s; path = ../../vid_copy.s; sourceTree = SOURCE_ROOT; };
-		67B83BCB14F57EAB00AAAE4E /* lapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lapi.c; path = ../../blua/lapi.c; sourceTree = SOURCE_ROOT; };
-		67B83BCC14F57EAB00AAAE4E /* lapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lapi.h; path = ../../blua/lapi.h; sourceTree = SOURCE_ROOT; };
-		67B83BCD14F57EAB00AAAE4E /* lauxlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lauxlib.c; path = ../../blua/lauxlib.c; sourceTree = SOURCE_ROOT; };
-		67B83BCE14F57EAB00AAAE4E /* lauxlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lauxlib.h; path = ../../blua/lauxlib.h; sourceTree = SOURCE_ROOT; };
-		67B83BCF14F57EAB00AAAE4E /* lbaselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lbaselib.c; path = ../../blua/lbaselib.c; sourceTree = SOURCE_ROOT; };
-		67B83BD014F57EAB00AAAE4E /* lcode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lcode.c; path = ../../blua/lcode.c; sourceTree = SOURCE_ROOT; };
-		67B83BD114F57EAB00AAAE4E /* lcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lcode.h; path = ../../blua/lcode.h; sourceTree = SOURCE_ROOT; };
-		67B83BD214F57EAB00AAAE4E /* ldebug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldebug.c; path = ../../blua/ldebug.c; sourceTree = SOURCE_ROOT; };
-		67B83BD314F57EAB00AAAE4E /* ldebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldebug.h; path = ../../blua/ldebug.h; sourceTree = SOURCE_ROOT; };
-		67B83BD414F57EAB00AAAE4E /* ldo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldo.c; path = ../../blua/ldo.c; sourceTree = SOURCE_ROOT; };
-		67B83BD514F57EAB00AAAE4E /* ldo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ldo.h; path = ../../blua/ldo.h; sourceTree = SOURCE_ROOT; };
-		67B83BD614F57EAB00AAAE4E /* ldump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ldump.c; path = ../../blua/ldump.c; sourceTree = SOURCE_ROOT; };
-		67B83BD714F57EAB00AAAE4E /* lfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lfunc.c; path = ../../blua/lfunc.c; sourceTree = SOURCE_ROOT; };
-		67B83BD814F57EAB00AAAE4E /* lfunc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lfunc.h; path = ../../blua/lfunc.h; sourceTree = SOURCE_ROOT; };
-		67B83BD914F57EAB00AAAE4E /* lgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lgc.c; path = ../../blua/lgc.c; sourceTree = SOURCE_ROOT; };
-		67B83BDA14F57EAB00AAAE4E /* lgc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lgc.h; path = ../../blua/lgc.h; sourceTree = SOURCE_ROOT; };
-		67B83BDB14F57EAB00AAAE4E /* linit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linit.c; path = ../../blua/linit.c; sourceTree = SOURCE_ROOT; };
-		67B83BDC14F57EAB00AAAE4E /* llex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = llex.c; path = ../../blua/llex.c; sourceTree = SOURCE_ROOT; };
-		67B83BDD14F57EAB00AAAE4E /* llex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llex.h; path = ../../blua/llex.h; sourceTree = SOURCE_ROOT; };
-		67B83BDE14F57EAB00AAAE4E /* llimits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = llimits.h; path = ../../blua/llimits.h; sourceTree = SOURCE_ROOT; };
-		67B83BDF14F57EAB00AAAE4E /* lmem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lmem.c; path = ../../blua/lmem.c; sourceTree = SOURCE_ROOT; };
-		67B83BE014F57EAB00AAAE4E /* lmem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lmem.h; path = ../../blua/lmem.h; sourceTree = SOURCE_ROOT; };
-		67B83BE114F57EAB00AAAE4E /* lobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lobject.c; path = ../../blua/lobject.c; sourceTree = SOURCE_ROOT; };
-		67B83BE214F57EAB00AAAE4E /* lobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lobject.h; path = ../../blua/lobject.h; sourceTree = SOURCE_ROOT; };
-		67B83BE314F57EAB00AAAE4E /* lopcodes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lopcodes.c; path = ../../blua/lopcodes.c; sourceTree = SOURCE_ROOT; };
-		67B83BE414F57EAB00AAAE4E /* lopcodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lopcodes.h; path = ../../blua/lopcodes.h; sourceTree = SOURCE_ROOT; };
-		67B83BE514F57EAB00AAAE4E /* lparser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lparser.c; path = ../../blua/lparser.c; sourceTree = SOURCE_ROOT; };
-		67B83BE614F57EAB00AAAE4E /* lparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lparser.h; path = ../../blua/lparser.h; sourceTree = SOURCE_ROOT; };
-		67B83BE714F57EAB00AAAE4E /* lstate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstate.c; path = ../../blua/lstate.c; sourceTree = SOURCE_ROOT; };
-		67B83BE814F57EAB00AAAE4E /* lstate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstate.h; path = ../../blua/lstate.h; sourceTree = SOURCE_ROOT; };
-		67B83BE914F57EAB00AAAE4E /* lstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstring.c; path = ../../blua/lstring.c; sourceTree = SOURCE_ROOT; };
-		67B83BEA14F57EAB00AAAE4E /* lstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lstring.h; path = ../../blua/lstring.h; sourceTree = SOURCE_ROOT; };
-		67B83BEB14F57EAB00AAAE4E /* lstrlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lstrlib.c; path = ../../blua/lstrlib.c; sourceTree = SOURCE_ROOT; };
-		67B83BEC14F57EAB00AAAE4E /* ltable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltable.c; path = ../../blua/ltable.c; sourceTree = SOURCE_ROOT; };
-		67B83BED14F57EAB00AAAE4E /* ltable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltable.h; path = ../../blua/ltable.h; sourceTree = SOURCE_ROOT; };
-		67B83BEE14F57EAB00AAAE4E /* ltablib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltablib.c; path = ../../blua/ltablib.c; sourceTree = SOURCE_ROOT; };
-		67B83BEF14F57EAB00AAAE4E /* ltm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ltm.c; path = ../../blua/ltm.c; sourceTree = SOURCE_ROOT; };
-		67B83BF014F57EAB00AAAE4E /* ltm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ltm.h; path = ../../blua/ltm.h; sourceTree = SOURCE_ROOT; };
-		67B83BF114F57EAB00AAAE4E /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua.h; path = ../../blua/lua.h; sourceTree = SOURCE_ROOT; };
-		67B83BF214F57EAB00AAAE4E /* luaconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = luaconf.h; path = ../../blua/luaconf.h; sourceTree = SOURCE_ROOT; };
-		67B83BF314F57EAB00AAAE4E /* lualib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lualib.h; path = ../../blua/lualib.h; sourceTree = SOURCE_ROOT; };
-		67B83BF414F57EAB00AAAE4E /* lundump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lundump.c; path = ../../blua/lundump.c; sourceTree = SOURCE_ROOT; };
-		67B83BF514F57EAB00AAAE4E /* lundump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lundump.h; path = ../../blua/lundump.h; sourceTree = SOURCE_ROOT; };
-		67B83BF614F57EAB00AAAE4E /* lvm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lvm.c; path = ../../blua/lvm.c; sourceTree = SOURCE_ROOT; };
-		67B83BF714F57EAB00AAAE4E /* lvm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lvm.h; path = ../../blua/lvm.h; sourceTree = SOURCE_ROOT; };
-		67B83BF814F57EAB00AAAE4E /* lzio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lzio.c; path = ../../blua/lzio.c; sourceTree = SOURCE_ROOT; };
-		67B83BF914F57EAB00AAAE4E /* lzio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lzio.h; path = ../../blua/lzio.h; sourceTree = SOURCE_ROOT; };
-		67B83C1214F57ECA00AAAE4E /* b_bot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = b_bot.c; path = ../../b_bot.c; sourceTree = SOURCE_ROOT; };
-		67B83C1314F57ECA00AAAE4E /* b_bot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = b_bot.h; path = ../../b_bot.h; sourceTree = SOURCE_ROOT; };
-		67B83C1514F57EE600AAAE4E /* lua_baselib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_baselib.c; path = ../../lua_baselib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1614F57EE600AAAE4E /* lua_consolelib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_consolelib.c; path = ../../lua_consolelib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1714F57EE600AAAE4E /* lua_hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_hook.h; path = ../../lua_hook.h; sourceTree = SOURCE_ROOT; };
-		67B83C1814F57EE600AAAE4E /* lua_hooklib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_hooklib.c; path = ../../lua_hooklib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1914F57EE600AAAE4E /* lua_infolib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_infolib.c; path = ../../lua_infolib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1A14F57EE600AAAE4E /* lua_libs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_libs.h; path = ../../lua_libs.h; sourceTree = SOURCE_ROOT; };
-		67B83C1B14F57EE600AAAE4E /* lua_maplib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_maplib.c; path = ../../lua_maplib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_mathlib.c; path = ../../lua_mathlib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_mobjlib.c; path = ../../lua_mobjlib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_playerlib.c; path = ../../lua_playerlib.c; sourceTree = SOURCE_ROOT; };
-		67B83C1F14F57EE600AAAE4E /* lua_script.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_script.c; path = ../../lua_script.c; sourceTree = SOURCE_ROOT; };
-		67B83C2014F57EE600AAAE4E /* lua_script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_script.h; path = ../../lua_script.h; sourceTree = SOURCE_ROOT; };
-		67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lua_thinkerlib.c; path = ../../lua_thinkerlib.c; sourceTree = SOURCE_ROOT; };
-		67B83C2C14F57F1500AAAE4E /* fastcmp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fastcmp.h; path = ../../fastcmp.h; sourceTree = SOURCE_ROOT; };
-		67B83C2D14F57F1500AAAE4E /* i_addrinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = i_addrinfo.c; path = ../../i_addrinfo.c; sourceTree = SOURCE_ROOT; };
-		67B83C2E14F57F1500AAAE4E /* i_addrinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = i_addrinfo.h; path = ../../i_addrinfo.h; sourceTree = SOURCE_ROOT; };
-		67B83C2F14F57F1500AAAE4E /* m_cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = m_cond.c; path = ../../m_cond.c; sourceTree = SOURCE_ROOT; };
-		67B83C3014F57F1500AAAE4E /* m_cond.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_cond.h; path = ../../m_cond.h; sourceTree = SOURCE_ROOT; };
-		67B83C3114F57F1500AAAE4E /* m_dllist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = m_dllist.h; path = ../../m_dllist.h; sourceTree = SOURCE_ROOT; };
-		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
-		8D1107320486CEB800E47090 /* Srb2mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Srb2mac.app; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-		8D11072E0486CEB800E47090 /* Frameworks */ = {
-			isa = PBXFrameworksBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				002F39FA09D0881F00EBEB88 /* SDL.framework in Frameworks */,
-				8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
-				1E66921C0B690C5B00B7313A /* SDL_mixer.framework in Frameworks */,
-				1E32C4290B6E6D5D0029E058 /* libpng.framework in Frameworks */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-		080E96DDFE201D6D7F000001 /* Classes */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AE890B67CC4E00BAD059 /* A_Asm */,
-				67B83BCA14F57DD400AAAE4E /* B_Bot */,
-				67B83BC914F57D7F00AAAE4E /* BLUA */,
-				1E44AE8C0B67CC6500BAD059 /* D_Doom */,
-				1E44AEBB0B67CC9800BAD059 /* F_Frame */,
-				1E44AEC20B67CCB500BAD059 /* G_Game */,
-				1E44AECD0B67CCD200BAD059 /* H_Hud */,
-				1E44AE5C0B67CC0F00BAD059 /* Hw_Hardware */,
-				1E44AED20B67CCF600BAD059 /* I_Interface */,
-				67B83BC814F57D6E00AAAE4E /* LUA */,
-				1E44AEF70B67CDA900BAD059 /* M_Misc */,
-				1E44AF160B67CDFB00BAD059 /* P_Play */,
-				1E44AF540B67CE8C00BAD059 /* R_Render */,
-				1E44AF830B67CEC900BAD059 /* S_Sound */,
-				1E44AF170B67CE1000BAD059 /* W_Wad */,
-			);
-			name = Classes;
-			sourceTree = "<group>";
-		};
-		1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				1E32C4140B6E6D5D0029E058 /* libpng.framework */,
-				1E66921B0B690C5B00B7313A /* SDL_mixer.framework */,
-				002F39F909D0881F00EBEB88 /* SDL.framework */,
-				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
-			);
-			name = "Linked Frameworks";
-			sourceTree = "<group>";
-		};
-		1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				29B97324FDCFA39411CA2CEA /* AppKit.framework */,
-				29B97325FDCFA39411CA2CEA /* Foundation.framework */,
-			);
-			name = "Other Frameworks";
-			sourceTree = "<group>";
-		};
-		19C28FACFE9D520D11CA2CBB /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				8D1107320486CEB800E47090 /* Srb2mac.app */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
-		1E44AE5C0B67CC0F00BAD059 /* Hw_Hardware */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AE600B67CC2B00BAD059 /* hw3dsdrv.h */,
-				1E44AE610B67CC2B00BAD059 /* hw_bsp.c */,
-				1E44AE620B67CC2B00BAD059 /* hw_defs.h */,
-				1E44AE630B67CC2B00BAD059 /* hw3sound.c */,
-				1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
-				1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
-				1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
-				1E44AE670B67CC2B00BAD059 /* hw_glide.h */,
-				1E44AE680B67CC2B00BAD059 /* hw_light.c */,
-				1E44AE690B67CC2B00BAD059 /* hw_light.h */,
-				1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
-				1E44AE6B0B67CC2B00BAD059 /* hw_data.h */,
-				1E44AE6C0B67CC2B00BAD059 /* hw_draw.c */,
-				1E44AE6D0B67CC2B00BAD059 /* hw_glob.h */,
-				1E44AE6E0B67CC2B00BAD059 /* hw_main.c */,
-				1E44AE6F0B67CC2B00BAD059 /* hw_main.h */,
-				1E44AE700B67CC2B00BAD059 /* hw_md2.c */,
-				1E44AE710B67CC2B00BAD059 /* hw_md2.h */,
-				1E44AE720B67CC2B00BAD059 /* hw_trick.c */,
-				1E44AE730B67CC2B00BAD059 /* hws_data.h */,
-			);
-			name = Hw_Hardware;
-			sourceTree = "<group>";
-		};
-		1E44AE890B67CC4E00BAD059 /* A_Asm */ = {
-			isa = PBXGroup;
-			children = (
-				67B2071C1180FA8200E93654 /* vid_copy.s */,
-				1E44AE8A0B67CC6000BAD059 /* asm_defs.inc */,
-				1E44AF9D0B67CF3D00BAD059 /* tmap.nas */,
-				1E44AF9F0B67CF4900BAD059 /* tmap_mmx.nas */,
-				1E44AFA00B67CF4900BAD059 /* tmap_vc.nas */,
-			);
-			name = A_Asm;
-			sourceTree = "<group>";
-		};
-		1E44AE8C0B67CC6500BAD059 /* D_Doom */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AEEB0B67CD4400BAD059 /* comptime.c */,
-				1E44AE8D0B67CC8400BAD059 /* d_clisrv.c */,
-				1E44AE8E0B67CC8400BAD059 /* d_clisrv.h */,
-				1E44AE8F0B67CC8400BAD059 /* d_event.h */,
-				1E44AE900B67CC8400BAD059 /* d_main.c */,
-				1E44AE910B67CC8500BAD059 /* d_net.c */,
-				1E44AE920B67CC8500BAD059 /* d_net.h */,
-				1E44AE930B67CC8500BAD059 /* d_netcmd.h */,
-				1E44AE940B67CC8500BAD059 /* d_netfil.c */,
-				1E44AE950B67CC8500BAD059 /* d_player.h */,
-				1E44AE960B67CC8500BAD059 /* d_think.h */,
-				1E44AE980B67CC8500BAD059 /* d_netcmd.c */,
-				1E44AE990B67CC8500BAD059 /* d_ticcmd.h */,
-				1E44AE9A0B67CC8500BAD059 /* d_main.h */,
-				1E44AE9B0B67CC8500BAD059 /* d_netfil.h */,
-				1E44AE9C0B67CC8500BAD059 /* dehacked.c */,
-				1E44AE9D0B67CC8500BAD059 /* dehacked.h */,
-				1E44AE9E0B67CC8500BAD059 /* doomdata.h */,
-				1E44AE9F0B67CC8500BAD059 /* doomdef.h */,
-				1E44AEA00B67CC8500BAD059 /* doomstat.h */,
-				1E44AEA10B67CC8500BAD059 /* doomtype.h */,
-				1E44AFAF0B67CF7A00BAD059 /* z_zone.c */,
-				1E44AFB00B67CF7A00BAD059 /* z_zone.h */,
-			);
-			name = D_Doom;
-			sourceTree = "<group>";
-		};
-		1E44AEBB0B67CC9800BAD059 /* F_Frame */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AEBC0B67CCA900BAD059 /* f_wipe.c */,
-				1E44AEBD0B67CCA900BAD059 /* f_finale.c */,
-				1E44AEBE0B67CCA900BAD059 /* f_finale.h */,
-				1E44AFAB0B67CF6F00BAD059 /* y_inter.c */,
-				1E44AFAC0B67CF6F00BAD059 /* y_inter.h */,
-			);
-			name = F_Frame;
-			sourceTree = "<group>";
-		};
-		1E44AEC20B67CCB500BAD059 /* G_Game */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AEC30B67CCC600BAD059 /* g_game.c */,
-				1E44AEC40B67CCC600BAD059 /* g_game.h */,
-				1E44AEC50B67CCC600BAD059 /* g_input.h */,
-				1E44AEC60B67CCC600BAD059 /* g_state.h */,
-				1E44AEC70B67CCC600BAD059 /* g_input.c */,
-			);
-			name = G_Game;
-			sourceTree = "<group>";
-		};
-		1E44AECD0B67CCD200BAD059 /* H_Hud */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AEE10B67CD2B00BAD059 /* am_map.c */,
-				1E44AEE20B67CD2B00BAD059 /* am_map.h */,
-				1E44AEE70B67CD3F00BAD059 /* command.c */,
-				1E44AEE80B67CD3F00BAD059 /* command.h */,
-				1E44AEED0B67CD5400BAD059 /* console.c */,
-				1E44AEEE0B67CD5400BAD059 /* console.h */,
-				1E44AECE0B67CCEE00BAD059 /* hu_stuff.c */,
-				1E44AECF0B67CCEE00BAD059 /* hu_stuff.h */,
-				1E44AF000B67CDE900BAD059 /* m_menu.c */,
-				1E44AF010B67CDE900BAD059 /* m_menu.h */,
-				1E44AF910B67CEFF00BAD059 /* st_stuff.c */,
-				1E44AF920B67CEFF00BAD059 /* st_stuff.h */,
-			);
-			name = H_Hud;
-			sourceTree = "<group>";
-		};
-		1E44AED20B67CCF600BAD059 /* I_Interface */ = {
-			isa = PBXGroup;
-			children = (
-				67259E0218D268F600F02971 /* i_ttf.c */,
-				67259E0318D268F600F02971 /* i_ttf.h */,
-				67259E0418D268F600F02971 /* mixer_sound.c */,
-				67259E0518D268F600F02971 /* sdl_sound.c */,
-				1E44AFB30B67CF8500BAD059 /* SDL */,
-				67B83C2D14F57F1500AAAE4E /* i_addrinfo.c */,
-				67B83C2E14F57F1500AAAE4E /* i_addrinfo.h */,
-				1E44AEE50B67CD3200BAD059 /* byteptr.h */,
-				1E44AEF10B67CD7F00BAD059 /* filesrch.c */,
-				1E44AEF20B67CD7F00BAD059 /* filesrch.h */,
-				1E44AED30B67CD1200BAD059 /* i_net.h */,
-				1E44AED40B67CD1200BAD059 /* i_sound.h */,
-				1E44AED50B67CD1200BAD059 /* i_tcp.c */,
-				1E44AED60B67CD1200BAD059 /* i_tcp.h */,
-				1E44AED70B67CD1200BAD059 /* i_system.h */,
-				1E44AED80B67CD1200BAD059 /* i_video.h */,
-				1E44AED90B67CD1300BAD059 /* i_joy.h */,
-				1E44AEF50B67CD9F00BAD059 /* keys.h */,
-				1E44AF200B67CE4100BAD059 /* mserv.c */,
-				1E44AF210B67CE4100BAD059 /* mserv.h */,
-			);
-			name = I_Interface;
-			sourceTree = "<group>";
-		};
-		1E44AEF70B67CDA900BAD059 /* M_Misc */ = {
-			isa = PBXGroup;
-			children = (
-				67259DFF18D268AE00F02971 /* m_anigif.c */,
-				67259E0018D268AE00F02971 /* m_anigif.h */,
-				1E44AEF80B67CDE900BAD059 /* m_argv.c */,
-				1E44AEFA0B67CDE900BAD059 /* m_argv.h */,
-				1E44AEFC0B67CDE900BAD059 /* m_bbox.c */,
-				1E44AEF90B67CDE900BAD059 /* m_bbox.h */,
-				1E44AEFB0B67CDE900BAD059 /* m_cheat.c */,
-				1E44AEFD0B67CDE900BAD059 /* m_cheat.h */,
-				67B83C2F14F57F1500AAAE4E /* m_cond.c */,
-				67B83C3014F57F1500AAAE4E /* m_cond.h */,
-				67B83C3114F57F1500AAAE4E /* m_dllist.h */,
-				1E44AEFE0B67CDE900BAD059 /* m_fixed.c */,
-				1E44AEFF0B67CDE900BAD059 /* m_fixed.h */,
-				1E44AF020B67CDE900BAD059 /* m_misc.c */,
-				1E44AF030B67CDE900BAD059 /* m_misc.h */,
-				676BB51C0E0DE06100C95963 /* m_queue.c */,
-				676BB51D0E0DE06100C95963 /* m_queue.h */,
-				1E44AF040B67CDE900BAD059 /* m_random.c */,
-				1E44AF050B67CDE900BAD059 /* m_random.h */,
-				1E44AF060B67CDE900BAD059 /* m_swap.h */,
-				1E44AF950B67CF1300BAD059 /* string.c */,
-			);
-			name = M_Misc;
-			sourceTree = "<group>";
-		};
-		1E44AF160B67CDFB00BAD059 /* P_Play */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AF180B67CE2A00BAD059 /* info.c */,
-				1E44AF190B67CE2A00BAD059 /* info.h */,
-				1E44AF3B0B67CE5F00BAD059 /* p_ceilng.c */,
-				1E44AF240B67CE5F00BAD059 /* p_enemy.c */,
-				1E44AF250B67CE5F00BAD059 /* p_inter.c */,
-				1E44AF260B67CE5F00BAD059 /* p_fab.c */,
-				1E44AF270B67CE5F00BAD059 /* p_lights.c */,
-				1E44AF280B67CE5F00BAD059 /* p_map.c */,
-				1E44AF290B67CE5F00BAD059 /* p_maputl.c */,
-				1E44AF2A0B67CE5F00BAD059 /* p_maputl.h */,
-				1E44AF2B0B67CE5F00BAD059 /* p_mobj.c */,
-				1E44AF2C0B67CE5F00BAD059 /* p_mobj.h */,
-				1E44AF2D0B67CE5F00BAD059 /* p_floor.c */,
-				1E44AF2E0B67CE5F00BAD059 /* p_local.h */,
-				676BB51E0E0DE06100C95963 /* p_polyobj.c */,
-				676BB51F0E0DE06100C95963 /* p_polyobj.h */,
-				1E44AF2F0B67CE5F00BAD059 /* p_pspr.h */,
-				1E44AF300B67CE5F00BAD059 /* p_saveg.c */,
-				1E44AF310B67CE5F00BAD059 /* p_saveg.h */,
-				1E44AF320B67CE5F00BAD059 /* p_setup.c */,
-				1E44AF330B67CE5F00BAD059 /* p_setup.h */,
-				1E44AF340B67CE5F00BAD059 /* p_sight.c */,
-				1E44AF350B67CE5F00BAD059 /* p_spec.c */,
-				1E44AF360B67CE5F00BAD059 /* p_spec.h */,
-				1E44AF370B67CE5F00BAD059 /* p_telept.c */,
-				1E44AF380B67CE5F00BAD059 /* p_tick.c */,
-				1E44AF390B67CE5F00BAD059 /* p_tick.h */,
-				1E44AF3A0B67CE5F00BAD059 /* p_user.c */,
-				1E44AF990B67CF2E00BAD059 /* tables.c */,
-				1E44AF9A0B67CF2E00BAD059 /* tables.h */,
-			);
-			name = P_Play;
-			sourceTree = "<group>";
-		};
-		1E44AF170B67CE1000BAD059 /* W_Wad */ = {
-			isa = PBXGroup;
-			children = (
-				1E44B2240B67EADE00BAD059 /* lzf.c */,
-				1E44B2250B67EADE00BAD059 /* lzf.h */,
-				1E44AF1C0B67CE3600BAD059 /* md5.c */,
-				1E44AF1D0B67CE3600BAD059 /* md5.h */,
-				1E44AFA70B67CF6400BAD059 /* w_wad.c */,
-				1E44AFA80B67CF6400BAD059 /* w_wad.h */,
-			);
-			name = W_Wad;
-			sourceTree = "<group>";
-		};
-		1E44AF540B67CE8C00BAD059 /* R_Render */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AF550B67CEC100BAD059 /* r_bsp.c */,
-				1E44AF560B67CEC100BAD059 /* r_bsp.h */,
-				1E44AF570B67CEC100BAD059 /* r_defs.h */,
-				1E44AF580B67CEC100BAD059 /* r_data.c */,
-				1E44AF590B67CEC100BAD059 /* r_draw.c */,
-				1E44AF5A0B67CEC100BAD059 /* r_draw16.c */,
-				1E44AF5B0B67CEC100BAD059 /* r_draw8.c */,
-				1E44AF5C0B67CEC100BAD059 /* r_main.c */,
-				1E44AF5D0B67CEC100BAD059 /* r_main.h */,
-				1E44AF5E0B67CEC100BAD059 /* r_data.h */,
-				1E44AF5F0B67CEC100BAD059 /* r_draw.h */,
-				1E44AF600B67CEC100BAD059 /* r_local.h */,
-				1E44AF610B67CEC100BAD059 /* r_plane.c */,
-				1E44AF620B67CEC100BAD059 /* r_plane.h */,
-				1E44AF630B67CEC100BAD059 /* r_segs.c */,
-				1E44AF640B67CEC100BAD059 /* r_segs.h */,
-				1E44AF650B67CEC200BAD059 /* r_sky.c */,
-				1E44AF660B67CEC200BAD059 /* r_sky.h */,
-				1E44AF670B67CEC200BAD059 /* r_splats.c */,
-				1E44AF680B67CEC200BAD059 /* r_splats.h */,
-				1E44AF690B67CEC200BAD059 /* r_state.h */,
-				1E44AF6A0B67CEC200BAD059 /* r_things.c */,
-				1E44AF6B0B67CEC200BAD059 /* r_things.h */,
-				1E44AF890B67CEE900BAD059 /* screen.c */,
-				1E44AF8A0B67CEE900BAD059 /* screen.h */,
-				1E44AFA30B67CF5D00BAD059 /* v_video.c */,
-				1E44AFA40B67CF5D00BAD059 /* v_video.h */,
-			);
-			name = R_Render;
-			sourceTree = "<group>";
-		};
-		1E44AF830B67CEC900BAD059 /* S_Sound */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AF850B67CEE000BAD059 /* s_sound.c */,
-				1E44AF860B67CEE000BAD059 /* s_sound.h */,
-				1E44AF8D0B67CEF000BAD059 /* sounds.c */,
-				1E44AF8E0B67CEF000BAD059 /* sounds.h */,
-			);
-			name = S_Sound;
-			sourceTree = "<group>";
-		};
-		1E44AFB30B67CF8500BAD059 /* SDL */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AFE50B67D04900BAD059 /* macosx */,
-				1E44AFD40B67D03100BAD059 /* filter */,
-				1E44AFB40B67CFDC00BAD059 /* dosstr.c */,
-				1E44AFB50B67CFDC00BAD059 /* endtxt.c */,
-				1E44AFB60B67CFDC00BAD059 /* endtxt.h */,
-				1E44AFB70B67CFDC00BAD059 /* hwsym_sdl.c */,
-				1E44AFB80B67CFDC00BAD059 /* hwsym_sdl.h */,
-				1E44AFB90B67CFDC00BAD059 /* i_cdmus.c */,
-				1E44AFBA0B67CFDC00BAD059 /* i_main.c */,
-				1E44AFBB0B67CFDC00BAD059 /* i_net.c */,
-				1E44AFBD0B67CFDC00BAD059 /* i_system.c */,
-				1E44AFBE0B67CFDC00BAD059 /* i_video.c */,
-				1E44AFBF0B67CFDC00BAD059 /* IMG_xpm.c */,
-				1E44AFEC0B67D0AB00BAD059 /* r_opengl.c */,
-				1E44AFC00B67CFDC00BAD059 /* ogl_sdl.c */,
-				1E44AFC10B67CFDC00BAD059 /* ogl_sdl.h */,
-				1E44AFC20B67CFDC00BAD059 /* SDL_icon.xpm */,
-				1E44AFC30B67CFDC00BAD059 /* sdlmain.h */,
-			);
-			name = SDL;
-			sourceTree = "<group>";
-		};
-		1E44AFD40B67D03100BAD059 /* filter */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AFD50B67D03100BAD059 /* filters.c */,
-				1E44AFD60B67D03100BAD059 /* filters.h */,
-				1E44AFD70B67D03100BAD059 /* hq2x.c */,
-				1E44AFD80B67D03100BAD059 /* hq2x.h */,
-				1E44AFD90B67D03100BAD059 /* interp.h */,
-				1E44AFDA0B67D03100BAD059 /* lq2x.c */,
-				1E44AFDB0B67D03100BAD059 /* lq2x.h */,
-				1E44AFDC0B67D03100BAD059 /* main.c */,
-			);
-			name = filter;
-			path = ../filter;
-			sourceTree = SOURCE_ROOT;
-		};
-		1E44AFE50B67D04900BAD059 /* macosx */ = {
-			isa = PBXGroup;
-			children = (
-				1E44AFE60B67D06200BAD059 /* mac_alert.h */,
-				1E44AFE70B67D06200BAD059 /* Srb2mac.icns */,
-				1E44AFE80B67D06200BAD059 /* mac_alert.c */,
-				1E44B0560B67D81E00BAD059 /* SDL_macosx_main.h */,
-				1E44B0570B67D81E00BAD059 /* SDL_macosx_main.m */,
-			);
-			name = macosx;
-			sourceTree = "<group>";
-		};
-		29B97314FDCFA39411CA2CEA /* Srb2mac */ = {
-			isa = PBXGroup;
-			children = (
-				080E96DDFE201D6D7F000001 /* Classes */,
-				29B97315FDCFA39411CA2CEA /* Other Sources */,
-				29B97317FDCFA39411CA2CEA /* Resources */,
-				29B97323FDCFA39411CA2CEA /* Frameworks */,
-				19C28FACFE9D520D11CA2CBB /* Products */,
-			);
-			name = Srb2mac;
-			sourceTree = "<group>";
-		};
-		29B97315FDCFA39411CA2CEA /* Other Sources */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			name = "Other Sources";
-			sourceTree = "<group>";
-		};
-		29B97317FDCFA39411CA2CEA /* Resources */ = {
-			isa = PBXGroup;
-			children = (
-				67259E2B18D26D5700F02971 /* patch.dta */,
-				67259E2C18D26D5700F02971 /* rings.dta */,
-				67259E2D18D26D5700F02971 /* srb2.srb */,
-				67A1F91813FAD026009FA3E5 /* player.dta */,
-				6766C0AE11B057E50065F389 /* zones.dta */,
-				1E44AE440B67CBE800BAD059 /* music.dta */,
-				1E44AE4B0B67CBE800BAD059 /* srb2.wad */,
-				8D1107310486CEB800E47090 /* Info.plist */,
-				089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
-			);
-			name = Resources;
-			sourceTree = "<group>";
-		};
-		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
-			isa = PBXGroup;
-			children = (
-				1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
-				1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
-			);
-			name = Frameworks;
-			sourceTree = "<group>";
-		};
-		67B83BC814F57D6E00AAAE4E /* LUA */ = {
-			isa = PBXGroup;
-			children = (
-				67259DFA18D2687D00F02971 /* lua_hud.h */,
-				67259DFB18D2687D00F02971 /* lua_hudlib.c */,
-				67259DFC18D2687D00F02971 /* lua_skinlib.c */,
-				67B83C2C14F57F1500AAAE4E /* fastcmp.h */,
-				67B83C1514F57EE600AAAE4E /* lua_baselib.c */,
-				67B83C1614F57EE600AAAE4E /* lua_consolelib.c */,
-				67B83C1714F57EE600AAAE4E /* lua_hook.h */,
-				67B83C1814F57EE600AAAE4E /* lua_hooklib.c */,
-				67B83C1914F57EE600AAAE4E /* lua_infolib.c */,
-				67B83C1A14F57EE600AAAE4E /* lua_libs.h */,
-				67B83C1B14F57EE600AAAE4E /* lua_maplib.c */,
-				67B83C1C14F57EE600AAAE4E /* lua_mathlib.c */,
-				67B83C1D14F57EE600AAAE4E /* lua_mobjlib.c */,
-				67B83C1E14F57EE600AAAE4E /* lua_playerlib.c */,
-				67B83C1F14F57EE600AAAE4E /* lua_script.c */,
-				67B83C2014F57EE600AAAE4E /* lua_script.h */,
-				67B83C2114F57EE600AAAE4E /* lua_thinkerlib.c */,
-			);
-			name = LUA;
-			sourceTree = "<group>";
-		};
-		67B83BC914F57D7F00AAAE4E /* BLUA */ = {
-			isa = PBXGroup;
-			children = (
-				67B83BCB14F57EAB00AAAE4E /* lapi.c */,
-				67B83BCC14F57EAB00AAAE4E /* lapi.h */,
-				67B83BCD14F57EAB00AAAE4E /* lauxlib.c */,
-				67B83BCE14F57EAB00AAAE4E /* lauxlib.h */,
-				67B83BCF14F57EAB00AAAE4E /* lbaselib.c */,
-				67B83BD014F57EAB00AAAE4E /* lcode.c */,
-				67B83BD114F57EAB00AAAE4E /* lcode.h */,
-				67B83BD214F57EAB00AAAE4E /* ldebug.c */,
-				67B83BD314F57EAB00AAAE4E /* ldebug.h */,
-				67B83BD414F57EAB00AAAE4E /* ldo.c */,
-				67B83BD514F57EAB00AAAE4E /* ldo.h */,
-				67B83BD614F57EAB00AAAE4E /* ldump.c */,
-				67B83BD714F57EAB00AAAE4E /* lfunc.c */,
-				67B83BD814F57EAB00AAAE4E /* lfunc.h */,
-				67B83BD914F57EAB00AAAE4E /* lgc.c */,
-				67B83BDA14F57EAB00AAAE4E /* lgc.h */,
-				67B83BDB14F57EAB00AAAE4E /* linit.c */,
-				67B83BDC14F57EAB00AAAE4E /* llex.c */,
-				67B83BDD14F57EAB00AAAE4E /* llex.h */,
-				67B83BDE14F57EAB00AAAE4E /* llimits.h */,
-				67B83BDF14F57EAB00AAAE4E /* lmem.c */,
-				67B83BE014F57EAB00AAAE4E /* lmem.h */,
-				67B83BE114F57EAB00AAAE4E /* lobject.c */,
-				67B83BE214F57EAB00AAAE4E /* lobject.h */,
-				67B83BE314F57EAB00AAAE4E /* lopcodes.c */,
-				67B83BE414F57EAB00AAAE4E /* lopcodes.h */,
-				67B83BE514F57EAB00AAAE4E /* lparser.c */,
-				67B83BE614F57EAB00AAAE4E /* lparser.h */,
-				67B83BE714F57EAB00AAAE4E /* lstate.c */,
-				67B83BE814F57EAB00AAAE4E /* lstate.h */,
-				67B83BE914F57EAB00AAAE4E /* lstring.c */,
-				67B83BEA14F57EAB00AAAE4E /* lstring.h */,
-				67B83BEB14F57EAB00AAAE4E /* lstrlib.c */,
-				67B83BEC14F57EAB00AAAE4E /* ltable.c */,
-				67B83BED14F57EAB00AAAE4E /* ltable.h */,
-				67B83BEE14F57EAB00AAAE4E /* ltablib.c */,
-				67B83BEF14F57EAB00AAAE4E /* ltm.c */,
-				67B83BF014F57EAB00AAAE4E /* ltm.h */,
-				67B83BF114F57EAB00AAAE4E /* lua.h */,
-				67B83BF214F57EAB00AAAE4E /* luaconf.h */,
-				67B83BF314F57EAB00AAAE4E /* lualib.h */,
-				67B83BF414F57EAB00AAAE4E /* lundump.c */,
-				67B83BF514F57EAB00AAAE4E /* lundump.h */,
-				67B83BF614F57EAB00AAAE4E /* lvm.c */,
-				67B83BF714F57EAB00AAAE4E /* lvm.h */,
-				67B83BF814F57EAB00AAAE4E /* lzio.c */,
-				67B83BF914F57EAB00AAAE4E /* lzio.h */,
-			);
-			name = BLUA;
-			sourceTree = "<group>";
-		};
-		67B83BCA14F57DD400AAAE4E /* B_Bot */ = {
-			isa = PBXGroup;
-			children = (
-				67B83C1214F57ECA00AAAE4E /* b_bot.c */,
-				67B83C1314F57ECA00AAAE4E /* b_bot.h */,
-			);
-			name = B_Bot;
-			sourceTree = "<group>";
-		};
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
-		8D1107260486CEB800E47090 /* Srb2mac */ = {
-			isa = PBXNativeTarget;
-			buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Srb2mac" */;
-			buildPhases = (
-				8D1107290486CEB800E47090 /* Resources */,
-				677E4CB30E1765500034519D /* Get SCM Info */,
-				8D11072C0486CEB800E47090 /* Sources */,
-				8D11072E0486CEB800E47090 /* Frameworks */,
-				002F39FD09D0883400EBEB88 /* Copy Frameworks into .app bundle */,
-				679B708A102B872300AA9E4C /* Make DMG */,
-			);
-			buildRules = (
-			);
-			dependencies = (
-			);
-			name = Srb2mac;
-			productInstallPath = "$(HOME)/Applications";
-			productName = Srb2mac;
-			productReference = 8D1107320486CEB800E47090 /* Srb2mac.app */;
-			productType = "com.apple.product-type.application";
-		};
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-		29B97313FDCFA39411CA2CEA /* Project object */ = {
-			isa = PBXProject;
-			buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Srb2mac" */;
-			compatibilityVersion = "Xcode 2.4";
-			hasScannedForEncodings = 1;
-			mainGroup = 29B97314FDCFA39411CA2CEA /* Srb2mac */;
-			projectDirPath = "";
-			projectRoot = ../../..;
-			targets = (
-				8D1107260486CEB800E47090 /* Srb2mac */,
-			);
-		};
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
-		8D1107290486CEB800E47090 /* Resources */ = {
-			isa = PBXResourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
-				1E44AFEA0B67D06200BAD059 /* Srb2mac.icns in Resources */,
-				67259E2E18D26D5700F02971 /* patch.dta in Resources */,
-				67259E2F18D26D5700F02971 /* rings.dta in Resources */,
-				67259E3018D26D5700F02971 /* srb2.srb in Resources */,
-				67259E3218D26DD200F02971 /* music.dta in Resources */,
-				67259E3318D26DD300F02971 /* player.dta in Resources */,
-				67259E3518D26DD500F02971 /* zones.dta in Resources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXShellScriptBuildPhase section */
-		677E4CB30E1765500034519D /* Get SCM Info */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			comments = "update the time and date stamps in src/comptime.c";
-			files = (
-			);
-			inputPaths = (
-			);
-			name = "Get SCM Info";
-			outputPaths = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "PATH=\"/usr/local/bin:$PATH\" $SRCROOT/../../../comptime.sh $SRCROOT/../../";
-		};
-		679B708A102B872300AA9E4C /* Make DMG */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			comments = "make DMG file for Release builds";
-			files = (
-			);
-			inputPaths = (
-				$BUILT_PRODUCTS_DIR/$WRAPPER_NAME,
-			);
-			name = "Make DMG";
-			outputPaths = (
-				$BUILT_PRODUCTS_DIR/$TARGET_NAME.nodata.dmg,
-				$BUILT_PRODUCTS_DIR/$TARGET_NAME.dmg,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "set -ex\n\n[ \"$ACTION\" = build ] || exit 0\n[ \"$CURRENT_VARIANT\" = \"normal\" ] || exit 0\n[ \"$BUILD_STYLE\" = \"Release\" ] || exit 0\n\ndir=\"$TEMP_FILES_DIR/$TARGET_NAME.disk\"\ndmg=\"$BUILT_PRODUCTS_DIR/$TARGET_NAME.dmg\"\ndmg_nodata=\"$BUILT_PRODUCTS_DIR/$TARGET_NAME.nodata.dmg\"\n\nrm -rf -- \"$dir\"\nmkdir \"$dir\"\ncp -R \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME\" \"$dir\"\nrm -f -- \"$dmg\"\nhdiutil create -ov -fs HFS+ -srcfolder \"$dir\" -volname \"$TARGET_NAME\" \"$dmg\"\nhdiutil internet-enable -yes \"$dmg\"\ncd \"$dir/$WRAPPER_NAME/Contents/Resources\"\nrm -f -- *.wad\nrm -f -- *.dta\nrm -f -- *.plr\nrm -f -- *.wpn\nrm -f -- *.srb2\ncd \"$OLDPWD\"\nrm -f -- \"$dmg_nodata\"\nhdiutil create -ov -fs HFS+ -srcfolder \"$dir\" -volname \"$TARGET_NAME Lite\" \"$dmg_nodata\"\nhdiutil internet-enable -yes \"$dmg_nodata\"\nrm -rf -- \"$dir\"";
-		};
-/* End PBXShellScriptBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
-		8D11072C0486CEB800E47090 /* Sources */ = {
-			isa = PBXSourcesBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-				1E44AE750B67CC2B00BAD059 /* hw_bsp.c in Sources */,
-				1E44AE770B67CC2B00BAD059 /* hw3sound.c in Sources */,
-				1E44AE780B67CC2B00BAD059 /* hw_cache.c in Sources */,
-				1E44AE7C0B67CC2B00BAD059 /* hw_light.c in Sources */,
-				1E44AE800B67CC2B00BAD059 /* hw_draw.c in Sources */,
-				1E44AE820B67CC2B00BAD059 /* hw_main.c in Sources */,
-				1E44AE840B67CC2B00BAD059 /* hw_md2.c in Sources */,
-				1E44AE860B67CC2B00BAD059 /* hw_trick.c in Sources */,
-				1E44AEA40B67CC8500BAD059 /* d_clisrv.c in Sources */,
-				1E44AEA70B67CC8500BAD059 /* d_main.c in Sources */,
-				1E44AEA80B67CC8500BAD059 /* d_net.c in Sources */,
-				1E44AEAB0B67CC8500BAD059 /* d_netfil.c in Sources */,
-				1E44AEAF0B67CC8500BAD059 /* d_netcmd.c in Sources */,
-				1E44AEB30B67CC8500BAD059 /* dehacked.c in Sources */,
-				1E44AEBF0B67CCA900BAD059 /* f_wipe.c in Sources */,
-				1E44AEC00B67CCA900BAD059 /* f_finale.c in Sources */,
-				1E44AEC80B67CCC600BAD059 /* g_game.c in Sources */,
-				1E44AECC0B67CCC600BAD059 /* g_input.c in Sources */,
-				1E44AED00B67CCEE00BAD059 /* hu_stuff.c in Sources */,
-				1E44AEDC0B67CD1300BAD059 /* i_tcp.c in Sources */,
-				1E44AEE30B67CD2B00BAD059 /* am_map.c in Sources */,
-				1E44AEE90B67CD3F00BAD059 /* command.c in Sources */,
-				1E44AEEC0B67CD4400BAD059 /* comptime.c in Sources */,
-				1E44AEEF0B67CD5400BAD059 /* console.c in Sources */,
-				1E44AEF30B67CD7F00BAD059 /* filesrch.c in Sources */,
-				1E44AF070B67CDE900BAD059 /* m_argv.c in Sources */,
-				1E44AF0A0B67CDE900BAD059 /* m_cheat.c in Sources */,
-				1E44AF0B0B67CDE900BAD059 /* m_bbox.c in Sources */,
-				1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */,
-				1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */,
-				1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */,
-				1E44AF130B67CDE900BAD059 /* m_random.c in Sources */,
-				1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */,
-				1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */,
-				1E44AF220B67CE4100BAD059 /* mserv.c in Sources */,
-				1E44AF3C0B67CE5F00BAD059 /* p_enemy.c in Sources */,
-				1E44AF3D0B67CE5F00BAD059 /* p_inter.c in Sources */,
-				1E44AF3E0B67CE5F00BAD059 /* p_fab.c in Sources */,
-				1E44AF3F0B67CE5F00BAD059 /* p_lights.c in Sources */,
-				1E44AF400B67CE5F00BAD059 /* p_map.c in Sources */,
-				1E44AF410B67CE5F00BAD059 /* p_maputl.c in Sources */,
-				1E44AF430B67CE5F00BAD059 /* p_mobj.c in Sources */,
-				1E44AF450B67CE5F00BAD059 /* p_floor.c in Sources */,
-				1E44AF480B67CE5F00BAD059 /* p_saveg.c in Sources */,
-				1E44AF4A0B67CE5F00BAD059 /* p_setup.c in Sources */,
-				1E44AF4C0B67CE5F00BAD059 /* p_sight.c in Sources */,
-				1E44AF4D0B67CE5F00BAD059 /* p_spec.c in Sources */,
-				1E44AF4F0B67CE5F00BAD059 /* p_telept.c in Sources */,
-				1E44AF500B67CE5F00BAD059 /* p_tick.c in Sources */,
-				1E44AF520B67CE5F00BAD059 /* p_user.c in Sources */,
-				1E44AF530B67CE5F00BAD059 /* p_ceilng.c in Sources */,
-				1E44AF6C0B67CEC200BAD059 /* r_bsp.c in Sources */,
-				1E44AF6F0B67CEC200BAD059 /* r_data.c in Sources */,
-				1E44AF700B67CEC200BAD059 /* r_draw.c in Sources */,
-				1E44AF730B67CEC200BAD059 /* r_main.c in Sources */,
-				1E44AF780B67CEC200BAD059 /* r_plane.c in Sources */,
-				1E44AF7A0B67CEC200BAD059 /* r_segs.c in Sources */,
-				1E44AF7C0B67CEC200BAD059 /* r_sky.c in Sources */,
-				1E44AF7E0B67CEC200BAD059 /* r_splats.c in Sources */,
-				1E44AF810B67CEC200BAD059 /* r_things.c in Sources */,
-				1E44AF870B67CEE000BAD059 /* s_sound.c in Sources */,
-				1E44AF8B0B67CEE900BAD059 /* screen.c in Sources */,
-				1E44AF8F0B67CEF000BAD059 /* sounds.c in Sources */,
-				1E44AF930B67CEFF00BAD059 /* st_stuff.c in Sources */,
-				1E44AF9B0B67CF2E00BAD059 /* tables.c in Sources */,
-				1E44AFA50B67CF5D00BAD059 /* v_video.c in Sources */,
-				1E44AFA90B67CF6400BAD059 /* w_wad.c in Sources */,
-				1E44AFAD0B67CF6F00BAD059 /* y_inter.c in Sources */,
-				1E44AFB10B67CF7A00BAD059 /* z_zone.c in Sources */,
-				1E44AFC40B67CFDC00BAD059 /* dosstr.c in Sources */,
-				1E44AFC50B67CFDC00BAD059 /* endtxt.c in Sources */,
-				1E44AFC70B67CFDC00BAD059 /* hwsym_sdl.c in Sources */,
-				1E44AFC90B67CFDC00BAD059 /* i_cdmus.c in Sources */,
-				1E44AFCA0B67CFDC00BAD059 /* i_main.c in Sources */,
-				1E44AFCB0B67CFDC00BAD059 /* i_net.c in Sources */,
-				1E44AFCD0B67CFDC00BAD059 /* i_system.c in Sources */,
-				1E44AFCE0B67CFDC00BAD059 /* i_video.c in Sources */,
-				1E44AFD00B67CFDC00BAD059 /* ogl_sdl.c in Sources */,
-				1E44AFEB0B67D06200BAD059 /* mac_alert.c in Sources */,
-				1E44AFED0B67D0AB00BAD059 /* r_opengl.c in Sources */,
-				1E44B0590B67D81E00BAD059 /* SDL_macosx_main.m in Sources */,
-				1E308E720B71172D0015728C /* lzf.c in Sources */,
-				676BB5200E0DE06100C95963 /* m_queue.c in Sources */,
-				676BB5220E0DE06100C95963 /* p_polyobj.c in Sources */,
-				67B83BFA14F57EAB00AAAE4E /* lapi.c in Sources */,
-				67B83BFB14F57EAB00AAAE4E /* lauxlib.c in Sources */,
-				67B83BFC14F57EAB00AAAE4E /* lbaselib.c in Sources */,
-				67B83BFD14F57EAB00AAAE4E /* lcode.c in Sources */,
-				67B83BFE14F57EAB00AAAE4E /* ldebug.c in Sources */,
-				67B83BFF14F57EAB00AAAE4E /* ldo.c in Sources */,
-				67B83C0014F57EAB00AAAE4E /* ldump.c in Sources */,
-				67B83C0114F57EAB00AAAE4E /* lfunc.c in Sources */,
-				67B83C0214F57EAB00AAAE4E /* lgc.c in Sources */,
-				67B83C0314F57EAB00AAAE4E /* linit.c in Sources */,
-				67B83C0414F57EAB00AAAE4E /* llex.c in Sources */,
-				67B83C0514F57EAB00AAAE4E /* lmem.c in Sources */,
-				67B83C0614F57EAB00AAAE4E /* lobject.c in Sources */,
-				67B83C0714F57EAB00AAAE4E /* lopcodes.c in Sources */,
-				67B83C0814F57EAB00AAAE4E /* lparser.c in Sources */,
-				67B83C0914F57EAB00AAAE4E /* lstate.c in Sources */,
-				67B83C0A14F57EAB00AAAE4E /* lstring.c in Sources */,
-				67B83C0B14F57EAB00AAAE4E /* lstrlib.c in Sources */,
-				67B83C0C14F57EAB00AAAE4E /* ltable.c in Sources */,
-				67B83C0D14F57EAB00AAAE4E /* ltablib.c in Sources */,
-				67B83C0E14F57EAB00AAAE4E /* ltm.c in Sources */,
-				67B83C0F14F57EAB00AAAE4E /* lundump.c in Sources */,
-				67B83C1014F57EAB00AAAE4E /* lvm.c in Sources */,
-				67B83C1114F57EAB00AAAE4E /* lzio.c in Sources */,
-				67B83C1414F57ECA00AAAE4E /* b_bot.c in Sources */,
-				67B83C2214F57EE600AAAE4E /* lua_baselib.c in Sources */,
-				67B83C2314F57EE600AAAE4E /* lua_consolelib.c in Sources */,
-				67B83C2414F57EE600AAAE4E /* lua_hooklib.c in Sources */,
-				67B83C2514F57EE600AAAE4E /* lua_infolib.c in Sources */,
-				67B83C2614F57EE600AAAE4E /* lua_maplib.c in Sources */,
-				67B83C2714F57EE600AAAE4E /* lua_mathlib.c in Sources */,
-				67B83C2814F57EE600AAAE4E /* lua_mobjlib.c in Sources */,
-				67B83C2914F57EE600AAAE4E /* lua_playerlib.c in Sources */,
-				67B83C2A14F57EE600AAAE4E /* lua_script.c in Sources */,
-				67B83C2B14F57EE600AAAE4E /* lua_thinkerlib.c in Sources */,
-				67B83C3314F57F1500AAAE4E /* m_cond.c in Sources */,
-				67259DFD18D2687D00F02971 /* lua_hudlib.c in Sources */,
-				67259DFE18D2687D00F02971 /* lua_skinlib.c in Sources */,
-				67259E0118D268AE00F02971 /* m_anigif.c in Sources */,
-				67259E0618D268F700F02971 /* i_ttf.c in Sources */,
-				67259E0718D268F700F02971 /* mixer_sound.c in Sources */,
-				67259E0818D268F700F02971 /* sdl_sound.c in Sources */,
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-		};
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
-		089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
-			isa = PBXVariantGroup;
-			children = (
-				089C165DFE840E0CC02AAC07 /* English */,
-			);
-			name = InfoPlist.strings;
-			sourceTree = "<group>";
-		};
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
-		C01FCF4B08A954540054247B /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				CURRENT_PROJECT_VERSION = 2.1.19;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"$(inherited)",
-					NORMALSRB2,
-				);
-				PRODUCT_NAME = Srb2mac;
-			};
-			name = Debug;
-		};
-		C01FCF4C08A954540054247B /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				CURRENT_PROJECT_VERSION = 2.1.19;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					"$(inherited)",
-					NORMALSRB2,
-				);
-				PRODUCT_NAME = Srb2mac;
-			};
-			name = Release;
-		};
-		C01FCF4F08A954540054247B /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = (
-					i386,
-					ppc,
-				);
-				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.0.0;
-				DEBUG_INFORMATION_FORMAT = dwarf;
-				DSTROOT = "$(HOME)/Applications";
-				FRAMEWORK_SEARCH_PATHS = (
-					"$(HOME)/Library/Frameworks",
-					/Library/Frameworks,
-					"$(FRAMEWORK_SEARCH_PATHS)",
-				);
-				GCC_ENABLE_CPP_EXCEPTIONS = NO;
-				GCC_ENABLE_CPP_RTTI = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
-				GCC_ENABLE_PASCAL_STRINGS = NO;
-				GCC_FAST_OBJC_DISPATCH = NO;
-				"GCC_MODEL_TUNING[arch=ppc]" = G3;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					MAC_ALERT,
-					SDLMAIN,
-					HAVE_SDL,
-					HAVE_MIXER,
-					HAVE_PNG,
-					HAVE_BLUA,
-					LUA_USE_POSIX,
-					COMPVERSION,
-				);
-				GCC_THREADSAFE_STATICS = NO;
-				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-				GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-				GCC_VERSION_i386 = 4.0;
-				GCC_VERSION_ppc0 = 3.3;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES;
-				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
-				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES;
-				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-				GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-				GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
-				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-				GCC_WARN_MISSING_PARENTHESES = YES;
-				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
-				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-				GCC_WARN_PEDANTIC = NO;
-				GCC_WARN_PROTOTYPE_CONVERSION = NO;
-				GCC_WARN_SHADOW = NO;
-				GCC_WARN_SIGN_COMPARE = YES;
-				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
-				GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = NO;
-				GCC_WARN_UNKNOWN_PRAGMAS = YES;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = YES;
-				GCC_WARN_UNUSED_VALUE = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				GGG_MODEL_TUNING_ppc = G3;
-				HEADER_SEARCH_PATHS = (
-					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
-					/Library/Frameworks/SDL.framework/Headers,
-					"$(HOME)/Library/Frameworks/SDL_mixer.framework/Headers",
-					/Library/Frameworks/SDL_mixer.framework/Headers,
-					"$(HOME)/Library/Frameworks/libz.framework/Headers",
-					/Library/Frameworks/libz.framework/Headers,
-					"$(HOME)/Library/Frameworks/libpng.framework/Headers",
-					/Library/Frameworks/libpng.framework/Headers,
-					"$(HEADER_SEARCH_PATHS)",
-				);
-				INFOPLIST_FILE = Info.plist;
-				MACH_O_TYPE = mh_execute;
-				MACOSX_DEPLOYMENT_TARGET = 10.4;
-				"MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4;
-				"MACOSX_DEPLOYMENT_TARGET[arch=ppc64]" = 10.5;
-				"MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2;
-				"MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5;
-				MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
-				MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
-				OBJROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)";
-				OTHER_CFLAGS_normal = "-D_DEBUG -DPARANOIA -DRANGECHECK";
-				PREBINDING = NO;
-				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
-				PRODUCT_NAME = SRB2dummy;
-				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
-				"SDKROOT[arch=i386]" = macosx10.4;
-				"SDKROOT[arch=ppc]" = macosx10.3.9;
-				SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
-				SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
-				STRIP_INSTALLED_PRODUCT = NO;
-				SYMROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)";
-				WARNING_CFLAGS = (
-					"-Wall",
-					"-W",
-					"-Wno-undef",
-					"-Wpointer-arith",
-					"-Wbad-function-cast",
-					"-Wno-cast-qual",
-					"-Wcast-align",
-					"-Wwrite-strings",
-					"-Waggregate-return",
-					"-Wmissing-prototypes",
-					"-Wmissing-declarations",
-					"-Wno-missing-noreturn",
-					"-Wnested-externs",
-					"-Winline",
-				);
-				WRAPPER_EXTENSION = app;
-			};
-			name = Debug;
-		};
-		C01FCF5008A954540054247B /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				ARCHS = (
-					i386,
-					ppc,
-				);
-				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.0.0;
-				DSTROOT = "$(HOME)/Applications";
-				FRAMEWORK_SEARCH_PATHS = (
-					"$(HOME)/Library/Frameworks",
-					/Library/Frameworks,
-					"$(FRAMEWORK_SEARCH_PATHS)",
-				);
-				GCC_ENABLE_CPP_EXCEPTIONS = NO;
-				GCC_ENABLE_CPP_RTTI = NO;
-				GCC_ENABLE_OBJC_EXCEPTIONS = NO;
-				GCC_ENABLE_PASCAL_STRINGS = NO;
-				GCC_FAST_OBJC_DISPATCH = NO;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
-				"GCC_MODEL_TUNING[arch=ppc]" = G3;
-				GCC_OPTIMIZATION_LEVEL = 2;
-				GCC_PREPROCESSOR_DEFINITIONS = (
-					MAC_ALERT,
-					SDLMAIN,
-					HAVE_SDL,
-					HAVE_MIXER,
-					HAVE_PNG,
-					HAVE_BLUA,
-					LUA_USE_POSIX,
-					COMPVERSION,
-				);
-				GCC_THREADSAFE_STATICS = NO;
-				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
-				GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
-				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-				GCC_VERSION_i386 = 4.0;
-				GCC_VERSION_ppc0 = 3.3;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-				GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES;
-				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
-				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-				GCC_WARN_ABOUT_RETURN_TYPE = YES;
-				GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES;
-				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
-				GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
-				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
-				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
-				GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
-				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
-				GCC_WARN_MISSING_PARENTHESES = YES;
-				GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
-				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
-				GCC_WARN_PEDANTIC = NO;
-				GCC_WARN_PROTOTYPE_CONVERSION = NO;
-				GCC_WARN_SHADOW = NO;
-				GCC_WARN_SIGN_COMPARE = YES;
-				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
-				GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = YES;
-				GCC_WARN_UNKNOWN_PRAGMAS = YES;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = YES;
-				GCC_WARN_UNUSED_VALUE = YES;
-				GCC_WARN_UNUSED_VARIABLE = YES;
-				GGG_MODEL_TUNING_ppc = G3;
-				HEADER_SEARCH_PATHS = (
-					"$(HOME)/Library/Frameworks/SDL.framework/Headers",
-					/Library/Frameworks/SDL.framework/Headers,
-					"$(HOME)/Library/Frameworks/SDL_mixer.framework/Headers",
-					/Library/Frameworks/SDL_mixer.framework/Headers,
-					"$(HOME)/Library/Frameworks/libz.framework/Headers",
-					/Library/Frameworks/libz.framework/Headers,
-					"$(HOME)/Library/Frameworks/libpng.framework/Headers",
-					/Library/Frameworks/libpng.framework/Headers,
-					"$(HEADER_SEARCH_PATHS)",
-				);
-				INFOPLIST_FILE = Info.plist;
-				MACH_O_TYPE = mh_execute;
-				MACOSX_DEPLOYMENT_TARGET = 10.4;
-				"MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4;
-				"MACOSX_DEPLOYMENT_TARGET[arch=ppc64]" = 10.5;
-				"MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2;
-				"MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.5;
-				MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
-				MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
-				OBJROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)";
-				OTHER_CFLAGS_normal = "-DNDEBUG";
-				PREBINDING = NO;
-				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
-				PRODUCT_NAME = SRB2dummy;
-				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
-				"SDKROOT[arch=i386]" = macosx10.4;
-				"SDKROOT[arch=ppc]" = macosx10.3.9;
-				SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
-				SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
-				STRIP_INSTALLED_PRODUCT = NO;
-				SYMROOT = "$(inherited)/$(PRODUCT_NAME)/$(CURRENT_PROJECT_VERSION)";
-				WARNING_CFLAGS = (
-					"-Wall",
-					"-W",
-					"-Wno-undef",
-					"-Wpointer-arith",
-					"-Wbad-function-cast",
-					"-Wno-cast-qual",
-					"-Wcast-align",
-					"-Wwrite-strings",
-					"-Waggregate-return",
-					"-Wmissing-prototypes",
-					"-Wmissing-declarations",
-					"-Wno-missing-noreturn",
-					"-Wnested-externs",
-					"-Winline",
-					"-Wno-aggregate-return",
-				);
-				WRAPPER_EXTENSION = app;
-			};
-			name = Release;
-		};
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-		C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Srb2mac" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				C01FCF4B08A954540054247B /* Debug */,
-				C01FCF4C08A954540054247B /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Debug;
-		};
-		C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Srb2mac" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				C01FCF4F08A954540054247B /* Debug */,
-				C01FCF5008A954540054247B /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Debug;
-		};
-/* End XCConfigurationList section */
-	};
-	rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
diff --git a/src/sdl12/macosx/mac_alert.c b/src/sdl12/macosx/mac_alert.c
deleted file mode 100644
index 455e36509547e40af0a4a65f13f0e5517fb5dc24..0000000000000000000000000000000000000000
--- a/src/sdl12/macosx/mac_alert.c
+++ /dev/null
@@ -1,45 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Graphical Alerts for MacOSX
-///
-///	Shows alerts, since we can't just print these to the screen when
-///	launched graphically on a mac.
-
-#ifdef __APPLE_CC__
-
-#include "mac_alert.h"
-#include <CoreFoundation/CoreFoundation.h>
-
-int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3)
-{
-	CFOptionFlags results;
-
-	CFUserNotificationDisplayAlert(0,
-	 kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag,
-	 NULL, NULL, NULL,
-	 CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII),
-	 CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII),
-	 button1 != NULL ? CFStringCreateWithCString(NULL, button1, kCFStringEncodingASCII) : NULL,
-	 button2 != NULL ? CFStringCreateWithCString(NULL, button2, kCFStringEncodingASCII) : NULL,
-	 button3 != NULL ? CFStringCreateWithCString(NULL, button3, kCFStringEncodingASCII) : NULL,
-	 &results);
-
-	return (int)results;
-}
-
-#endif
diff --git a/src/sdl12/macosx/mac_alert.h b/src/sdl12/macosx/mac_alert.h
deleted file mode 100644
index 82a28d12023bcc1fe5954359c6a466306ca85a88..0000000000000000000000000000000000000000
--- a/src/sdl12/macosx/mac_alert.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Graphical Alerts for MacOSX
-///
-///	Shows alerts, since we can't just print these to the screen when
-///	launched graphically on a mac.
-
-#ifdef __APPLE_CC__
-
-extern int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3);
-
-#endif
diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c
deleted file mode 100644
index 542a6716989793b0b3452a9825ef190ea95e585b..0000000000000000000000000000000000000000
--- a/src/sdl12/mixer_sound.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/// \file
-/// \brief SDL Mixer interface for sound
-
-#include "../doomdef.h"
-
-#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
-
-#include "../sounds.h"
-#include "../s_sound.h"
-#include "../i_sound.h"
-#include "../w_wad.h"
-#include "../z_zone.h"
-#include "../byteptr.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-#include "SDL.h"
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#include "SDL_mixer.h"
-
-/* This is the version number macro for the current SDL_mixer version: */
-#ifndef SDL_MIXER_COMPILEDVERSION
-#define SDL_MIXER_COMPILEDVERSION \
-	SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL)
-#endif
-
-/* This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z */
-#ifndef SDL_MIXER_VERSION_ATLEAST
-#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-#endif
-
-#ifdef HAVE_LIBGME
-#include "gme/gme.h"
-#define GME_TREBLE 5.0
-#define GME_BASS 1.0
-#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng
-
-#define HAVE_ZLIB
-
-#ifndef _MSC_VER
-#ifndef _WII
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
-#endif
-#endif
-#endif
-
-#ifndef _LFS64_LARGEFILE
-#define _LFS64_LARGEFILE
-#endif
-
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 0
-#endif
-
-#include "zlib.h"
-#endif
-#endif
-
-UINT8 sound_started = false;
-
-static boolean midimode;
-static Mix_Music *music;
-static UINT8 music_volume, midi_volume, sfx_volume;
-static float loop_point;
-
-#ifdef HAVE_LIBGME
-static Music_Emu *gme;
-static INT32 current_track;
-#endif
-
-void I_StartupSound(void)
-{
-	I_Assert(!sound_started);
-	sound_started = true;
-
-	midimode = false;
-	music = NULL;
-	music_volume = midi_volume = sfx_volume = 0;
-
-#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
-	Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG);
-#endif
-	Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
-	Mix_AllocateChannels(256);
-}
-
-void I_ShutdownSound(void)
-{
-	I_Assert(sound_started);
-	sound_started = false;
-
-	Mix_CloseAudio();
-#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
-	Mix_Quit();
-#endif
-#ifdef HAVE_LIBGME
-	if (gme)
-		gme_delete(gme);
-#endif
-}
-
-void I_UpdateSound(void)
-{
-}
-
-// this is as fast as I can possibly make it.
-// sorry. more asm needed.
-static Mix_Chunk *ds2chunk(void *stream)
-{
-	UINT16 ver,freq;
-	UINT32 samples, i, newsamples;
-	UINT8 *sound;
-
-	SINT8 *s;
-	INT16 *d;
-	INT16 o;
-	fixed_t step, frac;
-
-	// lump header
-	ver = READUINT16(stream); // sound version format?
-	if (ver != 3) // It should be 3 if it's a doomsound...
-		return NULL; // onos! it's not a doomsound!
-	freq = READUINT16(stream);
-	samples = READUINT32(stream);
-
-	// convert from signed 8bit ???hz to signed 16bit 44100hz.
-	switch(freq)
-	{
-	case 44100:
-		if (samples >= UINT32_MAX>>2)
-			return NULL; // would wrap, can't store.
-		newsamples = samples;
-		break;
-	case 22050:
-		if (samples >= UINT32_MAX>>3)
-			return NULL; // would wrap, can't store.
-		newsamples = samples<<1;
-		break;
-	case 11025:
-		if (samples >= UINT32_MAX>>4)
-			return NULL; // would wrap, can't store.
-		newsamples = samples<<2;
-		break;
-	default:
-		frac = (44100 << FRACBITS) / (UINT32)freq;
-		if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
-			newsamples = samples * (frac >> FRACBITS);
-		else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
-			newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
-		if (newsamples >= UINT32_MAX>>2)
-			return NULL; // would and/or did wrap, can't store.
-		break;
-	}
-	sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
-
-	s = (SINT8 *)stream;
-	d = (INT16 *)sound;
-
-	i = 0;
-	switch(freq)
-	{
-	case 44100: // already at the same rate? well that makes it simple.
-		while(i++ < samples)
-		{
-			o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-		}
-		break;
-	case 22050: // unwrap 2x
-		while(i++ < samples)
-		{
-			o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-		}
-		break;
-	case 11025: // unwrap 4x
-		while(i++ < samples)
-		{
-			o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-			*d++ = o; // left channel
-			*d++ = o; // right channel
-		}
-		break;
-	default: // convert arbitrary hz to 44100.
-		step = 0;
-		frac = ((UINT32)freq << FRACBITS) / 44100;
-		while (i < samples)
-		{
-			o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits
-			while (step < FRACUNIT) // this is as fast as I can make it.
-			{
-				*d++ = o; // left channel
-				*d++ = o; // right channel
-				step += frac;
-			}
-			do {
-				i++; s++;
-				step -= FRACUNIT;
-			} while (step >= FRACUNIT);
-		}
-		break;
-	}
-
-	// return Mixer Chunk.
-	return Mix_QuickLoad_RAW(sound, (UINT8*)d-sound);
-}
-
-void *I_GetSfx(sfxinfo_t *sfx)
-{
-	void *lump;
-	Mix_Chunk *chunk;
-#ifdef HAVE_LIBGME
-	Music_Emu *emu;
-	gme_info_t *info;
-#endif
-
-	if (sfx->lumpnum == LUMPERROR)
-		sfx->lumpnum = S_GetSfxLumpNum(sfx);
-	sfx->length = W_LumpLength(sfx->lumpnum);
-
-	lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND);
-
-	// convert from standard DoomSound format.
-	chunk = ds2chunk(lump);
-	if (chunk)
-	{
-		Z_Free(lump);
-		return chunk;
-	}
-
-	// Not a doom sound? Try something else.
-#ifdef HAVE_LIBGME
-	// VGZ format
-	if (((UINT8 *)lump)[0] == 0x1F
-		&& ((UINT8 *)lump)[1] == 0x8B)
-	{
-#ifdef HAVE_ZLIB
-		UINT8 *inflatedData;
-		size_t inflatedLen;
-		z_stream stream;
-		int zErr; // Somewhere to handle any error messages zlib tosses out
-
-		memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
-		// Begin the inflation process
-		inflatedLen = *(UINT32 *)lump + (sfx->length-4); // Last 4 bytes are the decompressed size, typically
-		inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data
-		stream.total_in = stream.avail_in = sfx->length;
-		stream.total_out = stream.avail_out = inflatedLen;
-		stream.next_in = (UINT8 *)lump;
-		stream.next_out = inflatedData;
-
-		zErr = inflateInit2(&stream, 32 + MAX_WBITS);
-		if (zErr == Z_OK) // We're good to go
-		{
-			zErr = inflate(&stream, Z_FINISH);
-			if (zErr == Z_STREAM_END) {
-				// Run GME on new data
-				if (!gme_open_data(inflatedData, inflatedLen, &emu, 44100))
-				{
-					short *mem;
-					UINT32 len;
-					gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
-
-					Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
-					Z_Free(lump); // We're done with the uninflated lump now, too.
-
-					gme_start_track(emu, 0);
-					gme_set_equalizer(emu, &eq);
-					gme_track_info(emu, &info, 0);
-
-					len = (info->play_length * 441 / 10) << 2;
-					mem = Z_Malloc(len, PU_SOUND, NULL);
-					gme_play(emu, len >> 1, mem);
-					gme_delete(emu);
-
-					return Mix_QuickLoad_RAW((Uint8 *)mem, len);
-				}
-			}
-			else
-			{
-				const char *errorType;
-				switch (zErr)
-				{
-					case Z_ERRNO:
-						errorType = "Z_ERRNO"; break;
-					case Z_STREAM_ERROR:
-						errorType = "Z_STREAM_ERROR"; break;
-					case Z_DATA_ERROR:
-						errorType = "Z_DATA_ERROR"; break;
-					case Z_MEM_ERROR:
-						errorType = "Z_MEM_ERROR"; break;
-					case Z_BUF_ERROR:
-						errorType = "Z_BUF_ERROR"; break;
-					case Z_VERSION_ERROR:
-						errorType = "Z_VERSION_ERROR"; break;
-					default:
-						errorType = "unknown error";
-				}
-				CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
-			}
-			(void)inflateEnd(&stream);
-		}
-		else // Hold up, zlib's got a problem
-		{
-			const char *errorType;
-			switch (zErr)
-			{
-				case Z_ERRNO:
-					errorType = "Z_ERRNO"; break;
-				case Z_STREAM_ERROR:
-					errorType = "Z_STREAM_ERROR"; break;
-				case Z_DATA_ERROR:
-					errorType = "Z_DATA_ERROR"; break;
-				case Z_MEM_ERROR:
-					errorType = "Z_MEM_ERROR"; break;
-				case Z_BUF_ERROR:
-					errorType = "Z_BUF_ERROR"; break;
-				case Z_VERSION_ERROR:
-					errorType = "Z_VERSION_ERROR"; break;
-				default:
-					errorType = "unknown error";
-			}
-			CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
-		}
-		Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
-#else
-		//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
-#endif
-	}
-	// Try to read it as a GME sound
-	else if (!gme_open_data(lump, sfx->length, &emu, 44100))
-	{
-		short *mem;
-		UINT32 len;
-		gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
-
-		Z_Free(lump);
-
-		gme_start_track(emu, 0);
-		gme_set_equalizer(emu, &eq);
-		gme_track_info(emu, &info, 0);
-
-		len = (info->play_length * 441 / 10) << 2;
-		mem = Z_Malloc(len, PU_SOUND, NULL);
-		gme_play(emu, len >> 1, mem);
-		gme_delete(emu);
-
-		return Mix_QuickLoad_RAW((Uint8 *)mem, len);
-	}
-#endif
-
-	// Try to load it as a WAVE or OGG using Mixer.
-	return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1);
-}
-
-void I_FreeSfx(sfxinfo_t *sfx)
-{
-	if (sfx->data)
-		Mix_FreeChunk(sfx->data);
-	sfx->data = NULL;
-}
-
-INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
-{
-	UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
-	INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0);
-	Mix_Volume(handle, volume);
-	Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
-	(void)pitch; // Mixer can't handle pitch
-	(void)priority; // priority and channel management is handled by SRB2...
-	return handle;
-}
-
-void I_StopSound(INT32 handle)
-{
-	Mix_HaltChannel(handle);
-}
-
-boolean I_SoundIsPlaying(INT32 handle)
-{
-	return Mix_Playing(handle);
-}
-
-void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
-{
-	UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127
-	Mix_Volume(handle, volume);
-	Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff));
-	(void)pitch;
-}
-
-void I_SetSfxVolume(UINT8 volume)
-{
-	sfx_volume = volume;
-}
-
-//
-// Music
-//
-
-// Music hooks
-static void music_loop(void)
-{
-	Mix_PlayMusic(music, 0);
-	Mix_SetMusicPosition(loop_point);
-}
-
-#ifdef HAVE_LIBGME
-static void mix_gme(void *udata, Uint8 *stream, int len)
-{
-	int i;
-	short *p;
-
-	(void)udata;
-
-	// no gme? no music.
-	if (!gme || gme_track_ended(gme))
-		return;
-
-	// play gme into stream
-	gme_play(gme, len/2, (short *)stream);
-
-	// apply volume to stream
-	for (i = 0, p = (short *)stream; i < len/2; i++, p++)
-		*p = ((INT32)*p) * music_volume / 31;
-}
-#endif
-
-void I_InitMusic(void)
-{
-}
-
-void I_ShutdownMusic(void)
-{
-	I_ShutdownDigMusic();
-	I_ShutdownMIDIMusic();
-}
-
-void I_PauseSong(INT32 handle)
-{
-	(void)handle;
-	Mix_PauseMusic();
-}
-
-void I_ResumeSong(INT32 handle)
-{
-	(void)handle;
-	Mix_ResumeMusic();
-}
-
-//
-// Digital Music
-//
-
-void I_InitDigMusic(void)
-{
-#ifdef HAVE_LIBGME
-	gme = NULL;
-	current_track = -1;
-#endif
-}
-
-void I_ShutdownDigMusic(void)
-{
-	if (midimode)
-		return;
-#ifdef HAVE_LIBGME
-	if (gme)
-	{
-		Mix_HookMusic(NULL, NULL);
-		gme_delete(gme);
-		gme = NULL;
-	}
-#endif
-	if (!music)
-		return;
-	Mix_HookMusicFinished(NULL);
-	Mix_FreeMusic(music);
-	music = NULL;
-}
-
-boolean I_StartDigSong(const char *musicname, boolean looping)
-{
-	char *data;
-	size_t len;
-	lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname));
-
-	I_Assert(!music);
-#ifdef HAVE_LIBGME
-	I_Assert(!gme);
-#endif
-
-	if (lumpnum == LUMPERROR)
-	{
-		lumpnum = W_CheckNumForName(va("D_%s",musicname));
-		if (lumpnum == LUMPERROR)
-			return false;
-		midimode = true;
-	}
-	else
-		midimode = false;
-
-	data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC);
-	len = W_LumpLength(lumpnum);
-
-#ifdef HAVE_LIBGME
-	if ((UINT8)data[0] == 0x1F
-		&& (UINT8)data[1] == 0x8B)
-	{
-#ifdef HAVE_ZLIB
-		UINT8 *inflatedData;
-		size_t inflatedLen;
-		z_stream stream;
-		int zErr; // Somewhere to handle any error messages zlib tosses out
-
-		memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream
-		// Begin the inflation process
-		inflatedLen = *(UINT32 *)(data + (len-4)); // Last 4 bytes are the decompressed size, typically
-		inflatedData = (UINT8 *)Z_Calloc(inflatedLen, PU_MUSIC, NULL); // Make room for the decompressed data
-		stream.total_in = stream.avail_in = len;
-		stream.total_out = stream.avail_out = inflatedLen;
-		stream.next_in = (UINT8 *)data;
-		stream.next_out = inflatedData;
-
-		zErr = inflateInit2(&stream, 32 + MAX_WBITS);
-		if (zErr == Z_OK) // We're good to go
-		{
-			zErr = inflate(&stream, Z_FINISH);
-			if (zErr == Z_STREAM_END) {
-				// Run GME on new data
-				if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100))
-				{
-					gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
-					gme_start_track(gme, 0);
-					current_track = 0;
-					gme_set_equalizer(gme, &eq);
-					Mix_HookMusic(mix_gme, gme);
-					Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
-					return true;
-				}
-			}
-			else
-			{
-				const char *errorType;
-				switch (zErr)
-				{
-					case Z_ERRNO:
-						errorType = "Z_ERRNO"; break;
-					case Z_STREAM_ERROR:
-						errorType = "Z_STREAM_ERROR"; break;
-					case Z_DATA_ERROR:
-						errorType = "Z_DATA_ERROR"; break;
-					case Z_MEM_ERROR:
-						errorType = "Z_MEM_ERROR"; break;
-					case Z_BUF_ERROR:
-						errorType = "Z_BUF_ERROR"; break;
-					case Z_VERSION_ERROR:
-						errorType = "Z_VERSION_ERROR"; break;
-					default:
-						errorType = "unknown error";
-				}
-				CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
-			}
-			(void)inflateEnd(&stream);
-		}
-		else // Hold up, zlib's got a problem
-		{
-			const char *errorType;
-			switch (zErr)
-			{
-				case Z_ERRNO:
-					errorType = "Z_ERRNO"; break;
-				case Z_STREAM_ERROR:
-					errorType = "Z_STREAM_ERROR"; break;
-				case Z_DATA_ERROR:
-					errorType = "Z_DATA_ERROR"; break;
-				case Z_MEM_ERROR:
-					errorType = "Z_MEM_ERROR"; break;
-				case Z_BUF_ERROR:
-					errorType = "Z_BUF_ERROR"; break;
-				case Z_VERSION_ERROR:
-					errorType = "Z_VERSION_ERROR"; break;
-				default:
-					errorType = "unknown error";
-			}
-			CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
-		}
-		Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
-#else
-		//CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
-#endif
-	}
-	else if (!gme_open_data(data, len, &gme, 44100))
-	{
-		gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
-		gme_start_track(gme, 0);
-		current_track = 0;
-		gme_set_equalizer(gme, &eq);
-		Mix_HookMusic(mix_gme, gme);
-		return true;
-	}
-#endif
-
-	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
-	if (!music)
-	{
-		CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
-		return true;
-	}
-
-	// Find the OGG loop point.
-	loop_point = 0.0f;
-	if (looping)
-	{
-		const char *key1 = "LOOP";
-		const char *key2 = "POINT=";
-		const char *key3 = "MS=";
-		const UINT8 key1len = strlen(key1);
-		const UINT8 key2len = strlen(key2);
-		const UINT8 key3len = strlen(key3);
-		char *p = data;
-		while ((UINT32)(p - data) < len)
-		{
-			if (strncmp(p++, key1, key1len))
-				continue;
-			p += key1len-1; // skip OOP (the L was skipped in strncmp)
-			if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=?
-			{
-				p += key2len; // skip POINT=
-				loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count.
-				// because SDL_Mixer is USELESS and can't even tell us
-				// something simple like the frequency of the streaming music,
-				// we are unfortunately forced to assume that ALL MUSIC is 44100hz.
-				// This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly.
-			}
-			else if (!strncmp(p, key3, key3len)) // is it LOOPMS=?
-			{
-				p += key3len; // skip MS=
-				loop_point = atoi(p) / 1000.0L; // LOOPMS works by real time, as miliseconds.
-				// Everything that uses LOOPMS will work perfectly with SDL_Mixer.
-			}
-			// Neither?! Continue searching.
-		}
-	}
-
-	if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1)
-	{
-		CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
-		return true;
-	}
-	if (midimode)
-		Mix_VolumeMusic((UINT32)midi_volume*128/31);
-	else
-		Mix_VolumeMusic((UINT32)music_volume*128/31);
-
-	if (loop_point != 0.0f)
-		Mix_HookMusicFinished(music_loop);
-	return true;
-}
-
-void I_StopDigSong(void)
-{
-	if (midimode)
-		return;
-#ifdef HAVE_LIBGME
-	if (gme)
-	{
-		Mix_HookMusic(NULL, NULL);
-		gme_delete(gme);
-		gme = NULL;
-		current_track = -1;
-		return;
-	}
-#endif
-	if (!music)
-		return;
-	Mix_HookMusicFinished(NULL);
-	Mix_FreeMusic(music);
-	music = NULL;
-}
-
-void I_SetDigMusicVolume(UINT8 volume)
-{
-	music_volume = volume;
-	if (midimode || !music)
-		return;
-	Mix_VolumeMusic((UINT32)volume*128/31);
-}
-
-boolean I_SetSongSpeed(float speed)
-{
-	if (speed > 250.0f)
-		speed = 250.0f; //limit speed up to 250x
-#ifdef HAVE_LIBGME
-	if (gme)
-	{
-		SDL_LockAudio();
-		gme_set_tempo(gme, speed);
-		SDL_UnlockAudio();
-		return true;
-	}
-#else
-	(void)speed;
-#endif
-	return false;
-}
-
-boolean I_SetSongTrack(int track)
-{
-#ifdef HAVE_LIBGME
-	if (current_track == track)
-		return false;
-
-	// If the specified track is within the number of tracks playing, then change it
-	if (gme)
-	{
-		SDL_LockAudio();
-		if (track >= 0
-			&& track < gme_track_count(gme))
-		{
-			gme_err_t gme_e = gme_start_track(gme, track);
-			if (gme_e != NULL)
-			{
-				CONS_Alert(CONS_ERROR, "GME error: %s\n", gme_e);
-				return false;
-			}
-			current_track = track;
-			SDL_UnlockAudio();
-			return true;
-		}
-		SDL_UnlockAudio();
-		return false;
-	}
-#endif
-	(void)track;
-	return false;
-}
-
-//
-// MIDI Music
-//
-
-void I_InitMIDIMusic(void)
-{
-}
-
-void I_ShutdownMIDIMusic(void)
-{
-	if (!midimode || !music)
-		return;
-	Mix_FreeMusic(music);
-	music = NULL;
-}
-
-void I_SetMIDIMusicVolume(UINT8 volume)
-{
-	midi_volume = volume;
-	if (!midimode || !music)
-		return;
-	Mix_VolumeMusic((UINT32)volume*128/31);
-}
-
-INT32 I_RegisterSong(void *data, size_t len)
-{
-	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
-	if (!music)
-	{
-		CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
-		return -1;
-	}
-	return 1337;
-}
-
-boolean I_PlaySong(INT32 handle, boolean looping)
-{
-	(void)handle;
-
-	midimode = true;
-
-	if (Mix_PlayMusic(music, looping ? -1 : 0) == -1)
-	{
-		CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError());
-		return false;
-	}
-	Mix_VolumeMusic((UINT32)music_volume*128/31);
-	return true;
-}
-
-void I_StopSong(INT32 handle)
-{
-	if (!midimode || !music)
-		return;
-
-	(void)handle;
-	Mix_HaltMusic();
-}
-
-void I_UnRegisterSong(INT32 handle)
-{
-	if (!midimode || !music)
-		return;
-
-	(void)handle;
-	Mix_FreeMusic(music);
-	music = NULL;
-}
-
-#endif
diff --git a/src/sdl12/ogl_sdl.c b/src/sdl12/ogl_sdl.c
deleted file mode 100644
index eb7e9996dba228f1f626670705e52220c18df670..0000000000000000000000000000000000000000
--- a/src/sdl12/ogl_sdl.c
+++ /dev/null
@@ -1,317 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL specific part of the OpenGL API for SRB2
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#ifdef HAVE_SDL
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#include "../doomdef.h"
-
-#ifdef HWRENDER
-#include "../hardware/r_opengl/r_opengl.h"
-#include "ogl_sdl.h"
-#include "../i_system.h"
-#include "hwsym_sdl.h"
-#include "../m_argv.h"
-
-#ifdef DEBUG_TO_FILE
-#include <stdarg.h>
-#if defined (_WIN32) && !defined (__CYGWIN__)
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif
-
-#ifdef USE_WGL_SWAP
-PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL;
-#else
-typedef int (*PFNGLXSWAPINTERVALPROC) (int);
-PFNGLXSWAPINTERVALPROC glXSwapIntervalSGIEXT = NULL;
-#endif
-
-#ifndef STATIC_OPENGL
-PFNglClear pglClear;
-PFNglGetIntegerv pglGetIntegerv;
-PFNglGetString pglGetString;
-#endif
-
-#ifdef _PSP
-static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/;
-static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN;
-#else
-static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/;
-static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN;
-#endif
-
-/**	\brief SDL video display surface
-*/
-SDL_Surface *vidSurface = NULL;
-INT32 oglflags = 0;
-void *GLUhandle = NULL;
-
-#ifndef STATIC_OPENGL
-void *GetGLFunc(const char *proc)
-{
-	if (strncmp(proc, "glu", 3) == 0)
-	{
-		if (GLUhandle)
-			return hwSym(proc, GLUhandle);
-		else
-			return NULL;
-	}
-	return SDL_GL_GetProcAddress(proc);
-}
-#endif
-
-boolean LoadGL(void)
-{
-#ifndef STATIC_OPENGL
-	const char *OGLLibname = NULL;
-	const char *GLULibname = NULL;
-
-	if (M_CheckParm ("-OGLlib") && M_IsNextParm())
-		OGLLibname = M_GetNextParm();
-
-	if (SDL_GL_LoadLibrary(OGLLibname) != 0)
-	{
-		I_OutputMsg("Could not load OpenGL Library: %s\n"
-					"Falling back to Software mode.\n", SDL_GetError());
-		if (!M_CheckParm ("-OGLlib"))
-			I_OutputMsg("If you know what is the OpenGL library's name, use -OGLlib\n");
-		return 0;
-	}
-
-#if 0
-	GLULibname = "/proc/self/exe";
-#elif defined (_WIN32)
-	GLULibname = "GLU32.DLL";
-#elif defined (__MACH__)
-	GLULibname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib";
-#elif defined (macintos)
-	GLULibname = "OpenGLLibrary";
-#elif defined (__unix__)
-	GLULibname = "libGLU.so.1";
-#elif defined (__HAIKU__)
-	GLULibname = "libGLU.so";
-#else
-	GLULibname = NULL;
-#endif
-
-	if (M_CheckParm ("-GLUlib") && M_IsNextParm())
-		GLULibname = M_GetNextParm();
-
-	if (GLULibname)
-	{
-		GLUhandle = hwOpen(GLULibname);
-		if (GLUhandle)
-			return SetupGLfunc();
-		else
-		{
-			I_OutputMsg("Could not load GLU Library: %s\n", GLULibname);
-			if (!M_CheckParm ("-GLUlib"))
-				I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
-		}
-	}
-	else
-	{
-		I_OutputMsg("Could not load GLU Library\n");
-		I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
-	}
-#endif
-	return SetupGLfunc();
-}
-
-/**	\brief	The OglSdlSurface function
-
-	\param	w	width
-	\param	h	height
-	\param	isFullscreen	if true, go fullscreen
-
-	\return	if true, changed video mode
-*/
-boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
-{
-	INT32 cbpp;
-	Uint32 OGLFlags;
-	const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
-
-	cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
-
-	if (vidSurface)
-	{
-		//Alam: SDL_Video system free vidSurface for me
-#ifdef VOODOOSAFESWITCHING
-		SDL_QuitSubSystem(SDL_INIT_VIDEO);
-		SDL_InitSubSystem(SDL_INIT_VIDEO);
-#endif
-	}
-
-	if (isFullscreen)
-		OGLFlags = FOGLFlags;
-	else
-		OGLFlags = WOGLFlags;
-
-	cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags);
-	if (cbpp < 16)
-		return true; //Alam: Let just say we did, ok?
-
-	vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags);
-	if (!vidSurface)
-		return false;
-
-	glvendor = pglGetString(GL_VENDOR);
-	// Get info and extensions.
-	//BP: why don't we make it earlier ?
-	//Hurdler: we cannot do that before intialising gl context
-	glrenderer = pglGetString(GL_RENDERER);
-	glversion = pglGetString(GL_VERSION);
-	gl_extensions = pglGetString(GL_EXTENSIONS);
-
-	DBG_Printf("Vendor     : %s\n", glvendor);
-	DBG_Printf("Renderer   : %s\n", glrenderer);
-	DBG_Printf("Version    : %s\n", glversion);
-	DBG_Printf("Extensions : %s\n", gl_extensions);
-	oglflags = 0;
-
-#ifdef _WIN32
-	// BP: disable advenced feature that don't work on somes hardware
-	// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
-	if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD;
-#elif defined (unix) || defined (UNIXCOMMON)
-	// disable advanced features not working on somes hardware
-	if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV;
-	if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV;
-#endif
-	DBG_Printf("oglflags   : 0x%X\n", oglflags );
-
-#ifdef USE_PALETTED_TEXTURE
-	if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions))
-		glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT");
-	else
-		glColorTableEXT = NULL;
-#endif
-
-#ifdef USE_WGL_SWAP
-	if (isExtAvailable("WGL_EXT_swap_control", gl_extensions))
-		wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
-	else
-		wglSwapIntervalEXT = NULL;
-#else
-	if (isExtAvailable("GLX_SGI_swap_control", gl_extensions))
-		glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
-	else
-		glXSwapIntervalSGIEXT = NULL;
-#endif
-
-#ifndef KOS_GL_COMPATIBILITY
-	if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
-		pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
-	else
-#endif
-		maximumAnisotropy = 0;
-
-	SetupGLFunc13();
-
-	granisotropicmode_cons_t[1].value = maximumAnisotropy;
-
-	SetModelView(w, h);
-	SetStates();
-	pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
-
-	HWR_Startup();
-#ifdef KOS_GL_COMPATIBILITY
-	textureformatGL = GL_ARGB4444;
-#else
-	textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
-#endif
-
-	return true;
-}
-
-/**	\brief	The OglSdlFinishUpdate function
-
-	\param	vidwait	wait for video sync
-
-	\return	void
-*/
-void OglSdlFinishUpdate(boolean waitvbl)
-{
-	static boolean oldwaitvbl = false;
-	if (oldwaitvbl != waitvbl)
-	{
-#ifdef USE_WGL_SWAP
-		if (wglSwapIntervalEXT)
-			wglSwapIntervalEXT(waitvbl);
-#else
-		if (glXSwapIntervalSGIEXT)
-			glXSwapIntervalSGIEXT(waitvbl);
-#endif
-	}
-	oldwaitvbl = waitvbl;
-
-	SDL_GL_SwapBuffers();
-}
-
-EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
-{
-	INT32 i = -1;
-	UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
-		bluegamma = pgamma->s.blue;
-
-#if 0 // changing the gamma to 127 is a bad idea
-	i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma));
-#endif
-	if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool
-	for (i = 0; i < 256; i++)
-	{
-		myPaletteData[i].s.red   = (UINT8)MIN((palette[i].s.red   * redgamma)  /127, 255);
-		myPaletteData[i].s.green = (UINT8)MIN((palette[i].s.green * greengamma)/127, 255);
-		myPaletteData[i].s.blue  = (UINT8)MIN((palette[i].s.blue  * bluegamma) /127, 255);
-		myPaletteData[i].s.alpha = palette[i].s.alpha;
-	}
-#ifdef USE_PALETTED_TEXTURE
-	if (glColorTableEXT)
-	{
-		for (i = 0; i < 256; i++)
-		{
-			palette_tex[(3*i)+0] = palette[i].s.red;
-			palette_tex[(3*i)+1] = palette[i].s.green;
-			palette_tex[(3*i)+2] = palette[i].s.blue;
-		}
-		glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex);
-	}
-#endif
-	// on a chang�de palette, il faut recharger toutes les textures
-	// jaja, und noch viel mehr ;-)
-	Flush();
-}
-
-#endif //HWRENDER
-#endif //SDL
diff --git a/src/sdl12/ogl_sdl.h b/src/sdl12/ogl_sdl.h
deleted file mode 100644
index 43c28fa422a0b42e6367da418e62aa5ce3aa1fb0..0000000000000000000000000000000000000000
--- a/src/sdl12/ogl_sdl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL specific part of the OpenGL API for SRB2
-
-#include "../v_video.h"
-
-extern SDL_Surface *vidSurface;
-extern void *GLUhandle;
-
-boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen);
-
-void OglSdlFinishUpdate(boolean vidwait);
-
-#ifdef _CREATE_DLL_
-EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
-#endif
diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c
deleted file mode 100644
index 6ba83104ee81033a0f9bb4935ecf25adfda1115e..0000000000000000000000000000000000000000
--- a/src/sdl12/sdl_sound.c
+++ /dev/null
@@ -1,2030 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1993-1996 by id Software, Inc.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// The source is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief SDL interface for sound
-
-#include <math.h>
-#include "../doomdef.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4214 4244)
-#endif
-
-#if defined(HAVE_SDL) && SOUND==SOUND_SDL
-
-#include "SDL.h"
-
-#ifdef _MSC_VER
-#pragma warning(default : 4214 4244)
-#endif
-
-#ifdef HAVE_MIXER
-#include "SDL_mixer.h"
-/* This is the version number macro for the current SDL_mixer version: */
-#ifndef SDL_MIXER_COMPILEDVERSION
-#define SDL_MIXER_COMPILEDVERSION \
-	SDL_VERSIONNUM(MIX_MAJOR_VERSION, MIX_MINOR_VERSION, MIX_PATCHLEVEL)
-#endif
-
-/* This macro will evaluate to true if compiled with SDL_mixer at least X.Y.Z */
-#ifndef SDL_MIXER_VERSION_ATLEAST
-#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
-	(SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-#endif
-
-#else
-#define MIX_CHANNELS 8
-#endif
-
-#if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX)
-#include <direct.h>
-#elif defined (__GNUC__)
-#include <unistd.h>
-#endif
-#include "../z_zone.h"
-
-#include "../m_swap.h"
-#include "../i_system.h"
-#include "../i_sound.h"
-#include "../m_argv.h"
-#include "../m_misc.h"
-#include "../w_wad.h"
-#include "../screen.h" //vid.WndParent
-#include "../doomdef.h"
-#include "../doomstat.h"
-#include "../s_sound.h"
-
-#include "../d_main.h"
-
-#ifdef HW3SOUND
-#include "../hardware/hw3dsdrv.h"
-#include "../hardware/hw3sound.h"
-#include "hwsym_sdl.h"
-#endif
-
-#ifdef HAVE_LIBGME
-#include "gme/gme.h"
-#endif
-
-// The number of internal mixing channels,
-//  the samples calculated for each mixing step,
-//  the size of the 16bit, 2 hardware channel (stereo)
-//  mixing buffer, and the samplerate of the raw data.
-
-// Needed for calling the actual sound output.
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X)
-#define NUM_CHANNELS            MIX_CHANNELS
-#else
-#define NUM_CHANNELS            MIX_CHANNELS*4
-#endif
-
-#define INDEXOFSFX(x) ((sfxinfo_t *)x - S_sfx)
-
-#if defined (_WIN32_WCE) || defined (DC) || defined (PSP)
-static Uint16 samplecount = 512; //Alam: .5KB samplecount at 11025hz is 46.439909297052154195011337868481ms of buffer
-#elif defined(GP2X)
-static Uint16 samplecount = 128;
-#else
-static Uint16 samplecount = 1024; //Alam: 1KB samplecount at 22050hz is 46.439909297052154195011337868481ms of buffer
-#endif
-
-typedef struct chan_struct
-{
-	// The channel data pointers, start and end.
-	Uint8 *data; //static unsigned char *channels[NUM_CHANNELS];
-	Uint8 *end; //static unsigned char *channelsend[NUM_CHANNELS];
-
-	// pitch
-	Uint32 realstep; // The channel step amount...
-	Uint32 step;          //static UINT32 channelstep[NUM_CHANNELS];
-	Uint32 stepremainder; //static UINT32 channelstepremainder[NUM_CHANNELS];
-	Uint32 samplerate; // ... and a 0.16 bit remainder of last step.
-
-	// Time/gametic that the channel started playing,
-	//  used to determine oldest, which automatically
-	//  has lowest priority.
-	tic_t starttic; //static INT32 channelstart[NUM_CHANNELS];
-
-	// The sound handle, determined on registration,
-	//  used to unregister/stop/modify,
-	INT32 handle; //static INT32 channelhandles[NUM_CHANNELS];
-
-	// SFX id of the playing sound effect.
-	void *id; // Used to catch duplicates (like chainsaw).
-	sfxenum_t sfxid; //static INT32 channelids[NUM_CHANNELS];
-	INT32 vol; //the channel volume
-	INT32 sep; //the channel pan
-
-	// Hardware left and right channel volume lookup.
-	Sint16* leftvol_lookup; //static INT32 *channelleftvol_lookup[NUM_CHANNELS];
-	Sint16* rightvol_lookup; //static INT32 *channelrightvol_lookup[NUM_CHANNELS];
-} chan_t;
-
-static chan_t channels[NUM_CHANNELS];
-
-// Pitch to stepping lookup
-static INT32 steptable[256];
-
-// Volume lookups.
-static Sint16 vol_lookup[128 * 256];
-
-UINT8 sound_started = false;
-static SDL_mutex *Snd_Mutex = NULL;
-
-//SDL's Audio
-static SDL_AudioSpec audio;
-
-static SDL_bool musicStarted = SDL_FALSE;
-#ifdef HAVE_MIXER
-static SDL_mutex *Msc_Mutex = NULL;
-/* FIXME: Make this file instance-specific */
-#ifdef _arch_dreamcast
-#define MIDI_PATH     "/ram"
-#elif defined(GP2X)
-#define MIDI_PATH     "/mnt/sd/srb2"
-#define MIDI_PATH2    "/tmp/mnt/sd/srb2"
-#else
-#define MIDI_PATH     srb2home
-#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define MIDI_PATH2    "/tmp"
-#endif
-#endif
-#define MIDI_TMPFILE  "srb2music"
-#define MIDI_TMPFILE2 "srb2wav"
-static INT32 musicvol = 62;
-
-#if SDL_MIXER_VERSION_ATLEAST(1,2,2)
-#define MIXER_POS //Mix_FadeInMusicPos in 1.2.2+
-static void SDLCALL I_FinishMusic(void);
-static double loopstartDig = 0.0l;
-static SDL_bool loopingDig = SDL_FALSE;
-static SDL_bool canlooping = SDL_TRUE;
-#endif
-
-#if SDL_MIXER_VERSION_ATLEAST(1,2,7)
-#define USE_RWOPS // ok, USE_RWOPS is in here
-#if defined (DC) || defined (_WIN32_WCE) || defined (_XBOX) //|| defined(_WIN32) || defined(GP2X)
-#undef USE_RWOPS
-#endif
-#endif
-
-#if SDL_MIXER_VERSION_ATLEAST(1,2,10)
-//#define MIXER_INIT
-#endif
-
-#ifdef USE_RWOPS
-static void * Smidi[2] = { NULL, NULL };
-static SDL_bool canuseRW = SDL_TRUE;
-#endif
-static const char *fmidi[2] = { MIDI_TMPFILE, MIDI_TMPFILE2};
-
-static const INT32 MIDIfade = 500;
-static const INT32 Digfade = 0;
-
-static Mix_Music *music[2] = { NULL, NULL };
-#endif
-
-typedef struct srb2audio_s {
-	void *userdata;
-#ifdef HAVE_LIBGME
-	Music_Emu *gme_emu;
-	UINT8 gme_pause;
-	UINT8 gme_loop;
-#endif
-} srb2audio_t;
-
-static srb2audio_t localdata;
-
-static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback
-{
-	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
-	else if (nosound) return;
-	else if (nomidimusic && nodigimusic
-#ifdef HW3SOUND
-	         && hws_mode == HWS_DEFAULT_MODE
-#endif
-	        ) SDL_LockAudio();
-#ifdef HAVE_MIXER
-	else if (musicStarted) Mix_SetPostMix(NULL, NULL);
-#endif
-}
-
-static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback
-{
-	if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
-	else if (nosound) return;
-	else if (nomidimusic && nodigimusic
-#ifdef HW3SOUND
-	         && hws_mode == HWS_DEFAULT_MODE
-#endif
-	        ) SDL_UnlockAudio();
-#ifdef HAVE_MIXER
-	else if (musicStarted) Mix_SetPostMix(audio.callback, audio.userdata);
-#endif
-}
-
-FUNCMATH static inline Uint16 Snd_LowerRate(Uint16 sr)
-{
-	if (sr <= audio.freq) // already lowered rate?
-		return sr; // good then
-	for (;sr > audio.freq;) // not good?
-	{ // then let see...
-		if (sr % 2) // can we div by half?
-			return sr; // no, just use the currect rate
-		sr /= 2; // we can? wonderful
-	} // let start over again
-	if (sr == audio.freq) // did we drop to the desired rate?
-		return sr; // perfect! but if not
-	return sr*2; // just keep it just above the output sample rate
-}
-
-#ifdef _MSC_VER
-#pragma warning(disable :  4200)
-#pragma pack(1)
-#endif
-
-typedef struct
-{
-	Uint16 header;     // 3?
-	Uint16 samplerate; // 11025+
-	Uint16 samples;    // number of samples
-	Uint16 dummy;      // 0
-	Uint8  data[0];    // data;
-} ATTRPACK dssfx_t;
-
-#ifdef _MSC_VER
-#pragma pack()
-#pragma warning(default : 4200)
-#endif
-
-//
-// This function loads the sound data from the WAD lump,
-//  for single sound.
-//
-static void *getsfx(lumpnum_t sfxlump, size_t *len)
-{
-	dssfx_t *sfx, *paddedsfx;
-	Uint16 sr , csr;
-	size_t size = *len;
-	SDL_AudioCVT sfxcvt;
-
-	sfx = (dssfx_t *)malloc(size);
-	if (sfx) W_ReadLump(sfxlump, (void *)sfx);
-	else return NULL;
-	sr = SHORT(sfx->samplerate);
-	csr = Snd_LowerRate(sr);
-
-	if (sr > csr && SDL_BuildAudioCVT(&sfxcvt, AUDIO_U8, 1, sr, AUDIO_U8, 1, csr))
-	{//Alam: Setup the AudioCVT for the SFX
-
-		sfxcvt.len = (INT32)size-8; //Alam: Chop off the header
-		sfxcvt.buf = malloc(sfxcvt.len * sfxcvt.len_mult); //Alam: make room
-		if (sfxcvt.buf) M_Memcpy(sfxcvt.buf, &(sfx->data), sfxcvt.len); //Alam: copy the sfx sample
-
-		if (sfxcvt.buf && SDL_ConvertAudio(&sfxcvt) == 0) //Alam: let convert it!
-		{
-				size = sfxcvt.len_cvt + 8;
-				*len = sfxcvt.len_cvt;
-
-				// Allocate from zone memory.
-				paddedsfx = (dssfx_t *) Z_Malloc(size, PU_SOUND, NULL);
-
-				// Now copy and pad.
-				M_Memcpy(paddedsfx->data, sfxcvt.buf, sfxcvt.len_cvt);
-				free(sfxcvt.buf);
-				M_Memcpy(paddedsfx,sfx,8);
-				paddedsfx->samplerate = SHORT(csr); // new freq
-		}
-		else //Alam: the convert failed, not needed or I couldn't malloc the buf
-		{
-			if (sfxcvt.buf) free(sfxcvt.buf);
-			*len = size - 8;
-
-			// Allocate from zone memory then copy and pad
-			paddedsfx = (dssfx_t *)M_Memcpy(Z_Malloc(size, PU_SOUND, NULL), sfx, size);
-		}
-	}
-	else
-	{
-		// Pads the sound effect out to the mixing buffer size.
-		// The original realloc would interfere with zone memory.
-		*len = size - 8;
-
-		// Allocate from zone memory then copy and pad
-		paddedsfx = (dssfx_t *)M_Memcpy(Z_Malloc(size, PU_SOUND, NULL), sfx, size);
-	}
-
-	// Remove the cached lump.
-	free(sfx);
-
-	// Return allocated padded data.
-	return paddedsfx;
-}
-
-// used to (re)calculate channel params based on vol, sep, pitch
-static void I_SetChannelParams(chan_t *c, INT32 vol, INT32 sep, INT32 step)
-{
-	INT32 leftvol;
-	INT32 rightvol;
-	c->vol = vol;
-	c->sep = sep;
-	c->step = c->realstep = step;
-
-	if (step != steptable[128])
-		c->step += (((c->samplerate<<16)/audio.freq)-65536);
-	else if (c->samplerate != (unsigned)audio.freq)
-		c->step = ((c->samplerate<<16)/audio.freq);
-	// x^2 separation, that is, orientation/stereo.
-	//  range is: 0 (left) - 255 (right)
-
-	// Volume arrives in range 0..255 and it must be in 0..cv_soundvolume...
-	vol = (vol * cv_soundvolume.value) >> 7;
-	// note: >> 6 would use almost the entire dynamical range, but
-	// then there would be no "dynamical room" for other sounds :-/
-
-	leftvol  = vol - ((vol*sep*sep) >> 16); ///(256*256);
-	sep = 255 - sep;
-	rightvol = vol - ((vol*sep*sep) >> 16);
-
-	// Sanity check, clamp volume.
-	if (rightvol < 0)
-		rightvol = 0;
-	else if (rightvol > 127)
-		rightvol = 127;
-	if (leftvol < 0)
-		leftvol = 0;
-	else if (leftvol > 127)
-		leftvol = 127;
-
-	// Get the proper lookup table piece
-	//  for this volume level
-	c->leftvol_lookup = &vol_lookup[leftvol*256];
-	c->rightvol_lookup = &vol_lookup[rightvol*256];
-}
-
-static INT32 FindChannel(INT32 handle)
-{
-	INT32 i;
-
-	for (i = 0; i < NUM_CHANNELS; i++)
-		if (channels[i].handle == handle)
-			return i;
-
-	// not found
-	return -1;
-}
-
-//
-// This function adds a sound to the
-//  list of currently active sounds,
-//  which is maintained as a given number
-//  (eight, usually) of internal channels.
-// Returns a handle.
-//
-static INT32 addsfx(sfxenum_t sfxid, INT32 volume, INT32 step, INT32 seperation)
-{
-	static UINT16 handlenums = 0;
-	INT32 i, slot, oldestnum = 0;
-	tic_t oldest = gametic;
-
-	// Play these sound effects only one at a time.
-#if 1
-	if (
-#if 0
-	sfxid == sfx_stnmov || sfxid == sfx_sawup || sfxid == sfx_sawidl || sfxid == sfx_sawful || sfxid == sfx_sawhit || sfxid == sfx_pistol
-#else
-	    ( sfx_litng1 <= sfxid && sfxid >= sfx_litng4 )
-	    || sfxid == sfx_trfire || sfxid == sfx_alarm || sfxid == sfx_spin
-	    || sfxid == sfx_athun1 || sfxid == sfx_athun2 || sfxid == sfx_rainin
-#endif
-	   )
-	{
-		// Loop all channels, check.
-		for (i = 0; i < NUM_CHANNELS; i++)
-		{
-			// Active, and using the same SFX?
-			if ((channels[i].end) && (channels[i].sfxid == sfxid))
-			{
-				// Reset.
-				channels[i].end = NULL;
-				// We are sure that iff,
-				//  there will only be one.
-				break;
-			}
-		}
-	}
-#endif
-
-	// Loop all channels to find oldest SFX.
-	for (i = 0; (i < NUM_CHANNELS) && (channels[i].end); i++)
-	{
-		if (channels[i].starttic < oldest)
-		{
-			oldestnum = i;
-			oldest = channels[i].starttic;
-		}
-	}
-
-	// Tales from the cryptic.
-	// If we found a channel, fine.
-	// If not, we simply overwrite the first one, 0.
-	// Probably only happens at startup.
-	if (i == NUM_CHANNELS)
-		slot = oldestnum;
-	else
-		slot = i;
-
-	channels[slot].end = NULL;
-	// Okay, in the less recent channel,
-	//  we will handle the new SFX.
-	// Set pointer to raw data.
-	channels[slot].data = (Uint8 *)S_sfx[sfxid].data;
-	channels[slot].samplerate = (channels[slot].data[3]<<8)+channels[slot].data[2];
-	channels[slot].data += 8; //Alam: offset of the sound header
-
-	while (FindChannel(handlenums)!=-1)
-	{
-		handlenums++;
-		// Reset current handle number, limited to 0..65535.
-		if (handlenums == UINT16_MAX)
-			handlenums = 0;
-	}
-
-	// Assign current handle number.
-	// Preserved so sounds could be stopped.
-	channels[slot].handle = handlenums;
-
-	// Restart steper
-	channels[slot].stepremainder = 0;
-	// Should be gametic, I presume.
-	channels[slot].starttic = gametic;
-
-	I_SetChannelParams(&channels[slot], volume, seperation, step);
-
-	// Preserve sound SFX id,
-	//  e.g. for avoiding duplicates of chainsaw.
-	channels[slot].id = S_sfx[sfxid].data;
-
-	channels[slot].sfxid = sfxid;
-
-	// Set pointer to end of raw data.
-	channels[slot].end = channels[slot].data + S_sfx[sfxid].length;
-
-
-	// You tell me.
-	return handlenums;
-}
-
-//
-// SFX API
-// Note: this was called by S_Init.
-// However, whatever they did in the
-// old DPMS based DOS version, this
-// were simply dummies in the Linux
-// version.
-// See soundserver initdata().
-//
-// Well... To keep compatibility with legacy doom, I have to call this in
-// I_InitSound since it is not called in S_Init... (emanne@absysteme.fr)
-
-static inline void I_SetChannels(void)
-{
-	// Init internal lookups (raw data, mixing buffer, channels).
-	// This function sets up internal lookups used during
-	//  the mixing process.
-	INT32 i;
-	INT32 j;
-
-	INT32 *steptablemid = steptable + 128;
-
-	if (nosound)
-		return;
-
-	// This table provides step widths for pitch parameters.
-	for (i = -128; i < 128; i++)
-	{
-		const double po = pow((double)(2.0l), (double)(i / 64.0l));
-		steptablemid[i] = (INT32)(po * 65536.0l);
-	}
-
-	// Generates volume lookup tables
-	//  which also turn the unsigned samples
-	//  into signed samples.
-	for (i = 0; i < 128; i++)
-		for (j = 0; j < 256; j++)
-		{
-			//From PrDoom
-			// proff - made this a little bit softer, because with
-			// full volume the sound clipped badly
-			vol_lookup[i * 256 + j] = (Sint16)((i * (j - 128) * 256) / 127);
-		}
-}
-
-void I_SetSfxVolume(UINT8 volume)
-{
-	INT32 i;
-
-	(void)volume;
-	//Snd_LockAudio();
-
-	for (i = 0; i < NUM_CHANNELS; i++)
-		if (channels[i].end) I_SetChannelParams(&channels[i], channels[i].vol, channels[i].sep, channels[i].realstep);
-
-	//Snd_UnlockAudio();
-}
-
-void *I_GetSfx(sfxinfo_t *sfx)
-{
-	if (sfx->lumpnum == LUMPERROR)
-		sfx->lumpnum = S_GetSfxLumpNum(sfx);
-//	else if (sfx->lumpnum != S_GetSfxLumpNum(sfx))
-//		I_FreeSfx(sfx);
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-		return HW3S_GetSfx(sfx);
-#endif
-
-	if (sfx->data)
-		return sfx->data; //Alam: I have it done!
-
-	sfx->length = W_LumpLength(sfx->lumpnum);
-
-	return getsfx(sfx->lumpnum, &sfx->length);
-
-}
-
-void I_FreeSfx(sfxinfo_t * sfx)
-{
-//	if (sfx->lumpnum<0)
-//		return;
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-	{
-		HW3S_FreeSfx(sfx);
-	}
-	else
-#endif
-	{
-		size_t i;
-
-		for (i = 1; i < NUMSFX; i++)
-		{
-			// Alias? Example is the chaingun sound linked to pistol.
-			if (S_sfx[i].data == sfx->data)
-			{
-				if (S_sfx+i != sfx) S_sfx[i].data = NULL;
-				S_sfx[i].lumpnum = LUMPERROR;
-				S_sfx[i].length = 0;
-			}
-		}
-		//Snd_LockAudio(); //Alam: too much?
-		// Loop all channels, check.
-		for (i = 0; i < NUM_CHANNELS; i++)
-		{
-			// Active, and using the same SFX?
-			if (channels[i].end && channels[i].id == sfx->data)
-			{
-				channels[i].end = NULL; // Reset.
-			}
-		}
-		//Snd_UnlockAudio(); //Alam: too much?
-		Z_Free(sfx->data);
-	}
-	sfx->data = NULL;
-	sfx->lumpnum = LUMPERROR;
-}
-
-//
-// Starting a sound means adding it
-//  to the current list of active sounds
-//  in the internal channels.
-// As the SFX info struct contains
-//  e.g. a pointer to the raw data,
-//  it is ignored.
-// As our sound handling does not handle
-//  priority, it is ignored.
-// Pitching (that is, increased speed of playback)
-//  is set, but currently not used by mixing.
-//
-INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority)
-{
-	(void)priority;
-	(void)pitch;
-
-	if (nosound)
-		return 0;
-
-	if (S_sfx[id].data == NULL) return -1;
-
-	Snd_LockAudio();
-	id = addsfx(id, vol, steptable[pitch], sep);
-	Snd_UnlockAudio();
-
-	return id; // Returns a handle (not used).
-}
-
-void I_StopSound(INT32 handle)
-{
-	// You need the handle returned by StartSound.
-	// Would be looping all channels,
-	//  tracking down the handle,
-	//  an setting the channel to zero.
-	INT32 i;
-
-	i = FindChannel(handle);
-
-	if (i != -1)
-	{
-		//Snd_LockAudio(); //Alam: too much?
-		channels[i].end = NULL;
-		//Snd_UnlockAudio(); //Alam: too much?
-		channels[i].handle = -1;
-		channels[i].starttic = 0;
-	}
-
-}
-
-boolean I_SoundIsPlaying(INT32 handle)
-{
-	boolean isplaying = false;
-	int chan = FindChannel(handle);
-	if (chan != -1)
-		isplaying = (channels[chan].end != NULL);
-	return isplaying;
-}
-
-FUNCINLINE static ATTRINLINE void I_UpdateStream8S(Uint8 *stream, int len)
-{
-	// Mix current sound data.
-	// Data, from raw sound
-	register Sint16 dr; // Right 8bit stream
-	register Uint8 sample; // Center 8bit sfx
-	register Sint16 dl; // Left 8bit stream
-
-	// Pointers in audio stream
-	Sint8 *rightout = (Sint8 *)stream; // currect right
-	Sint8 *leftout = rightout + 1;// currect left
-	const Uint8 step = 2; // Step in stream, left and right, thus two.
-
-	INT32 chan; // Mixing channel index.
-
-	// Determine end of the stream
-	len /= 2; // not 8bit mono samples, 8bit stereo ones
-
-	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
-
-	// Mix sounds into the mixing buffer.
-	// Loop over len
-	while (len--)
-	{
-		// Reset left/right value.
-		dl = *leftout;
-		dr = *rightout;
-
-		// Love thy L2 cache - made this a loop.
-		// Now more channels could be set at compile time
-		//  as well. Thus loop those channels.
-		for (chan = 0; chan < NUM_CHANNELS; chan++)
-		{
-			// Check channel, if active.
-			if (channels[chan].end)
-			{
-#if 1
-				// Get the raw data from the channel.
-				sample = channels[chan].data[0];
-#else
-				// linear filtering from PrDoom
-				sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder))
-					+ ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16;
-#endif
-				// Add left and right part
-				//  for this channel (sound)
-				//  to the current data.
-				// Adjust volume accordingly.
-				dl = (Sint16)(dl+(channels[chan].leftvol_lookup[sample]>>8));
-				dr = (Sint16)(dr+(channels[chan].rightvol_lookup[sample]>>8));
-				// Increment stepage
-				channels[chan].stepremainder += channels[chan].step;
-				// Check whether we are done.
-				if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end)
-					channels[chan].end = NULL;
-				else
-				{
-					// step to next sample
-					channels[chan].data += (channels[chan].stepremainder >> 16);
-					// Limit to LSB???
-					channels[chan].stepremainder &= 0xffff;
-				}
-			}
-		}
-
-		// Clamp to range. Left hardware channel.
-		// Has been char instead of short.
-
-		if (dl > 0x7f)
-			*leftout = 0x7f;
-		else if (dl < -0x80)
-			*leftout = -0x80;
-		else
-			*leftout = (Sint8)dl;
-
-		// Same for right hardware channel.
-		if (dr > 0x7f)
-			*rightout = 0x7f;
-		else if (dr < -0x80)
-			*rightout = -0x80;
-		else
-			*rightout = (Sint8)dr;
-
-		// Increment current pointers in stream
-		leftout += step;
-		rightout += step;
-
-	}
-	if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
-}
-
-FUNCINLINE static ATTRINLINE void I_UpdateStream8M(Uint8 *stream, int len)
-{
-	// Mix current sound data.
-	// Data, from raw sound
-	register Sint16 d; // Mono 8bit stream
-	register Uint8 sample; // Center 8bit sfx
-
-	// Pointers in audio stream
-	Sint8 *monoout = (Sint8 *)stream; // currect mono
-	const Uint8 step = 1; // Step in stream, left and right, thus two.
-
-	INT32 chan; // Mixing channel index.
-
-	// Determine end of the stream
-	//len /= 1; // not 8bit mono samples, 8bit mono ones?
-
-	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
-
-	// Mix sounds into the mixing buffer.
-	// Loop over len
-	while (len--)
-	{
-		// Reset left/right value.
-		d = *monoout;
-
-		// Love thy L2 cache - made this a loop.
-		// Now more channels could be set at compile time
-		//  as well. Thus loop those channels.
-		for (chan = 0; chan < NUM_CHANNELS; chan++)
-		{
-			// Check channel, if active.
-			if (channels[chan].end)
-			{
-#if 1
-				// Get the raw data from the channel.
-				sample = channels[chan].data[0];
-#else
-				// linear filtering from PrDoom
-				sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder))
-					+ ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16;
-#endif
-				// Add left and right part
-				//  for this channel (sound)
-				//  to the current data.
-				// Adjust volume accordingly.
-				d = (Sint16)(d+((channels[chan].leftvol_lookup[sample] + channels[chan].rightvol_lookup[sample])>>9));
-				// Increment stepage
-				channels[chan].stepremainder += channels[chan].step;
-				// Check whether we are done.
-				if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end)
-					channels[chan].end = NULL;
-				else
-				{
-					// step to next sample
-					channels[chan].data += (channels[chan].stepremainder >> 16);
-					// Limit to LSB???
-					channels[chan].stepremainder &= 0xffff;
-				}
-			}
-		}
-
-		// Clamp to range. Left hardware channel.
-		// Has been char instead of short.
-
-		if (d > 0x7f)
-			*monoout = 0x7f;
-		else if (d < -0x80)
-			*monoout = -0x80;
-		else
-			*monoout = (Sint8)d;
-
-		// Increment current pointers in stream
-		monoout += step;
-	}
-	if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
-}
-
-FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len)
-{
-	// Mix current sound data.
-	// Data, from raw sound
-	register Sint32 dr; // Right 16bit stream
-	register Uint8 sample; // Center 8bit sfx
-	register Sint32 dl; // Left 16bit stream
-
-	// Pointers in audio stream
-	Sint16 *rightout = (Sint16 *)(void *)stream; // currect right
-	Sint16 *leftout = rightout + 1;// currect left
-	const Uint8 step = 2; // Step in stream, left and right, thus two.
-
-	INT32 chan; // Mixing channel index.
-
-	// Determine end of the stream
-	len /= 4; // not 8bit mono samples, 16bit stereo ones
-
-	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
-
-	// Mix sounds into the mixing buffer.
-	// Loop over len
-	while (len--)
-	{
-		// Reset left/right value.
-		dl = *leftout;
-		dr = *rightout;
-
-		// Love thy L2 cache - made this a loop.
-		// Now more channels could be set at compile time
-		//  as well. Thus loop those channels.
-		for (chan = 0; chan < NUM_CHANNELS; chan++)
-		{
-			// Check channel, if active.
-			if (channels[chan].end)
-			{
-#if 1
-				// Get the raw data from the channel.
-				sample = channels[chan].data[0];
-#else
-				// linear filtering from PrDoom
-				sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder))
-					+ ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16;
-#endif
-				// Add left and right part
-				//  for this channel (sound)
-				//  to the current data.
-				// Adjust volume accordingly.
-				dl += channels[chan].leftvol_lookup[sample];
-				dr += channels[chan].rightvol_lookup[sample];
-				// Increment stepage
-				channels[chan].stepremainder += channels[chan].step;
-				// Check whether we are done.
-				if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end)
-					channels[chan].end = NULL;
-				else
-				{
-					// step to next sample
-					channels[chan].data += (channels[chan].stepremainder >> 16);
-					// Limit to LSB???
-					channels[chan].stepremainder &= 0xffff;
-				}
-			}
-		}
-
-		// Clamp to range. Left hardware channel.
-		// Has been char instead of short.
-
-		if (dl > 0x7fff)
-			*leftout = 0x7fff;
-		else if (dl < -0x8000)
-			*leftout = -0x8000;
-		else
-			*leftout = (Sint16)dl;
-
-		// Same for right hardware channel.
-		if (dr > 0x7fff)
-			*rightout = 0x7fff;
-		else if (dr < -0x8000)
-			*rightout = -0x8000;
-		else
-			*rightout = (Sint16)dr;
-
-		// Increment current pointers in stream
-		leftout += step;
-		rightout += step;
-
-	}
-	if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
-}
-
-FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len)
-{
-	// Mix current sound data.
-	// Data, from raw sound
-	register Sint32 d; // Mono 16bit stream
-	register Uint8 sample; // Center 8bit sfx
-
-	// Pointers in audio stream
-	Sint16 *monoout = (Sint16 *)(void *)stream; // currect mono
-	const Uint8 step = 1; // Step in stream, left and right, thus two.
-
-	INT32 chan; // Mixing channel index.
-
-	// Determine end of the stream
-	len /= 2; // not 8bit mono samples, 16bit mono ones
-
-	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
-
-	// Mix sounds into the mixing buffer.
-	// Loop over len
-	while (len--)
-	{
-		// Reset left/right value.
-		d = *monoout;
-
-		// Love thy L2 cache - made this a loop.
-		// Now more channels could be set at compile time
-		//  as well. Thus loop those channels.
-		for (chan = 0; chan < NUM_CHANNELS; chan++)
-		{
-			// Check channel, if active.
-			if (channels[chan].end)
-			{
-#if 1
-				// Get the raw data from the channel.
-				sample = channels[chan].data[0];
-#else
-				// linear filtering from PrDoom
-				sample = (((Uint32)channels[chan].data[0] *(0x10000 - channels[chan].stepremainder))
-					+ ((Uint32)channels[chan].data[1]) * (channels[chan].stepremainder))) >> 16;
-#endif
-				// Add left and right part
-				//  for this channel (sound)
-				//  to the current data.
-				// Adjust volume accordingly.
-				d += (channels[chan].leftvol_lookup[sample] + channels[chan].rightvol_lookup[sample])>>1;
-				// Increment stepage
-				channels[chan].stepremainder += channels[chan].step;
-				// Check whether we are done.
-				if (channels[chan].data + (channels[chan].stepremainder >> 16) >= channels[chan].end)
-					channels[chan].end = NULL;
-				else
-				{
-					// step to next sample
-					channels[chan].data += (channels[chan].stepremainder >> 16);
-					// Limit to LSB???
-					channels[chan].stepremainder &= 0xffff;
-				}
-			}
-		}
-
-		// Clamp to range. Left hardware channel.
-		// Has been char instead of short.
-
-		if (d > 0x7fff)
-			*monoout = 0x7fff;
-		else if (d < -0x8000)
-			*monoout = -0x8000;
-		else
-			*monoout = (Sint16)d;
-
-		// Increment current pointers in stream
-		monoout += step;
-	}
-	if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex);
-}
-
-#ifdef HAVE_LIBGME
-static void I_UpdateSteamGME(Music_Emu *emu, INT16 *stream, int len, UINT8 looping)
-{
-	#define GME_BUFFER_LEN 44100*2048
-	// Mix current sound data.
-	// Data, from raw sound
-	register Sint32 da;
-
-	static short gme_buffer[GME_BUFFER_LEN]; // a large buffer for gme
-	Sint16 *in = gme_buffer;
-
-	do
-	{
-		int out = min(GME_BUFFER_LEN, len);
-		if ( gme_play( emu, len, gme_buffer ) ) { } // ignore error
-		len -= out;
-		while (out--)
-		{
-			//Left
-			da = *in;
-			in++;
-			da += *stream;
-			stream++;
-			//Right
-			da = *in;
-			in++;
-			da += *stream;
-			stream++;
-		}
-		if (gme_track_ended( emu ))
-		{
-			if (looping)
-				gme_seek( emu, 0);
-			else
-				break;
-		}
-	} while ( len );
-	#undef GME_BUFFER_LEN
-}
-#endif
-
-static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len)
-{
-	if (!sound_started || !userdata)
-		return;
-
-#if SDL_VERSION_ATLEAST(1,3,0)
-	if (musicStarted)
-		memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
-#endif
-
-	if ((audio.channels != 1 && audio.channels != 2) ||
-	    (audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS))
-		; // no function to encode this type of stream
-	else if (audio.channels == 1 && audio.format == AUDIO_S8)
-		I_UpdateStream8M(stream, len);
-	else if (audio.channels == 2 && audio.format == AUDIO_S8)
-		I_UpdateStream8S(stream, len);
-	else if (audio.channels == 1 && audio.format == AUDIO_S16SYS)
-		I_UpdateStream16M(stream, len);
-	else if (audio.channels == 2 && audio.format == AUDIO_S16SYS)
-	{
-		I_UpdateStream16S(stream, len);
-#ifdef HAVE_LIBGME
-		if (userdata)
-		{
-			srb2audio_t *sa_userdata = userdata;
-			if (!sa_userdata->gme_pause)
-				I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop);
-		}
-#endif
-
-	}
-}
-
-void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch)
-{
-	// Would be using the handle to identify
-	//  on which channel the sound might be active,
-	//  and resetting the channel parameters.
-
-	INT32 i = FindChannel(handle);
-
-	if (i != -1 && channels[i].end)
-	{
-		//Snd_LockAudio(); //Alam: too much?
-		I_SetChannelParams(&channels[i], vol, sep, steptable[pitch]);
-		//Snd_UnlockAudio(); //Alam: too much?
-	}
-
-}
-
-#ifdef HW3SOUND
-
-static void *soundso = NULL;
-
-static INT32 Init3DSDriver(const char *soName)
-{
-	if (soName) soundso = hwOpen(soName);
-#if defined (_WIN32) && defined (_X86_) && !defined (STATIC3DS)
-	HW3DS.pfnStartup            = hwSym("Startup@8",soundso);
-	HW3DS.pfnShutdown           = hwSym("Shutdown@0",soundso);
-	HW3DS.pfnAddSfx             = hwSym("AddSfx@4",soundso);
-	HW3DS.pfnAddSource          = hwSym("AddSource@8",soundso);
-	HW3DS.pfnStartSource        = hwSym("StartSource@4",soundso);
-	HW3DS.pfnStopSource         = hwSym("StopSource@4",soundso);
-	HW3DS.pfnGetHW3DSVersion    = hwSym("GetHW3DSVersion@0",soundso);
-	HW3DS.pfnBeginFrameUpdate   = hwSym("BeginFrameUpdate@0",soundso);
-	HW3DS.pfnEndFrameUpdate     = hwSym("EndFrameUpdate@0",soundso);
-	HW3DS.pfnIsPlaying          = hwSym("IsPlaying@4",soundso);
-	HW3DS.pfnUpdateListener     = hwSym("UpdateListener@8",soundso);
-	HW3DS.pfnUpdateSourceParms  = hwSym("UpdateSourceParms@12",soundso);
-	HW3DS.pfnSetCone            = hwSym("SetCone@8",soundso);
-	HW3DS.pfnSetGlobalSfxVolume = hwSym("SetGlobalSfxVolume@4",soundso);
-	HW3DS.pfnUpdate3DSource     = hwSym("Update3DSource@8",soundso);
-	HW3DS.pfnReloadSource       = hwSym("ReloadSource@8",soundso);
-	HW3DS.pfnKillSource         = hwSym("KillSource@4",soundso);
-	HW3DS.pfnKillSfx            = hwSym("KillSfx@4",soundso);
-	HW3DS.pfnGetHW3DSTitle      = hwSym("GetHW3DSTitle@8",soundso);
-#else
-	HW3DS.pfnStartup            = hwSym("Startup",soundso);
-	HW3DS.pfnShutdown           = hwSym("Shutdown",soundso);
-	HW3DS.pfnAddSfx             = hwSym("AddSfx",soundso);
-	HW3DS.pfnAddSource          = hwSym("AddSource",soundso);
-	HW3DS.pfnStartSource        = hwSym("StartSource",soundso);
-	HW3DS.pfnStopSource         = hwSym("StopSource",soundso);
-	HW3DS.pfnGetHW3DSVersion    = hwSym("GetHW3DSVersion",soundso);
-	HW3DS.pfnBeginFrameUpdate   = hwSym("BeginFrameUpdate",soundso);
-	HW3DS.pfnEndFrameUpdate     = hwSym("EndFrameUpdate",soundso);
-	HW3DS.pfnIsPlaying          = hwSym("IsPlaying",soundso);
-	HW3DS.pfnUpdateListener     = hwSym("UpdateListener",soundso);
-	HW3DS.pfnUpdateSourceParms  = hwSym("UpdateSourceParms",soundso);
-	HW3DS.pfnSetCone            = hwSym("SetCone",soundso);
-	HW3DS.pfnSetGlobalSfxVolume = hwSym("SetGlobalSfxVolume",soundso);
-	HW3DS.pfnUpdate3DSource     = hwSym("Update3DSource",soundso);
-	HW3DS.pfnReloadSource       = hwSym("ReloadSource",soundso);
-	HW3DS.pfnKillSource         = hwSym("KillSource",soundso);
-	HW3DS.pfnKillSfx            = hwSym("KillSfx",soundso);
-	HW3DS.pfnGetHW3DSTitle      = hwSym("GetHW3DSTitle",soundso);
-#endif
-
-//	if (HW3DS.pfnUpdateListener2 && HW3DS.pfnUpdateListener2 != soundso)
-		return true;
-//	else
-//		return false;
-}
-#endif
-
-void I_ShutdownSound(void)
-{
-	if (nosound || !sound_started)
-		return;
-
-	CONS_Printf("I_ShutdownSound: ");
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-	{
-		HW3S_Shutdown();
-		hwClose(soundso);
-		return;
-	}
-#endif
-
-	if (nomidimusic && nodigimusic)
-		SDL_CloseAudio();
-	CONS_Printf("%s", M_GetText("shut down\n"));
-	sound_started = false;
-	SDL_QuitSubSystem(SDL_INIT_AUDIO);
-	if (Snd_Mutex)
-		SDL_DestroyMutex(Snd_Mutex);
-	Snd_Mutex = NULL;
-}
-
-void I_UpdateSound(void)
-{
-}
-
-void I_StartupSound(void)
-{
-#ifdef HW3SOUND
-	const char *sdrv_name = NULL;
-#endif
-#ifndef HAVE_MIXER
-	nomidimusic = nodigimusic = true;
-#endif
-#ifdef DC
-	//nosound = true;
-#ifdef HAVE_MIXER
-	nomidimusic = true;
-	nodigimusic = true;
-#endif
-#endif
-
-	memset(channels, 0, sizeof (channels)); //Alam: Clean it
-
-	audio.format = AUDIO_S16SYS;
-	audio.channels = 2;
-	audio.callback = I_UpdateStream;
-	audio.userdata = &localdata;
-
-	if (dedicated)
-	{
-		nosound = nomidimusic = nodigimusic = true;
-		return;
-	}
-
-	// Configure sound device
-	CONS_Printf("I_StartupSound:\n");
-
-	// Open the audio device
-	if (M_CheckParm ("-freq") && M_IsNextParm())
-	{
-		audio.freq = atoi(M_GetNextParm());
-		if (!audio.freq) audio.freq = cv_samplerate.value;
-		audio.samples = (Uint16)((samplecount/2)*(INT32)(audio.freq/11025)); //Alam: to keep it around the same XX ms
-		CONS_Printf (M_GetText(" requested frequency of %d hz\n"), audio.freq);
-	}
-	else
-	{
-		audio.samples = samplecount;
-		audio.freq = cv_samplerate.value;
-	}
-
-	if (M_CheckParm ("-mono"))
-	{
-		audio.channels = 1;
-		audio.samples /= 2;
-	}
-
-#if defined (_PSP)  && defined (HAVE_MIXER) // Bug in PSP's SDL_OpenAudio, can not open twice
-	I_SetChannels();
-	sound_started = true;
-	Snd_Mutex = SDL_CreateMutex();
-#else
-	if (nosound)
-#endif
-		return;
-
-#ifdef HW3SOUND
-#ifdef STATIC3DS
-	if (M_CheckParm("-3dsound") || M_CheckParm("-ds3d"))
-	{
-		hws_mode = HWS_OPENAL;
-	}
-#elif defined (_WIN32)
-	if (M_CheckParm("-ds3d"))
-	{
-		hws_mode = HWS_DS3D;
-		sdrv_name = "s_ds3d.dll";
-	}
-	else if (M_CheckParm("-fmod3d"))
-	{
-		hws_mode = HWS_FMOD3D;
-		sdrv_name = "s_fmod.dll";
-	}
-	else if (M_CheckParm("-openal"))
-	{
-		hws_mode = HWS_OPENAL;
-		sdrv_name = "s_openal.dll";
-	}
-#else
-	if (M_CheckParm("-fmod3d"))
-	{
-		hws_mode = HWS_FMOD3D;
-		sdrv_name = "./s_fmod.so";
-	}
-	else if (M_CheckParm("-openal"))
-	{
-		hws_mode = HWS_OPENAL;
-		sdrv_name = "./s_openal.so";
-	}
-#endif
-	else if (M_CheckParm("-sounddriver") &&  M_IsNextParm())
-	{
-		hws_mode = HWS_OTHER;
-		sdrv_name = M_GetNextParm();
-	}
-	if (hws_mode != HWS_DEFAULT_MODE)
-	{
-		if (Init3DSDriver(sdrv_name))
-		{
-			snddev_t            snddev;
-
-			//nosound = true;
-			//I_AddExitFunc(I_ShutdownSound);
-			snddev.bps = 16;
-			snddev.sample_rate = audio.freq;
-			snddev.numsfxs = NUMSFX;
-#if defined (_WIN32) && !defined (_XBOX)
-			snddev.cooplevel = 0x00000002;
-			snddev.hWnd = vid.WndParent;
-#endif
-			if (HW3S_Init(I_Error, &snddev))
-			{
-				audio.userdata = NULL;
-				CONS_Printf("%s", M_GetText(" Using 3D sound driver\n"));
-				return;
-			}
-			CONS_Printf("%s", M_GetText(" Failed loading 3D sound driver\n"));
-			// Falls back to default sound system
-			HW3S_Shutdown();
-			hwClose(soundso);
-		}
-		CONS_Printf("%s", M_GetText(" Failed loading 3D sound driver\n"));
-		hws_mode = HWS_DEFAULT_MODE;
-	}
-#endif
-	if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0)
-	{
-		CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
-		nosound = true;
-		return;
-	}
-	else
-	{
-		char ad[100];
-		CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
-	}
-	samplecount = audio.samples;
-	CV_SetValue(&cv_samplerate, audio.freq);
-	CONS_Printf(M_GetText(" configured audio device with %d samples/slice at %ikhz(%dms buffer)\n"), samplecount, audio.freq/1000, (INT32) (((float)audio.samples * 1000.0f) / audio.freq));
-	// Finished initialization.
-	CONS_Printf("%s", M_GetText(" Sound module ready\n"));
-	//[segabor]
-	if (!musicStarted) SDL_PauseAudio(0);
-	//Mix_Pause(0);
-	I_SetChannels();
-	sound_started = true;
-	Snd_Mutex = SDL_CreateMutex();
-}
-
-//
-// MUSIC API.
-//
-
-void I_ShutdownMIDIMusic(void)
-{
-	nomidimusic = false;
-	if (nodigimusic) I_ShutdownMusic();
-}
-
-#ifdef HAVE_LIBGME
-static void I_ShutdownGMEMusic(void)
-{
-	Snd_LockAudio();
-	if (localdata.gme_emu)
-		gme_delete(localdata.gme_emu);
-	localdata.gme_emu = NULL;
-	Snd_UnlockAudio();
-}
-#endif
-
-void I_ShutdownDigMusic(void)
-{
-	nodigimusic = false;
-	if (nomidimusic) I_ShutdownMusic();
-}
-
-#ifdef HAVE_MIXER
-static boolean LoadSong(void *data, size_t lumplength, size_t selectpos)
-{
-	FILE *midfile;
-	const char *tempname;
-#ifdef USE_RWOPS
-	if (canuseRW)
-	{
-		SDL_RWops *SDLRW;
-		void *olddata = Smidi[selectpos]; //quick shortcut to set
-
-		Z_Free(olddata); //free old memory
-		Smidi[selectpos] = NULL;
-
-		if (!data)
-			return olddata != NULL; //was there old data?
-
-		SDLRW = SDL_RWFromConstMem(data, (int)lumplength); //new RWops from Z_zone
-		if (!SDLRW) //ERROR while making RWops!
-		{
-			CONS_Printf(M_GetText("Couldn't load music lump: %s\n"), SDL_GetError());
-			Z_Free(data);
-			return false;
-		}
-
-		music[selectpos] = Mix_LoadMUS_RW(SDLRW); // new Mix_Chuck from RWops
-		if (music[selectpos])
-			Smidi[selectpos] = data; //all done
-		else //ERROR while making Mix_Chuck
-		{
-			CONS_Printf(M_GetText("Couldn't load music data: %s\n"), Mix_GetError());
-			Z_Free(data);
-			SDL_RWclose(SDLRW);
-			Smidi[selectpos] = NULL;
-		}
-		return true;
-	}
-#endif
-	tempname = va("%s/%s", MIDI_PATH, fmidi[selectpos]);
-
-	if (!data)
-	{
-		if (FIL_FileExists(tempname))
-			return unlink(tempname)+1;
-#ifdef MIDI_PATH2
-		else if (FIL_FileExists(tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos])))
-			return unlink(tempname)+1;
-#endif
-		else
-			return false;
-	}
-
-	midfile = fopen(tempname, "wb");
-
-#ifdef MIDI_PATH2
-	if (!midfile)
-	{
-		tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]);
-		midfile = fopen(tempname, "wb");
-	}
-#endif
-
-	if (!midfile)
-	{
-		CONS_Printf(M_GetText("Couldn't open file %s to write music in\n"), tempname);
-		Z_Free(data);
-		return false;
-	}
-
-	if (fwrite(data, lumplength, 1, midfile) == 0)
-	{
-		CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile)));
-		Z_Free(data);
-		fclose(midfile);
-		return false;
-	}
-
-	fclose(midfile);
-
-	Z_Free(data);
-
-	music[selectpos] = Mix_LoadMUS(tempname);
-	if (!music[selectpos]) //ERROR while making Mix_Chuck
-	{
-		CONS_Printf(M_GetText("Couldn't load music file %s: %s\n"), tempname, Mix_GetError());
-		return false;
-	}
-	return true;
-}
-#endif
-
-
-void I_ShutdownMusic(void)
-{
-#ifdef HAVE_MIXER
-	if ((nomidimusic && nodigimusic) || !musicStarted)
-		return;
-
-	CONS_Printf("%s", M_GetText("I_ShutdownMusic: "));
-
-	I_UnRegisterSong(0);
-	I_StopDigSong();
-	Mix_CloseAudio();
-#ifdef MIX_INIT
-	Mix_Quit();
-#endif
-	CONS_Printf("%s", M_GetText("shut down\n"));
-	musicStarted = SDL_FALSE;
-	if (Msc_Mutex)
-		SDL_DestroyMutex(Msc_Mutex);
-	Msc_Mutex = NULL;
-#endif
-}
-
-void I_InitMIDIMusic(void)
-{
-	if (nodigimusic) I_InitMusic();
-}
-
-void I_InitDigMusic(void)
-{
-	if (nomidimusic) I_InitMusic();
-}
-
-void I_InitMusic(void)
-{
-#ifdef HAVE_MIXER
-	char ad[100];
-	SDL_version MIXcompiled;
-	const SDL_version *MIXlinked;
-#ifdef MIXER_INIT
-	const int mixstart = MIX_INIT_OGG;
-	int mixflags;
-#endif
-#endif
-#ifdef HAVE_LIBGME
-	I_AddExitFunc(I_ShutdownGMEMusic);
-#endif
-
-	if ((nomidimusic && nodigimusic) || dedicated)
-		return;
-
-#ifdef HAVE_MIXER
-	MIX_VERSION(&MIXcompiled)
-	MIXlinked = Mix_Linked_Version();
-	I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n",
-	            MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch);
-#ifdef MIXER_POS
-#ifndef _WII
-	if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7)
-#endif
-		canlooping = SDL_FALSE;
-#endif
-#ifdef USE_RWOPS
-	if (M_CheckParm("-noRW"))
-		canuseRW = SDL_FALSE;
-#endif
-	I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n",
-	            MIXlinked->major, MIXlinked->minor, MIXlinked->patch);
-#if !(defined (DC) || defined (PSP) || defined(GP2X) || defined (WII))
-	if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz
-	{
-		audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq));
-		audio.freq = 44100; //Alam: to keep it around the same XX ms
-	}
-#endif
-
-	if (sound_started
-#ifdef HW3SOUND
-		&& hws_mode == HWS_DEFAULT_MODE
-#endif
-		)
-	{
-		I_OutputMsg("Temp Shutdown of SDL Audio System");
-		SDL_CloseAudio();
-		I_OutputMsg(" Done\n");
-	}
-
-	CONS_Printf("%s", M_GetText("I_InitMusic:"));
-
-#ifdef MIXER_INIT
-	mixflags = Mix_Init(mixstart);
-	if ((mixstart & MIX_INIT_FLAC) != (mixflags & MIX_INIT_FLAC))
-	{
-		CONS_Printf("%s", M_GetText(" Unable to load FLAC support\n"));
-	}
-	if ((mixstart & MIX_INIT_MOD ) != (mixflags & MIX_INIT_MOD ))
-	{
-		CONS_Printf("%s", M_GetText(" Unable to load MOD support\n"));
-	}
-	if ((mixstart & MIX_INIT_MP3 ) != (mixflags & MIX_INIT_MP3 ))
-	{
-		CONS_Printf("%s", M_GetText(" Unable to load MP3 support\n"));
-	}
-	if ((mixstart & MIX_INIT_OGG ) != (mixflags & MIX_INIT_OGG ))
-	{
-		CONS_Printf("%s", M_GetText(" Unable to load OGG support\n"));
-	}
-#endif
-
-	if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio)
-	{
-		CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError());
-		nomidimusic = nodigimusic = true;
-		if (sound_started
-#ifdef HW3SOUND
-			&& hws_mode == HWS_DEFAULT_MODE
-#endif
-			)
-		{
-			if (SDL_OpenAudio(&audio, NULL) < 0) //retry
-			{
-				CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n"));
-				nosound = true;
-				sound_started = false;
-			}
-			else
-			{
-				CONS_Printf(M_GetText(" Starting with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
-			}
-		}
-		return;
-	}
-	else
-		CONS_Printf(M_GetText(" Starting up with audio driver : %s with SDL_Mixer\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
-
-	samplecount = audio.samples;
-	CV_SetValue(&cv_samplerate, audio.freq);
-	if (sound_started
-#ifdef HW3SOUND
-		&& hws_mode == HWS_DEFAULT_MODE
-#endif
-		)
-		I_OutputMsg(" Reconfigured SDL Audio System");
-	else I_OutputMsg(" Configured SDL_Mixer System");
-	I_OutputMsg(" with %d samples/slice at %ikhz(%dms buffer)\n", samplecount, audio.freq/1000, (INT32) ((audio.samples * 1000.0f) / audio.freq));
-	Mix_SetPostMix(audio.callback, audio.userdata);  // after mixing music, add sound effects
-	Mix_Resume(-1);
-	CONS_Printf("%s", M_GetText("Music initialized\n"));
-	musicStarted = SDL_TRUE;
-	Msc_Mutex = SDL_CreateMutex();
-#endif
-}
-
-boolean I_PlaySong(INT32 handle, boolean looping)
-{
-	(void)handle;
-#ifdef HAVE_MIXER
-	if (nomidimusic || !musicStarted || !music[handle])
-		return false;
-
-#ifdef MIXER_POS
-	if (canlooping)
-		Mix_HookMusicFinished(NULL);
-#endif
-
-	if (Mix_FadeInMusic(music[handle], looping ? -1 : 0, MIDIfade) == -1)
-		CONS_Printf(M_GetText("Couldn't play song because %s\n"), Mix_GetError());
-	else
-	{
-		Mix_VolumeMusic(musicvol);
-		return true;
-	}
-#else
-	(void)looping;
-#endif
-	return false;
-}
-
-static void I_PauseGME(void)
-{
-#ifdef HAVE_LIBGME
-	localdata.gme_pause = true;
-#endif
-}
-
-void I_PauseSong(INT32 handle)
-{
-	(void)handle;
-	I_PauseGME();
-#ifdef HAVE_MIXER
-	if ((nomidimusic && nodigimusic) || !musicStarted)
-		return;
-
-	Mix_PauseMusic();
-	//I_StopSong(handle);
-#endif
-}
-
-static void I_ResumeGME(void)
-{
-#ifdef HAVE_LIBGME
-	localdata.gme_pause = false;
-#endif
-}
-
-void I_ResumeSong(INT32 handle)
-{
-	(void)handle;
-	I_ResumeGME();
-#ifdef HAVE_MIXER
-	if ((nomidimusic && nodigimusic) || !musicStarted)
-		return;
-
-	Mix_VolumeMusic(musicvol);
-	Mix_ResumeMusic();
-	//I_PlaySong(handle, true);
-#endif
-}
-
-void I_StopSong(INT32 handle)
-{
-	(void)handle;
-#ifdef HAVE_MIXER
-	if (nomidimusic || !musicStarted)
-		return;
-	Mix_FadeOutMusic(MIDIfade);
-#endif
-}
-
-void I_UnRegisterSong(INT32 handle)
-{
-#ifdef HAVE_MIXER
-
-	if (nomidimusic || !musicStarted)
-		return;
-
-	Mix_HaltMusic();
-	while (Mix_PlayingMusic())
-		;
-
-	if (music[handle])
-		Mix_FreeMusic(music[handle]);
-	music[handle] = NULL;
-	LoadSong(NULL, 0, handle);
-#else
-	(void)handle;
-#endif
-}
-
-INT32 I_RegisterSong(void *data, size_t len)
-{
-#ifdef HAVE_MIXER
-	if (nomidimusic || !musicStarted)
-		return false;
-
-	if (!LoadSong(data, len, 0))
-		return false;
-
-	if (music[0])
-		return true;
-
-	CONS_Printf(M_GetText("Couldn't load MIDI: %s\n"), Mix_GetError());
-#else
-	(void)len;
-	(void)data;
-#endif
-	return false;
-}
-
-void I_SetMIDIMusicVolume(UINT8 volume)
-{
-#ifdef HAVE_MIXER
-	if ((nomidimusic && nodigimusic) || !musicStarted)
-		return;
-
-	if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
-	musicvol = volume * 2;
-	if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
-	Mix_VolumeMusic(musicvol);
-#else
-	(void)volume;
-#endif
-}
-
-#ifdef HAVE_LIBGME
-static void I_CleanupGME(void *userdata)
-{
-	Z_Free(userdata);
-}
-#endif
-
-static boolean I_StartGMESong(const char *musicname, boolean looping)
-{
-#ifdef HAVE_LIBGME
-	XBOXSTATIC char filename[9];
-	void *data;
-	lumpnum_t lumpnum;
-	size_t lumplength;
-	Music_Emu *emu;
-	const char* gme_err;
-
-	Snd_LockAudio();
-	if (localdata.gme_emu)
-		gme_delete(localdata.gme_emu);
-	localdata.gme_emu = NULL;
-	Snd_UnlockAudio();
-
-	snprintf(filename, sizeof filename, "o_%s", musicname);
-
-	lumpnum = W_CheckNumForName(filename);
-
-	if (lumpnum == LUMPERROR)
-	{
-		return false; // No music found. Oh well!
-	}
-	else
-		lumplength = W_LumpLength(lumpnum);
-
-	data = W_CacheLumpNum(lumpnum, PU_MUSIC);
-
-	gme_err = gme_open_data(data, (long)lumplength, &emu, audio.freq);
-	if (gme_err != NULL) {
-		//I_OutputMsg("I_StartGMESong: error %s\n",gme_err);
-		return false;
-	}
-	gme_set_user_data(emu, data);
-	gme_set_user_cleanup(emu, I_CleanupGME);
-	gme_start_track(emu, 0);
-	gme_set_fade(emu, Digfade);
-
-	Snd_LockAudio();
-	localdata.gme_emu = emu;
-	localdata.gme_pause = false;
-	localdata.gme_loop = (UINT8)looping;
-	Snd_UnlockAudio();
-
-	return true;
-#else
-	(void)musicname;
-	(void)looping;
-#endif
-	return false;
-}
-
-boolean I_StartDigSong(const char *musicname, boolean looping)
-{
-#ifdef HAVE_MIXER
-	XBOXSTATIC char filename[9];
-	void *data;
-	lumpnum_t lumpnum;
-	size_t lumplength;
-#endif
-
-	if(I_StartGMESong(musicname, looping))
-		return true;
-
-#ifdef HAVE_MIXER
-	if (nodigimusic)
-		return false;
-
-	snprintf(filename, sizeof filename, "o_%s", musicname);
-
-	lumpnum = W_CheckNumForName(filename);
-
-	I_StopDigSong();
-
-	if (lumpnum == LUMPERROR)
-	{
-		// Alam_GBC: like in win32/win_snd.c: Graue 02-29-2004: don't worry about missing music, there might still be a MIDI
-		//I_OutputMsg("Music lump %s not found!\n", filename);
-		return false; // No music found. Oh well!
-	}
-	else
-		lumplength = W_LumpLength(lumpnum);
-
-	data = W_CacheLumpNum(lumpnum, PU_MUSIC);
-
-	if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
-
-#ifdef MIXER_POS
-	if (canlooping && (loopingDig = looping) == SDL_TRUE && strcmp(data, "OggS")  == 0)
-		looping = false; // Only on looping Ogg files, will we will do our own looping
-
-	// Scan the Ogg Vorbis file for the COMMENT= field for a custom
-	// loop point
-	if (!looping && loopingDig)
-	{
-		size_t scan;
-		const char *dataum = data;
-		XBOXSTATIC char looplength[64];
-		UINT32 loopstart = 0;
-		UINT8 newcount = 0;
-
-		Mix_HookMusicFinished(I_FinishMusic);
-
-		for (scan = 0; scan < lumplength; scan++)
-		{
-			if (*dataum++ == 'C'){
-			if (*dataum++ == 'O'){
-			if (*dataum++ == 'M'){
-			if (*dataum++ == 'M'){
-			if (*dataum++ == 'E'){
-			if (*dataum++ == 'N'){
-			if (*dataum++ == 'T'){
-			if (*dataum++ == '='){
-			if (*dataum++ == 'L'){
-			if (*dataum++ == 'O'){
-			if (*dataum++ == 'O'){
-			if (*dataum++ == 'P'){
-			if (*dataum++ == 'P'){
-			if (*dataum++ == 'O'){
-			if (*dataum++ == 'I'){
-			if (*dataum++ == 'N'){
-			if (*dataum++ == 'T'){
-			if (*dataum++ == '=')
-			{
-
-				while (*dataum != 1 && newcount != 63)
-					looplength[newcount++] = *dataum++;
-
-				looplength[newcount] = '\0';
-
-				loopstart = atoi(looplength);
-
-			}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-			else
-				dataum--;}
-		}
-
-		if (loopstart > 0)
-		{
-			loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs
-//#ifdef GP2X//#ifdef PARANOIA
-			//I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig);
-//#endif
-		}
-		else
-		{
-			looping = true; // loopingDig true, but couldn't find start loop point
-		}
-	}
-	else
-		loopstartDig = 0.0l;
-#else
-	if (looping && strcmp(data, "OggS")  == 0)
-		I_OutputMsg("I_StartDigSong: SRB2 was not compiled with looping music support(no Mix_FadeInMusicPos)\n");
-#endif
-
-	if (!LoadSong(data, lumplength, 1))
-	{
-		if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
-		return false;
-	}
-
-	// Note: LoadSong() frees the data. Let's make sure
-	// we don't try to use the data again.
-	data = NULL;
-
-	if (Mix_FadeInMusic(music[1], looping ? -1 : 0, Digfade) == -1)
-	{
-		if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
-		I_OutputMsg("I_StartDigSong: Couldn't play song %s because %s\n", musicname, Mix_GetError());
-		return false;
-	}
-	Mix_VolumeMusic(musicvol);
-
-	if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
-	return true;
-#else
-	(void)looping;
-	(void)musicname;
-	return false;
-#endif
-}
-
-static void I_StopGME(void)
-{
-#ifdef HAVE_LIBGME
-	Snd_LockAudio();
-	gme_seek(localdata.gme_emu, 0);
-	Snd_UnlockAudio();
-#endif
-}
-
-void I_StopDigSong(void)
-{
-	I_StopGME();
-#ifdef HAVE_MIXER
-	if (nodigimusic)
-		return;
-
-#ifdef MIXER_POS
-	if (canlooping)
-		Mix_HookMusicFinished(NULL);
-#endif
-
-	Mix_HaltMusic();
-	while (Mix_PlayingMusic())
-		;
-
-	if (music[1])
-		Mix_FreeMusic(music[1]);
-	music[1] = NULL;
-	LoadSong(NULL, 0, 1);
-#endif
-}
-
-void I_SetDigMusicVolume(UINT8 volume)
-{
-	I_SetMIDIMusicVolume(volume);
-}
-
-boolean I_SetSongSpeed(float speed)
-{
-
-	(void)speed;
-	return false;
-}
-
-boolean I_SetSongTrack(int track)
-{
-	(void)track;
-	return false;
-}
-
-#ifdef MIXER_POS
-static void SDLCALL I_FinishMusic(void)
-{
-	if (!music[1])
-		return;
-	else if (Msc_Mutex) SDL_LockMutex(Msc_Mutex);
-//		I_OutputMsg("I_FinishMusic: Loopping song to %g seconds\n", loopstartDig);
-
-	if (Mix_FadeInMusicPos(music[1], loopstartDig ? 0 : -1, Digfade, loopstartDig) == 0)
-		Mix_VolumeMusic(musicvol);
-	else
-		I_OutputMsg("I_FinishMusic: Couldn't loop song because %s\n", Mix_GetError());
-
-	if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
-}
-#endif
-#endif //HAVE_SDL
diff --git a/src/sdl12/sdlmain.h b/src/sdl12/sdlmain.h
deleted file mode 100644
index 1e497b10dcca125916b09c515d43eb0e0dcdd8db..0000000000000000000000000000000000000000
--- a/src/sdl12/sdlmain.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 2006 by Sonic Team Jr.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief System specific interface stuff.
-
-#ifndef __sdlmain__
-#define __sdlmain__
-
-extern SDL_bool consolevent;
-extern SDL_bool framebuffer;
-
-/**	\brief	The JoyInfo_s struct
-
-  info about joystick
-*/
-typedef struct SDLJoyInfo_s
-{
-	/// Joystick handle
-	SDL_Joystick *dev;
-	/// number of old joystick
-	int oldjoy;
-	/// number of axies
-	int axises;
-	/// scale of axises
-	INT32 scale;
-	/// number of buttons
-	int buttons;
-	/// number of hats
-	int hats;
-	/// number of balls
-	int balls;
-
-} SDLJoyInfo_t;
-
-/**	\brief SDL info about joystick 1
-*/
-extern SDLJoyInfo_t JoyInfo;
-
-/**	\brief joystick axis deadzone
-*/
-#define SDL_JDEADZONE 153
-#undef SDL_JDEADZONE
-
-/**	\brief SDL inof about joystick 2
-*/
-extern SDLJoyInfo_t JoyInfo2;
-
-void I_GetConsoleEvents(void);
-
-void SDLforceUngrabMouse(void);
-
-#endif
diff --git a/src/sdl12/srb2.ttf b/src/sdl12/srb2.ttf
deleted file mode 100644
index 53f4c6a28a2adc0c97df4a7570ace24cf4949580..0000000000000000000000000000000000000000
Binary files a/src/sdl12/srb2.ttf and /dev/null differ
diff --git a/src/sounds.c b/src/sounds.c
index 2c1c5f3af6754747cbc41e52dee84abc3d6ba769..d687714ac11ba4366f3ed515168a342b3f062c66 100644
--- a/src/sounds.c
+++ b/src/sounds.c
@@ -486,7 +486,7 @@ void S_InitRuntimeSounds (void)
 {
 	sfxenum_t i;
 	INT32 value;
-	char soundname[7];
+	char soundname[10];
 
 	for (i = sfx_freeslot0; i <= sfx_lastskinsoundslot; i++)
 	{
diff --git a/src/st_stuff.c b/src/st_stuff.c
index 09d63963ff2e61b828cdfcb65316adfa811e91d8..b29b86aa05dc9007e98166a7694229d929d44196 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -706,10 +706,21 @@ static void ST_drawLives(void)
 		// skincolor face/super
 		UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->mo->color, GTC_CACHE);
 		patch_t *face = faceprefix[stplyr->skin];
-		if ((stplyr->powers[pw_super] && (stplyr->mo->state < &states[S_PLAY_SUPER_TRANS] || stplyr->mo->state > &states[S_PLAY_SUPER_TRANS9])) || (stplyr->powers[pw_carry] == CR_NIGHTSMODE && skins[stplyr->skin].flags & SF_SUPER))
+		if (stplyr->powers[pw_super])
 			face = superprefix[stplyr->skin];
 		V_DrawSmallMappedPatch(hudinfo[HUD_LIVESPIC].x, hudinfo[HUD_LIVESPIC].y + (v_splitflag ? -12 : 0),
 			V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_HUDTRANS|v_splitflag,face, colormap);
+		if (cv_translucenthud.value == 10 && stplyr->powers[pw_super] == 1 && stplyr->mo->tracer)
+		{
+			INT32 v_supertrans = (stplyr->mo->tracer->frame & FF_TRANSMASK) >> FF_TRANSSHIFT;
+			if (v_supertrans < 10)
+			{
+				v_supertrans <<= V_ALPHASHIFT;
+				colormap = R_GetTranslationColormap(stplyr->skin, stplyr->mo->tracer->color, GTC_CACHE);
+				V_DrawSmallMappedPatch(hudinfo[HUD_LIVESPIC].x, hudinfo[HUD_LIVESPIC].y + (v_splitflag ? -12 : 0),
+					V_SNAPTOLEFT|V_SNAPTOBOTTOM|v_supertrans|v_splitflag,face, colormap);
+			}
+		}
 	}
 	else if (stplyr->skincolor)
 	{
@@ -2072,7 +2083,7 @@ static void ST_overlayDrawer(void)
 						V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132)-(splitscreen ? 12 : 0), V_HUDTRANSHALF, M_GetText("You'll steal a life on respawn."));
 				}
 			}
-			else if (!gametype == GT_COOP)
+			else if (gametype != GT_COOP)
 				V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to enter the game."));
 			if (!splitscreen)
 			{
diff --git a/src/tables.c b/src/tables.c
index 6b06c81b48688e3406640fc444d9f552504119cc..e181b9aa8853a1fe4bc216c56c763d139d98b69a 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -159,12 +159,10 @@ angle_t FixedAngle(fixed_t fa)
 }
 
 
-#if !(defined _NDS) || !(defined NONET)
 #include "t_ftan.c"
 
 #include "t_fsin.c"
 fixed_t *finecosine = &finesine[FINEANGLES/4];
-#endif
 
 #include "t_tan2a.c"
 
diff --git a/src/tables.h b/src/tables.h
index e05b81845168a5b40505bcc57792714f9735db1e..03e80788abbe2febdd206d2486c82353a0043bde 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -25,7 +25,6 @@
 #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000
 #define FINEANGLE_C(x) ((FixedAngle((x)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK) // ((x*(ANGLE_45/45))>>ANGLETOFINESHIFT) & FINEMASK
 
-#if !(defined _NDS) || !(defined NONET)
 // Effective size is 10240.
 extern fixed_t finesine[5*FINEANGLES/4];
 
@@ -34,7 +33,6 @@ extern fixed_t *finecosine;
 
 // Effective size is 4096.
 extern fixed_t finetangent[FINEANGLES/2];
-#endif
 
 #define ANG1   0x00B60B61 //0.B6~
 #define ANG2   0x016C16C1 //.6C1~
@@ -112,17 +110,9 @@ void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
 // The table values in tables.c are calculated with this many fractional bits.
 #define FINE_FRACBITS 16
 
-#if (defined _NDS) && (defined NONET)
-// Use the NDS's trig functions. This would break netplay, so we only do
-// it if NONET is defined.
-#define FINESINE(n) ((fixed_t)sinLerp((INT16)(((INT32)(n))<<(ANGLETOFINESHIFT-17))) << (FRACBITS - 12))
-#define FINECOSINE(n) ((fixed_t)cosLerp((INT16)(((INT32)(n))<<(ANGLETOFINESHIFT-17))) << (FRACBITS - 12))
-#define FINETANGENT(n) ((fixed_t)tanLerp((INT16)(((INT32)(n)-(FINEANGLES>>2))<<(ANGLETOFINESHIFT-17))) << (FRACBITS - 12))
-#else
 // These macros should be used in case FRACBITS < FINE_FRACBITS.
 #define FINESINE(n) (finesine[n]>>(FINE_FRACBITS-FRACBITS))
 #define FINECOSINE(n) (finecosine[n]>>(FINE_FRACBITS-FRACBITS))
 #define FINETANGENT(n) (finetangent[n]>>(FINE_FRACBITS-FRACBITS))
-#endif
 
 #endif
diff --git a/src/tmap.s b/src/tmap.s
index a828a9d46af0a7a22bc15cb02214fcc1d4e45a20..ea1f1c26c7e43fd8d06bfbb0355d01c39d829eec 100644
--- a/src/tmap.s
+++ b/src/tmap.s
@@ -60,7 +60,7 @@ C(vidwidth):    .long   0       //use this one out of the inner loops
                                 //so you don't need to patch everywhere...
 
 #ifdef USEASM
-#if !defined( LINUX) && !defined( __OS2__)
+#if !defined( LINUX)
     .text
 #endif
 .globl C(ASM_PatchRowBytes)
@@ -616,7 +616,7 @@ vskydone:
 ystep:          .long   0
 xstep:          .long   0
 C(texwidth):    .long   64      // texture width
-#if !defined( LINUX) && !defined( __OS2__)
+#if !defined( LINUX)
     .text
 #endif
 #ifdef LINUX
@@ -1338,7 +1338,7 @@ wdone:
     .data
 
 advancetable:   .long   0, 0
-#if !defined( LINUX) && !defined( __OS2__)
+#if !defined( LINUX)
     .text
 #endif
 #ifdef LINUX
diff --git a/src/v_video.c b/src/v_video.c
index b0d8fc52b0e9f09adaccf151d5dcea7478963804..fa366eb65914ad3ed73d6947625581a765cc9068 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -1308,6 +1308,7 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
 	{
 		case V_MONOSPACE:
 			spacewidth = 8;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 8;
 			break;
@@ -1389,6 +1390,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
 	{
 		case V_MONOSPACE:
 			spacewidth = 8;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 8;
 			break;
@@ -1502,6 +1504,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
 	{
 		case V_MONOSPACE:
 			spacewidth = 4;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 4;
 			break;
@@ -1607,6 +1610,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
 	{
 		case V_MONOSPACE:
 			spacewidth = 5;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 5;
 			break;
@@ -1704,6 +1708,7 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
 	{
 		case V_MONOSPACE:
 			spacewidth = 8;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 8;
 			break;
@@ -1988,6 +1993,7 @@ INT32 V_StringWidth(const char *string, INT32 option)
 	{
 		case V_MONOSPACE:
 			spacewidth = 8;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 8;
 			break;
@@ -2029,6 +2035,7 @@ INT32 V_SmallStringWidth(const char *string, INT32 option)
 	{
 		case V_MONOSPACE:
 			spacewidth = 4;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 4;
 			break;
@@ -2067,6 +2074,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
 	{
 		case V_MONOSPACE:
 			spacewidth = 5;
+			/* FALLTHRU */
 		case V_OLDSPACING:
 			charwidth = 5;
 			break;
diff --git a/src/w_wad.c b/src/w_wad.c
index 22e1836c784dbf9271264b88cba2140939d1bbc8..2aa0a6316d2a4d50fd558a2f6cd842371a8f13cb 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -18,11 +18,7 @@
 #define ZWAD
 
 #ifdef ZWAD
-#ifdef _WIN32_WCE
-#define AVOID_ERRNO
-#else
 #include <errno.h>
-#endif
 #include "lzf.h"
 #endif
 
diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c
index f168f1fe35efae4e483dd417142515f1849fe734..88f34abf8a86ef2d2f1c009e8ddceb8cc47d1f2f 100644
--- a/src/win32/win_snd.c
+++ b/src/win32/win_snd.c
@@ -22,12 +22,10 @@
 #define HAVE_ZLIB
 
 #ifndef _MSC_VER
-#ifndef _WII
 #ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #endif
-#endif
 
 #ifndef _LFS64_LARGEFILE
 #define _LFS64_LARGEFILE
diff --git a/src/win32ce/GameX.h b/src/win32ce/GameX.h
deleted file mode 100644
index 241fdd5bec9b7c3b3c9ee4d4c9c5cdace6ea642c..0000000000000000000000000000000000000000
--- a/src/win32ce/GameX.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-
-  GameX - WindowsCE Game Library for High Performance.
-
-  Copyright (C) 1999 Hayes C. Haugen, all rights reserved.
-
-  */
-
-/*
-	* Need better way for host app to keep track of direct vs blit
-	drawing.  Right now GetFBAddress() is the way to do it.
-
-
-  */
-
-
-#pragma once
-#include <windows.h>			// For VK codes.
-
-// Defines
-
-// display property flags
-
-const unsigned long kfDPGrey =		0x0001;
-const unsigned long kfDPGrey2Bit =	0x0002;
-const unsigned long kfDPGrey4Bit =	0x0004;
-const unsigned long kfDPColor =		0x0008;
-const unsigned long kfDPColor8Bit =	0x0010;
-const unsigned long kfDPColor16Bit = 0x0020;
-const unsigned long kfDPColor24Bit = 0x0040;
-const unsigned long kfDPColor32Bit = 0x0080;
-const unsigned long kfDPFormatNormal = 0x0100;		// fb start is upper left, inc goes across
-const unsigned long	kfDPFormatRot270 = 0x0200;		// fb start is lower left, inc goes up
-
-// Machine property flags
-
-const unsigned long kfMPPSPC =	0x0001;		// Palm Sized PC - 240 x 320
-const unsigned long kfMPPSPC1 =	0x0002;		// 1st gen pspc
-const unsigned long kfMPPSPC2 =	0x0004;		// Wyverns
-const unsigned long kfMPHPC =	0x0008;		// Handheld PC
-const unsigned long kfMPHPC1 =	0x0010;		// HPC 1, 480 x 240
-const unsigned long kfMPHPC2 =	0x0020;		// HPC 2, 640 x 240
-const unsigned long kfMPHPC3 =	0x0040;		// HPC Pro, 640 x 240, big keys
-const unsigned long kfMPPro =	0x0080;		//
-const unsigned long kfMPAutoPC = 0x0100;
-const unsigned long kfMPHasKeyboard = 0x0200;
-const unsigned long kfMPHasMouse = 0x0400;
-const unsigned long kfMPHasRumble = 0x0800;
-const unsigned long kfMPHasTouch = 0x1000;
-
-// Rotations
-
-const int kiRotate0 = 0;		// no rotation
-const int kiRotate90 = 1;		// 90 degrees clockwise
-const int kiRotate180 = 2;		// 180 degrees clockwise (upside down, Rotate 0 flipped)
-const int kiRotate270 = 3;		// 270 degrees clockwise (Rotate 1 flipped)
-
-class GameX {
-public:
-	HWND SetButtonNotificationWindow(HWND hWnd);
-	GameX();
-	~GameX();
-
-	bool OpenGraphics();
-	bool OpenSound();
-	bool OpenButtons(HWND hwndButtonNotify);	// Window that will get button messages or NULL if you just want to use GetAsyncKeyState();
-	bool CloseGraphics();
-	bool CloseSound();
-	bool CloseButtons();
-
-	bool IsColor();
-	bool IsPSPC();
-	bool IsHPC();
-	bool IsHPCPro();
-	bool HasMouse();
-	bool HasKeyboard();					// better than inferring from hpc/pspc/etc.
-	bool HasRumble();
-	bool HasTouch();					// for completeness.  At least 1 doesn't.
-
-	int IsForeground();
-	bool Suspend();						// release buttons, don't draw, etc.
-	bool Resume();						// regrab buttons, etc.
-
-	bool BeginDraw();
-	bool EndDraw();
-	bool FindFrameBuffer();
-	void * GetFBAddress();				// simple way to get things that makes code
-	long GetFBModulo();					// more readable.
-	long GetFBBpp();
-	bool GetScreenRect(RECT * prc);
-	unsigned long GetDisplayProperties();
-
-	bool GetButton(int VK);				// buttons init themselves on first button call??
-	unsigned short GetDefaultButtonID(long id, long rotate);		// gets the best button for use as specified by need and rotation
-	bool ReleaseButton(int VK);
-	bool BeginDetectButtons();			// grabs all buttons so user can indicate a button in a config dialog
-	bool EndDetectButtons();			// releases all buttons (except GetButton() ones)
-
-	bool Rumble();
-	bool Backlight(bool fOn);
-private:
-//	LRESULT CALLBACK TaskBarWndProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam);
-
-private:
-	int m_iMP;							// index into amp table for current machine.
-	void * m_pvFrameBuffer;
-	long m_cbFBModulo;					// count of bytes to next line
-	unsigned long m_ffMachineProperties;
-	unsigned long m_ffDisplayProperties;
-	int m_cBitsPP;
-
-	long m_dwPrevMode;					// for Begin/EndDraw()
-	bool m_fActive;						// true if active (resume), false if inactive (suspend).
-
-	HWND m_hwndTaskbar;					// Taskbar is official cap, change TaskBar's
-};
-
-
-/*
-
-kmtCasioE10
-kmtCasioE11
-kmtCasioE15
-kmtCasioE55
-kmtCasioE100
-kmtLGPhenomII
-
-stuff for memory size and presence/absence of CF
-
-// Rotations that make sense for this device or default rotation:
-
-Rotate0			// no rotation
-Rotate1			// 90 degrees clockwise
-Rotate2			// 180 degrees clockwise (upside down, Rotate 0 flipped)
-Rotate3			// 270 degrees clockwise (Rotate 1 flipped)
-
-kmtAccessNone	// no direct framebuffer access
-kmtAccess1		// write to fixed address
-kmtAccess2		// find framebuffer memory aperture in GWES.EXE memory space.
-
-OriginUpperLeft
-OriginUpperRight
-OriginLowerRight
-OriginLowerLeft
-
-MappedHorizontal	// increasing fb address goes across screen
-MappedVertical		// increasing fb address goes up/down screen (Compaq)
-
-A machine entry:
-===========================================
-	machine		kmtCasioE10,
-	type		kmtPSPC | kmtPSPC1,
-	displaytype	kmtGrey | kmtGrey2Bit | kmtAccess1,
-	pvFrameBuffer 0xAA000000,
-	cbFBModulo	1024					// count of bytes to next line
-	cbppFB		2,						// bits per pixel
-	cxDisp		240,
-	cyDisp		320,
-	format		OriginUpperLeft, MappedHorizontal
-
-	rotate0								// for rotate mode 0, these are the best keys
-		vkUp	VK_UP
-		vkDown	VK_DOWN
-		vkLeft	0xC1
-		vkRight	0xC2
-		vkA		0xC3
-		vkB		0
-	rotate1
-		vkUp	0xC1
-		vkDown	0xC2
-		vkLeft	VK_DOWN
-		...
-		...*/
-
diff --git a/src/win32ce/SRB2CE.zip b/src/win32ce/SRB2CE.zip
deleted file mode 100644
index 3ac8530dcb124cbda512a7d469da933c3fc974bf..0000000000000000000000000000000000000000
Binary files a/src/win32ce/SRB2CE.zip and /dev/null differ
diff --git a/src/win32ce/Srb2win.ico b/src/win32ce/Srb2win.ico
deleted file mode 100644
index 700276fd4b9ac2810a6981eb054921f3708c702b..0000000000000000000000000000000000000000
Binary files a/src/win32ce/Srb2win.ico and /dev/null differ
diff --git a/src/win32ce/afxres.h b/src/win32ce/afxres.h
deleted file mode 100644
index 7f5245404eef8c9fac3efe28c48f31b22cb657d1..0000000000000000000000000000000000000000
--- a/src/win32ce/afxres.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief needed if mfc not installed (if I remember well)
diff --git a/src/win32ce/gapi_c.cpp b/src/win32ce/gapi_c.cpp
deleted file mode 100644
index 60c7adfa2f1eec4e047515c03a43b803d1dd19d5..0000000000000000000000000000000000000000
--- a/src/win32ce/gapi_c.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-#include <stdlib.h>
-#include <windows.h>
-
-#define _USE_GAPI_
-
-
-#ifndef _USE_GAPI_
-	#include "GameX.h"
-
-struct GXDisplayProperties
-{
-	DWORD cxWidth;
-	DWORD cyHeight;
-	long cbxPitch;
-	long cbyPitch;
-	long cBPP;
-	DWORD ffFormat;
-};
-
-#define kfPalette	0x10		// Pixel values are indexes into a palette
-#define kfDirect565	0x80		// 5 red bits, 6 green bits and 5 blue bits per pixel
-
-
-	GameX* gx = new GameX;
-#else
-	#include "gx.h"
-#endif
-
-extern "C"
-{
-	#include "gapi_c.h"
-}
-
-extern "C" int GXOPENDISPLAY(HWND hWnd, DWORD dwFlags)
-{
-	#ifndef _USE_GAPI_
-		if(!gx)
-			return 0;
-
-		//gx->OpenSound();
-		if(!gx->OpenGraphics())
-		{
-			delete gx;
-			gx = 0;
-			return 0;
-		}
-
-		return TRUE;
-
-	#else
-		return GXOpenDisplay(hWnd,dwFlags);
-	#endif
-}
-
-extern "C" int GXCLOSEDISPLAY()
-{
-	#ifndef _USE_GAPI_
-		gx->CloseGraphics();
-		return TRUE;
-	#else
-		return GXCloseDisplay();
-	#endif
-}
-
-extern "C" void * GXBEGINDRAW()
-{
-	#ifndef _USE_GAPI_
-		if(gx->BeginDraw())
-			return gx->GetFBAddress();
-
-		return NULL;
-	#else
-		return GXBeginDraw();
-	#endif
-}
-
-extern "C" int GXENDDRAW()
-{
-	#ifndef _USE_GAPI_
-		return gx->EndDraw();
-	#else
-		return GXEndDraw();
-	#endif
-
-}
-
-extern "C" struct GXDisplayProperties GXGETDISPLAYPROPERTIES()
-{
-	#ifndef _USE_GAPI_
-		RECT				r;
-		GXDisplayProperties	gxdp;
-
-		gxdp.cbyPitch	= gx->GetFBModulo();
-		gxdp.cBPP		= gx->GetFBBpp();
-		gxdp.cbxPitch	= (gxdp.cBPP >> 3);
-
-		gx->GetScreenRect(&r);
-		gxdp.cxWidth	= (r.right - r.left);
-		gxdp.cyHeight	= (r.bottom - r.top);
-
-		if(gxdp.cBPP = 16)
-			gxdp.ffFormat = kfDirect565;
-		else if(gxdp.cBPP = 8)
-			gxdp.ffFormat = kfPalette;
-
-		return gxdp;
-
-	#else
-		return GXGetDisplayProperties();
-	#endif
-}
-
-extern "C" int GXSUSPEND()
-{
-	#ifndef _USE_GAPI_
-		return gx->Suspend();
-	#else
-		return GXSuspend();
-	#endif
-}
-
-extern "C" int GXRESUME()
-{
-	#ifndef _USE_GAPI_
-		return gx->Resume();
-	#else
-		return GXResume();
-	#endif
-}
\ No newline at end of file
diff --git a/src/win32ce/gapi_c.h b/src/win32ce/gapi_c.h
deleted file mode 100644
index 40e7799ffc664691964b614dffe5c7af7f4bb809..0000000000000000000000000000000000000000
--- a/src/win32ce/gapi_c.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef GAPI_H
-#define GAPI_H
-
-int GXOPENDISPLAY(HWND hWnd, DWORD dwFlags);
-int GXCLOSEDISPLAY();
-void * GXBEGINDRAW();
-int GXENDDRAW();
-struct GXDisplayProperties GXGETDISPLAYPROPERTIES();
-int GXSUSPEND();
-int GXRESUME();
-
-#endif
\ No newline at end of file
diff --git a/src/win32ce/gxgapilib.c b/src/win32ce/gxgapilib.c
deleted file mode 100644
index 8ff57092d168461bc83eadee79614d936d05b3ee..0000000000000000000000000000000000000000
--- a/src/win32ce/gxgapilib.c
+++ /dev/null
@@ -1,636 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Zak Larue-Buckley's GX and GAPI library v1.0
-
-#include "../doomdef.h"
-//#define WIN32_LEAN_AND_MEAN
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-#include <windowsx.h>
-#include "../i_system.h"
-#include "dx_error.h"
-
-#include "fabdxlib.h"
-
-#define NT4COMPAT   //always defined, always compatible
-
-
-// globals
-
-IDirectDraw2*              DDr2 = NULL;
-IDirectDrawSurface*        ScreenReal = NULL;    // DirectDraw primary surface
-IDirectDrawSurface*        ScreenVirtual = NULL; // DirectDraw back surface
-IDirectDrawPalette*        DDPalette = NULL;     // The primary surface palette
-static IDirectDrawClipper *windclip = NULL;      // clipper for windowed mode
-
-BOOL                       bAppFullScreen;       // true for fullscreen exclusive mode,
-
-int                        windowPosX = 0;       // current position in windowed mode
-int                        windowPosY = 0;
-
-int                        ScreenWidth;
-int                        ScreenHeight;
-BOOL                       ScreenLocked;         // Screen surface is being locked
-int                        ScreenPitch;          // offset from one line to the next
-LPBYTE                     ScreenPtr;            // memory of the surface
-
-
-//
-// CreateNewSurface
-//
-static inline IDirectDrawSurface* CreateNewSurface(int dwWidth,
-                                                   int dwHeight,
-                                                   int dwSurfaceCaps)
-{
-	DDSURFACEDESC       ddsd;
-	HRESULT             hr;
-	LPDIRECTDRAWSURFACE psurf;
-
-	ZeroMemory(&ddsd, sizeof (ddsd));
-	ddsd.dwSize = sizeof (ddsd);
-	ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH;
-
-	ddsd.ddsCaps.dwCaps = dwSurfaceCaps;
-
-	ddsd.dwHeight = dwHeight;
-	ddsd.dwWidth = dwWidth;
-
-	hr = IDirectDraw2_CreateSurface (DDr2, &ddsd, &psurf, NULL);
-
-	if (hr == DD_OK)
-	{
-		//DDCOLORKEY ddck;
-		IDirectDrawSurface_Restore(psurf);
-
-		//hr = IDirectDrawSurface_GetColorKey(DDCKEY_SRCBLT, &ddck);
-		//psurf->SetColorKey(DDCKEY_SRCBLT, &ddck);
-	}
-	else
-		psurf = NULL;
-
-	return psurf;
-}
-
-//
-// wow! from 320x200x8 up to 1600x1200x32 thanks Banshee! :)
-//
-static HRESULT WINAPI myEnumModesCallback (LPDDSURFACEDESC surf, LPVOID lpContext)
-{
-	APPENUMMODESCALLBACK pfnContext = lpContext;
-
-	if (pfnContext) pfnContext(surf->dwWidth,
-		surf->dwHeight,surf->ddpfPixelFormat.
-#ifdef DUMMYUNIONNAMEN
-		DUMMYUNIONNAMEN(1).
-#endif
-		dwRGBBitCount
-		);
-
-		/*CONS_Printf ("%dx%dx%d bpp %d refresh\n",
-		surf->dwWidth,
-		surf->dwHeight,
-		surf->ddpfPixelFormat.dwRGBBitCount,
-	surf->dwRefreshRate);*/
-
-	return  DDENUMRET_OK;
-}
-
-
-//
-// Application call here to enumerate display modes
-//
-BOOL EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc)
-{
-	LPVOID lpappFunc = appFunc;
-
-	if (DDr2 == NULL)
-		return FALSE;
-
-	// enumerate display modes
-	// Carl: DirectX 3.x apparently does not support VGA modes. Who cares. :)
-	// faB: removed DDEDM_REFRESHRATES, detects too many modes, plus we don't care of refresh rate.
-	if (bDX0300)
-		IDirectDraw2_EnumDisplayModes (DDr2, 0 /*| DDEDM_REFRESHRATES*/,
-		                               NULL, lpappFunc, myEnumModesCallback);
-	else
-		IDirectDraw2_EnumDisplayModes (DDr2, DDEDM_STANDARDVGAMODES /*| DDEDM_REFRESHRATES*/,
-		                               NULL, lpappFunc, myEnumModesCallback);
-	return TRUE;
-}
-
-
-//
-// Create the DirectDraw object for later
-//
-BOOL CreateDirectDrawInstance (VOID)
-{
-	HRESULT hr;
-	IDirectDraw* DDr;
-	IDirectDraw** rp = &DDr;
-	IDirectDraw2** rp2 = &DDr2;
-	LPVOID *tp = (LPVOID *)rp2;
-
-	//
-	// create an instance of DirectDraw object
-	//
-	if (FAILED(hr = DirectDrawCreate(NULL, rp, NULL)))
-		I_Error("DirectDrawCreate FAILED: %s", DXErrorToString(hr));
-
-	// change interface to IDirectDraw2
-	if (FAILED(hr = IDirectDraw_QueryInterface (DDr, &IID_IDirectDraw2, tp)))
-		I_Error("Failed to query DirectDraw2 interface: %s", DXErrorToString(hr));
-
-	// release the interface we don't need
-	IDirectDraw_Release (DDr);
-	return TRUE;
-}
-
-
-//
-// - returns true if DirectDraw was initialized properly
-//
-int  InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr)
-{
-	DDSURFACEDESC ddsd; // DirectDraw surface description for allocating
-	DDSCAPS       ddscaps;
-	HRESULT       ddrval;
-
-	DWORD         dwStyle;
-	RECT          rect;
-
-	// enumerate directdraw devices
-	//if (FAILED(DirectDrawEnumerate (myEnumDDDevicesCallback, NULL)))
-	//      I_Error("Error with DirectDrawEnumerate");
-
-	if (!DDr2)
-		CreateDirectDrawInstance();
-
-	// remember what screen mode we are in
-	bAppFullScreen = fullScr;
-	ScreenHeight = height;
-	ScreenWidth = width;
-
-	if (bAppFullScreen)
-	{
-		// Change window attributes
-		dwStyle = WS_POPUP | WS_VISIBLE;
-		SetWindowLong (appWin, GWL_STYLE, dwStyle);
-		SetWindowPos(appWin, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE |
-			SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
-
-		// Get exclusive mode
-		ddrval = IDirectDraw2_SetCooperativeLevel(DDr2, appWin, DDSCL_EXCLUSIVE |
-		                                          DDSCL_FULLSCREEN |
-		                                          DDSCL_ALLOWREBOOT);
-		if (ddrval != DD_OK)
-			I_Error("SetCooperativeLevel FAILED: %s\n", DXErrorToString(ddrval));
-
-		// Switch from windows desktop to fullscreen
-
-#ifdef NT4COMPAT
-		ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, 0);
-#else
-		ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, DDSDM_STANDARDVGAMODE);
-#endif
-		if (ddrval != DD_OK)
-			I_Error("SetDisplayMode FAILED: %s\n", DXErrorToString(ddrval));
-
-		// This is not really needed, except in certain cases. One case
-		// is while using MFC. When the desktop is initally at 16bpp, a mode
-		// switch to 8bpp somehow causes the MFC window to not fully initialize
-		// and a CreateSurface will fail with DDERR_NOEXCLUSIVEMODE. This will
-		// ensure that the window is initialized properly after a mode switch.
-
-		ShowWindow(appWin, SW_SHOW);
-
-		// Create the primary surface with 1 back buffer. Always zero the
-		// DDSURFACEDESC structure and set the dwSize member!
-
-		ZeroMemory(&ddsd, sizeof (ddsd));
-		ddsd.dwSize = sizeof (ddsd);
-		ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
-		ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
-
-		// for fullscreen we use page flipping, for windowed mode, we blit the hidden surface to
-		// the visible surface, in both cases we have a visible (or 'real') surface, and a hidden
-		// (or 'virtual', or 'backbuffer') surface.
-		ddsd.dwBackBufferCount = 1;
-
-		ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL);
-		if (ddrval != DD_OK)
-			I_Error("CreateSurface Primary Screen FAILED");
-
-		// Get a pointer to the back buffer
-
-		ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
-		ddrval = IDirectDrawSurface_GetAttachedSurface(ScreenReal,&ddscaps, &ScreenVirtual);
-		if (ddrval != DD_OK)
-			I_Error("GetAttachedSurface FAILED");
-	}
-	else
-	{
-		rect.top = 0;
-		rect.left = 0;
-		rect.bottom = height-1;
-		rect.right = width-1;
-
-		// Change window attributes
-
-		dwStyle = GetWindowStyle(appWin);
-		dwStyle &= ~WS_POPUP;
-		dwStyle |= WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION;
-
-		SetWindowLong(appWin, GWL_STYLE, dwStyle);
-
-		// Resize the window so that the client area is the requested width/height
-
-		AdjustWindowRectEx(&rect, GetWindowStyle(appWin), GetMenu(appWin) != NULL,
-		                   GetWindowExStyle(appWin));
-
-		// Just in case the window was moved off the visible area of the
-		// screen.
-
-		SetWindowPos(appWin, NULL, 0, 0, rect.right-rect.left,
-		             rect.bottom-rect.top, SWP_NOMOVE | SWP_NOZORDER |
-		             SWP_NOACTIVATE);
-
-		SetWindowPos(appWin, HWND_NOTOPMOST, 0, 0, 0, 0,
-		             SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
-
-		// Exclusive mode is normal since it's in windowed mode and needs
-		// to cooperate with GDI
-
-		ddrval = IDirectDraw2_SetCooperativeLevel(DDr2,appWin, DDSCL_NORMAL);
-		if (ddrval != DD_OK)
-			I_Error("SetCooperativeLevel FAILED");
-
-		// Always zero the DDSURFACEDESC structure and set the dwSize member!
-
-		ZeroMemory(&ddsd, sizeof (ddsd));
-		ddsd.dwSize = sizeof (ddsd);
-		ddsd.dwFlags = DDSD_CAPS;
-		ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
-		// Create the primary surface
-
-		ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL);
-		if (ddrval != DD_OK)
-			I_Error("CreateSurface Primary Screen FAILED");
-
-		// Create a back buffer for offscreen rendering, this will be used to
-		// blt to the primary
-
-		ScreenVirtual = CreateNewSurface(width, height, DDSCAPS_OFFSCREENPLAIN |
-		                                 DDSCAPS_SYSTEMMEMORY);
-		if (ScreenVirtual == NULL)
-			I_Error("CreateSurface Secondary Screen FAILED");
-
-		/// \todo get the desktop bit depth, and build a lookup table
-		/// for quick conversions of 8bit color indexes 0-255 to desktop colors
-		/// eg: 256 entries of equivalent of palette colors 0-255 in 15,16,24,32 bit format
-		/// when blit virtual to real, convert pixels through lookup table..
-
-		// Use a clipper object for clipping when in windowed mode
-		// (make sure our drawing doesn't affect other windows)
-
-		ddrval = IDirectDraw2_CreateClipper (DDr2, 0, &windclip, 0);
-		if (ddrval != DD_OK)
-			I_Error("CreateClipper FAILED");
-
-		// Associate the clipper with the window.
-		ddrval = IDirectDrawClipper_SetHWnd (windclip,0, appWin);
-		if (ddrval != DD_OK)
-			I_Error("Clipper -> SetHWnd  FAILED");
-
-		// Attach the clipper to the surface.
-		ddrval = IDirectDrawSurface_SetClipper (ScreenReal,windclip);
-		if (ddrval != DD_OK)
-			I_Error("PrimaryScreen -> SetClipperClipper  FAILED");
-	}
-
-	return TRUE;
-}
-
-
-//
-// Free all memory
-//
-VOID CloseDirectDraw (VOID)
-{
-	ReleaseChtuff();
-	if (DDr2)
-	{
-		IDirectDraw2_Release(DDr2);
-		DDr2 = NULL;
-	}
-}
-
-
-//
-// Release DirectDraw stuff before display mode change
-//
-VOID ReleaseChtuff (VOID)
-{
-	if (!DDr2)
-		return;
-	if (windclip)
-	{
-		IDirectDrawClipper_Release(windclip);
-		windclip = NULL;
-	}
-	if (DDPalette)
-	{
-		IDirectDrawPalette_Release(DDPalette);
-		DDPalette = NULL;
-	}
-	// If the app is fullscreen, the back buffer is attached to the
-	// primary. Releasing the primary buffer will also release any
-	// attached buffers, so explicitly releasing the back buffer is not
-	// necessary.
-
-	if (!bAppFullScreen && ScreenVirtual)
-	{
-		IDirectDrawSurface_Release(ScreenVirtual);   // release hidden surface
-		ScreenVirtual = NULL;
-	}
-	if (ScreenReal)
-	{
-		IDirectDrawSurface_Release(ScreenReal);                      // and attached backbuffers for bAppFullScreen mode
-		ScreenReal = NULL;
-	}
-}
-
-
-//
-// Clear the surface to color
-//
-VOID ClearSurface(IDirectDrawSurface* surface, int color)
-{
-	DDBLTFX ddbltfx;
-
-	// Use the blter to do a color fill to clear the back buffer
-	ddbltfx.dwSize = sizeof (ddbltfx);
-	ddbltfx.
-#ifdef DUMMYUNIONNAMEN
-	 DUMMYUNIONNAMEN(5).
-#endif
-	 dwFillColor = color;
-	IDirectDrawSurface_Blt(surface,NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
-
-}
-
-//
-// Flip the real page with virtual page
-// - in bAppFullScreen mode, do page flipping
-// - in windowed mode, copy the hidden surface to the visible surface
-//
-// waitflip : if not 0, wait for page flip to end
-BOOL ScreenFlip(int waitflip)
-{
-	HRESULT hr;
-	RECT rect;
-
-	waitflip = 0;
-	if (bAppFullScreen)
-	{
-		//hr = IDirectDrawSurface_GetFlipStatus (ScreenReal, DDGFS_);
-
-		// In full-screen exclusive mode, do a hardware flip.
-		hr = IDirectDrawSurface_Flip(ScreenReal, NULL, DDFLIP_WAIT);   //return immediately
-
-		// If the surface was lost, restore it.
-		if (hr == DDERR_SURFACELOST)
-		{
-			IDirectDrawSurface_Restore(ScreenReal);
-
-			// The restore worked, so try the flip again.
-			hr = IDirectDrawSurface_Flip(ScreenReal, 0, DDFLIP_WAIT);
-		}
-	}
-	else
-	{
-		rect.left = windowPosX;
-		rect.top = windowPosY;
-		rect.right = windowPosX + ScreenWidth - 1;
-		rect.bottom = windowPosY + ScreenHeight - 1;
-
-		// Copy the back buffer to front.
-		hr = IDirectDrawSurface_Blt(ScreenReal, &rect, ScreenVirtual, 0, DDBLT_WAIT, 0);
-
-		if (hr != DD_OK)
-		{
-			// If the surfaces were lost, restore them.
-			if (IDirectDrawSurface_IsLost(ScreenReal) == DDERR_SURFACELOST)
-				IDirectDrawSurface_Restore(ScreenReal);
-
-			if (IDirectDrawSurface_IsLost(ScreenVirtual) == DDERR_SURFACELOST)
-				IDirectDrawSurface_Restore(ScreenVirtual);
-
-			// Retry the copy.
-			hr = IDirectDrawSurface_Blt(ScreenReal,&rect, ScreenVirtual, 0, DDBLT_WAIT, 0);
-		}
-	}
-
-	if (hr != DD_OK)
-		I_Error("ScreenFlip() : couldn't Flip surfaces");
-
-	return FALSE;
-}
-
-//
-// Print a text to the surface
-//
-VOID TextPrint(int x, int y, LPCSTR message)
-{
-	HRESULT hr;
-	HDC hdc = NULL;
-
-	// Get the device context handle.
-	hr = IDirectDrawSurface_GetDC(ScreenVirtual,&hdc);
-	if (hr != DD_OK)
-		return;
-
-	// Write the message.
-	SetBkMode(hdc, TRANSPARENT);
-	SetTextColor(hdc, RGB(255, 255, 255));
-	TextOutA(hdc, x, y, message, (int)strlen(message));
-
-	// Release the device context.
-	hr = IDirectDrawSurface_ReleaseDC(ScreenVirtual,hdc);
-}
-
-//
-// Lock surface before multiple drawings by hand, for speed
-//
-boolean LockScreen(VOID)
-{
-	DDSURFACEDESC ddsd;
-	HRESULT ddrval;
-
-	ZeroMemory(&ddsd, sizeof (ddsd));
-	ddsd.dwSize = sizeof (ddsd);
-
-	// attempt to Lock the surface
-	ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL);
-
-	// Always, always check for errors with DirectX!
-	// If the surface was lost, restore it.
-	if (ddrval == DDERR_SURFACELOST)
-	{
-		ddrval = IDirectDrawSurface_Restore(ScreenReal);
-
-		// now retry to get the lock
-		ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL);
-	}
-
-	if (ddrval == DD_OK)
-	{
-		ScreenLocked = TRUE;
-		ScreenPtr    = (LPBYTE)ddsd.lpSurface;
-		ScreenPitch = ddsd.
-#ifdef DUMMYUNIONNAMEN
-		 DUMMYUNIONNAMEN(1).
-#endif
-		 lPitch;
-	}
-	else
-	{
-		ScreenLocked = FALSE;
-		ScreenPtr = NULL;
-		ScreenPitch = 0;
-		//I_Error("LockScreen() : couldn't restore the surface.");
-		return false;
-	}
-	return true;
-}
-
-//
-// Unlock surface
-//
-VOID UnlockScreen(VOID)
-{
-	if (DD_OK != IDirectDrawSurface_Unlock(ScreenVirtual,NULL))
-		I_Error("Couldn't UnLock the renderer!");
-
-	ScreenLocked = FALSE;
-	ScreenPtr    = NULL;
-	ScreenPitch = 0;
-}
-
-// Blit virtual screen to real screen
-//faB: note: testing 14/03/1999, see if it is faster than memcopy of virtual to
-/*
-static LPDIRECTDRAWSURFACE lpDDS = NULL;
-VOID BlitScreen(VOID)
-{
-	HRESULT hr;
-
-	if (!lpDDS)
-		I_Error("lpDDS NULL");
-
-	hr = IDirectDrawSurface_BltFast(ScreenVirtual,
-	                                    0, 0,    // Upper left xy of destination
-	                                    lpDDS, // Source surface
-	                                    NULL,        // Source rectangle = entire surface
-	                                    DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
-	if (FAILED(hr))
-		I_Error("BltFast FAILED");
-}
-
-VOID MakeScreen(int width, int height, BYTE* lpSurface)
-{
-	HRESULT hr;
-	DDSURFACEDESC ddsd;
-
-	// Initialize the surface description.
-	ZeroMemory (&ddsd, sizeof ddsd);
-	ZeroMemory (&ddsd.ddpfPixelFormat, sizeof (DDPIXELFORMAT));
-	ddsd.dwSize = sizeof ddsd;
-	ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | //DDSD_LPSURFACE |
-	               DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_CAPS;
-	ddsd.dwWidth = width;
-	ddsd.dwHeight= height;
-	ddsd.lPitch  = width;
-	ddsd.lpSurface = lpSurface;
-	ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN;
-
-	// Set up the pixel format for 8-bit
-	ddsd.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT);
-	ddsd.ddpfPixelFormat.dwFlags= DDPF_RGB | DDPF_PALETTEINDEXED8;
-	ddsd.ddpfPixelFormat.dwRGBBitCount = 8;
-
-	//
-	ddsd.ddpfPixelFormat.dwRGBBitCount = (DWORD)DEPTH*8;
-	ddsd.ddpfPixelFormat.dwRBitMask    = 0x00FF0000;
-	ddsd.ddpfPixelFormat.dwGBitMask    = 0x0000FF00;
-	ddsd.ddpfPixelFormat.dwBBitMask    = 0x000000FF;
-
-	// Create the surface
-	hr = IDirectDraw2_CreateSurface(DDr2, &ddsd, &lpDDS, NULL);
-	if (FAILED(hr))
-		I_Error("MakeScreen FAILED: %s",DDError(hr));
-	//ddsd.lpSurface = lpSurface;
-}
-*/
-
-//
-// Create a palette object
-//
-VOID CreateDDPalette (PALETTEENTRY* colorTable)
-{
-	HRESULT  ddrval;
-	ddrval = IDirectDraw2_CreatePalette(DDr2,DDPCAPS_8BIT|DDPCAPS_ALLOW256, colorTable, &DDPalette, NULL);
-	if (ddrval != DD_OK)
-		I_Error("couldn't CreatePalette");
-};
-
-
-//
-// Free the palette object
-//
-VOID DestroyDDPalette (VOID)
-{
-	if (DDPalette)
-	{
-		IDirectDrawPalette_Release(DDPalette);
-		DDPalette = NULL;
-	}
-}
-
-//
-// Set a a full palette of 256 PALETTEENTRY entries
-//
-VOID SetDDPalette(PALETTEENTRY* pal)
-{
-	// create palette first time
-	if (DDPalette == NULL)
-		CreateDDPalette(pal);
-	else
-		IDirectDrawPalette_SetEntries(DDPalette, 0, 0, 256, pal);
-	// setting the same palette to the same surface again does not increase
-	// the reference count
-	IDirectDrawSurface_SetPalette(ScreenReal, DDPalette);
-}
-
-//
-// Wait for vsync, gross
-//
-VOID WaitVbl(VOID)
-{
-	IDirectDraw2_WaitForVerticalBlank(DDr2, DDWAITVB_BLOCKBEGIN, NULL);
-}
diff --git a/src/win32ce/gxgapilib.h b/src/win32ce/gxgapilib.h
deleted file mode 100644
index 189cc15b8804d77bd4c0db4558421668f84e655c..0000000000000000000000000000000000000000
--- a/src/win32ce/gxgapilib.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Zak Larue-Buckley's GX and GAPI library v1.0
-
-#ifndef _H_GXGAPILIB_
-#define _H_GXGAPILIB_
-
-//#define WIN32_LEAN_AND_MEAN
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-#ifdef __MINGW32__
-//#define NONAMELESSUNION
-#endif
-#ifdef _MSC_VER
-#pragma warning(disable :  4201)
-#endif
-#include <ddraw.h>
-#if (defined (DIRECTDRAW_VERSION) && (DIRECTDRAW_VERSION >= 0x0700))
-#undef DUMMYUNIONNAMEN
-#endif
-// format of function in app called with width,height
-typedef BOOL (*APPENUMMODESCALLBACK)(int width, int height, int bpp);
-
-
-// globals
-extern IDirectDraw2*                            DDr2;
-extern IDirectDrawSurface*                      ScreenReal;
-extern IDirectDrawSurface*                      ScreenVirtual;
-extern IDirectDrawPalette*                      DDPalette;
-
-extern BOOL                                     bAppFullScreen;                             // main code might need this to know the current
-                                                                                           // fullscreen or windowed state
-
-extern int                                      windowPosX;                             // current position in windowed mode
-extern int                                      windowPosY;
-
-extern int                                      ScreenWidth;
-extern int                                      ScreenHeight;
-extern BOOL                                     ScreenLocked;                   // Screen surface is being locked
-extern int                                      ScreenPitch;                    // offset from one line to the next
-extern LPBYTE                                   ScreenPtr;                              // memory of the surface
-
-extern BOOL                                     bDX0300;
-
-BOOL    EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc);
-BOOL    CreateDirectDrawInstance (VOID);
-
-int     InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr);
-VOID    CloseDirectDraw (VOID);
-
-VOID    ReleaseChtuff (VOID);
-
-VOID    ClearSurface (IDirectDrawSurface* surface, int color);
-BOOL    ScreenFlip (int wait);
-VOID    TextPrint (int x, int y, LPCSTR message);
-
-VOID    CreateDDPalette (PALETTEENTRY* colorTable);
-VOID    DestroyDDPalette (VOID);
-VOID    SetDDPalette (PALETTEENTRY* pal);
-
-VOID    WaitVbl (VOID);
-
-boolean LockScreen (VOID);
-VOID    UnlockScreen (VOID);
-
-
-#endif /* _H_FABDXLIB_ */
diff --git a/src/win32ce/midstuff.h b/src/win32ce/midstuff.h
deleted file mode 100644
index 08ee80add3fa310a3110867633d21e1ab7a1d3f2..0000000000000000000000000000000000000000
--- a/src/win32ce/midstuff.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief MIDI structures and definitions
-///	used by the MSTREAM sample	application in
-///	converting a MID file to a MIDI stream for
-///	playback using the midiStream API.
-///	Inpired by DirectX5 SDK examples
-
-#ifndef __MIDSTUFF_H__
-#define __MIDSTUFF_H__
-
-// MIDI file constants
-//
-#define MThd            0x6468544D              // Start of file
-#define MTrk            0x6B72544D              // Start of track
-
-#define MIDI_SYSEX      ((BYTE)0xF0)            // SysEx begin
-#define MIDI_SYSEXEND   ((BYTE)0xF7)            // SysEx begin
-#define MIDI_META       ((BYTE)0xFF)            // Meta event begin
-#define MIDI_META_TEMPO ((BYTE)0x51)            // Tempo change
-#define MIDI_META_EOT   ((BYTE)0x2F)            // End-of-track
-
-#define MIDI_NOTEOFF    ((BYTE)0x80)            // + note + velocity
-#define MIDI_NOTEON     ((BYTE)0x90)            // + note + velocity
-#define MIDI_POLYPRESS  ((BYTE)0xA0)            // + pressure (2 bytes)
-#define MIDI_CTRLCHANGE ((BYTE)0xB0)            // + ctrlr + value
-#define MIDI_PRGMCHANGE ((BYTE)0xC0)            // + new patch
-#define MIDI_CHANPRESS  ((BYTE)0xD0)            // + pressure (1 byte)
-#define MIDI_PITCHBEND  ((BYTE)0xE0)            // + pitch bend (2 bytes)
-
-#define NUM_CHANNELS    16
-
-#define MIDICTRL_VOLUME         ((BYTE)0x07)
-#define MIDICTRL_VOLUME_LSB     ((BYTE)0x27)
-#define MIDICTRL_PAN            ((BYTE)0x0A)
-
-#define MIDIEVENT_CHANNEL(dw)   (dw & 0x0000000F)
-#define MIDIEVENT_TYPE(dw)      (dw & 0x000000F0)
-#define MIDIEVENT_DATA1(dw)     ((dw & 0x0000FF00) >> 8)
-#define MIDIEVENT_VOLUME(dw)    ((dw & 0x007F0000) >> 16)
-
-// Macros for swapping hi/lo-endian data
-//
-#define WORDSWAP(w)     (((w) >> 8) | \
-						(((w) << 8) & 0xFF00))
-
-#define DWORDSWAP(dw)   (((dw) >> 24) |                 \
-						(((dw) >> 8) & 0x0000FF00) |    \
-						(((dw) << 8) & 0x00FF0000) |    \
-						(((dw) << 24) & 0xFF000000))
-
-// In debug builds, TRACKERR will show us where the parser died
-//
-//#define TRACKERR(p,sz) ShowTrackError(p,sz);
-#define TRACKERR(p,sz)
-
-
-// Make a little distinction here so the various structure members are a bit
-// more clearly labelled -- we have offsets and byte counts to keep track of
-// that deal with both in-memory buffers and the file on disk
-
-#define FILEOFF DWORD
-
-
-// These structures are stored in MIDI files; they need to be byte aligned.
-//
-#if defined(_MSC_VER)
-#pragma pack(1)
-#endif
-
-// Chunk header. dwTag is either MTrk or MThd.
-//
-typedef struct
-{
-	DWORD       dwTag;                  // Type
-	DWORD       dwChunkLength;          // Length (hi-lo)
-} ATTRPACK MIDICHUNK;
-
-// Contents of MThd chunk.
-typedef struct
-{
-	WORD        wFormat;                // Format (hi-lo)
-	WORD        wTrackCount;            // # tracks (hi-lo)
-	WORD        wTimeDivision;          // Time division (hi-lo)
-} ATTRPACK MIDIFILEHDR;
-
-#if defined(_MSC_VER)
-#pragma pack() // End of need for byte-aligned structures
-#endif
-
-
-// Temporary event structure which stores event data until we're ready to
-// dump it into a stream buffer
-//
-typedef struct
-{
-	DWORD       tkEvent;        // Absolute time of event
-	BYTE        byShortData[4]; // Event type and parameters if channel msg
-	DWORD       dwEventLength;  // Length of data which follows if meta or sysex
-	LPBYTE      pLongData;      // -> Event data if applicable
-} TEMPEVENT, *PTEMPEVENT;
-
-#define ITS_F_ENDOFTRK  0x00000001
-
-// Description of a track open for read
-//
-typedef struct
-{
-	DWORD       fdwTrack;       // Track status
-	DWORD       dwTrackLength;  // Total bytes in track
-	DWORD       dwLeftInBuffer; // Bytes left unread in track buffer
-	LPBYTE      pTrackStart;    // -> start of track data buffer
-	LPBYTE      pTrackCurrent;  // -> next byte to read in buffer
-	DWORD       tkNextEventDue; // Absolute time of next event in track
-	BYTE        byRunningStatus;// Running status from last channel msg
-
-	FILEOFF     foTrackStart;   // Start of track -- used for walking the file
-	FILEOFF     foNextReadStart;// File offset of next read from disk
-	DWORD       dwLeftOnDisk;   // Bytes left unread on disk
-#ifdef DEBUG
-	DWORD       nTrack;         // # of this track for debugging
-#endif
-} INTRACKSTATE, *PINTRACKSTATE;
-
-// Description of the input MIDI file
-//
-typedef struct
-{
-	DWORD       cbFileLength;           // Total bytes in file
-	DWORD       dwTimeDivision;         // Original time division
-	DWORD       dwFormat;               // Original format
-	DWORD       dwTrackCount;           // Track count (specifies pitsTracks size)
-	INTRACKSTATE *pitsTracks;           // -> array of tracks in this file
-} INFILESTATE, *PINFILESTATE;
-
-#endif //__MIDSTUFF_H__
diff --git a/src/win32ce/resource.h b/src/win32ce/resource.h
deleted file mode 100644
index a712f14d6117427ec865278e0f634b44063d80b4..0000000000000000000000000000000000000000
--- a/src/win32ce/resource.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
-// Used by Srb2win.rc
-//
-#define IDI_DLICON1                     101
-#define IDC_DLCURSOR1                   103
-#define IDI_ICON1                       106
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        114
-#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1000
-#define _APS_NEXT_SYMED_VALUE           101
-#endif
-#endif
diff --git a/src/win32ce/win_cd.c b/src/win32ce/win_cd.c
deleted file mode 100644
index 2b1a8be9a4321255c0ce2e9e89d32b044d54deeb..0000000000000000000000000000000000000000
--- a/src/win32ce/win_cd.c
+++ /dev/null
@@ -1,529 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief cd music interface (uses MCI).
-
-#include "../doomdef.h"
-#include "win_main.h"
-#include <mmsystem.h>
-
-#include "../command.h"
-#include "../doomtype.h"
-#include "../i_sound.h"
-#include "../i_system.h"
-
-#include "../s_sound.h"
-
-#define MAX_CD_TRACKS       255
-
-typedef struct {
-	BOOL    IsAudio;
-	DWORD   Start, End;
-	DWORD   Length;         // minutes
-} CDTrack;
-
-// -------
-// private
-// -------
-static  CDTrack          m_nTracks[MAX_CD_TRACKS];
-static  int              m_nTracksCount;             // up to MAX_CD_TRACKS
-static  MCI_STATUS_PARMS m_MCIStatus;
-static  MCI_OPEN_PARMS   m_MCIOpen;
-
-// ------
-// protos
-// ------
-static void Command_Cd_f (void);
-
-
-// -------------------
-// MCIErrorMessageBox
-// Retrieve error message corresponding to return value from
-//  mciSendCommand() or mciSenString()
-// -------------------
-static VOID MCIErrorMessageBox (MCIERROR iErrorCode)
-{
-	char szErrorText[128];
-	if (!mciGetErrorStringA (iErrorCode, szErrorText, sizeof (szErrorText)))
-		wsprintfA(szErrorText,"MCI CD Audio Unknow Error #%d\n", iErrorCode);
-	CONS_Printf (szErrorText);
-	/*MessageBox (GetActiveWindow(), szTemp+1, "LEGACY",
-				MB_OK | MB_ICONSTOP);*/
-}
-
-
-// --------
-// CD_Reset
-// --------
-static void CD_Reset (void)
-{
-	// no win32 equivalent
-	//faB: for DOS, some odd drivers like to be reset sometimes.. useless in MCI I guess
-}
-
-
-// ----------------
-// CD_ReadTrackInfo
-// Read in number of tracks, and length of each track in minutes/seconds
-// returns true if error
-// ----------------
-static BOOL CD_ReadTrackInfo (void)
-{
-	int         i;
-	int         nTrackLength;
-	MCIERROR    iErr;
-
-	m_nTracksCount = 0;
-
-	m_MCIStatus.dwItem = MCI_STATUS_NUMBER_OF_TRACKS;
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus);
-	if (iErr)
-	{
-		MCIErrorMessageBox (iErr);
-		return FALSE;
-	}
-	m_nTracksCount = (int)m_MCIStatus.dwReturn;
-	if (m_nTracksCount > MAX_CD_TRACKS)
-		m_nTracksCount = MAX_CD_TRACKS;
-
-	for (i = 0; i < m_nTracksCount; i++)
-	{
-		m_MCIStatus.dwTrack = (DWORD)(i+1);
-		m_MCIStatus.dwItem = MCI_STATUS_LENGTH;
-		iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus);
-		if (iErr)
-		{
-			MCIErrorMessageBox (iErr);
-			return FALSE;
-		}
-		nTrackLength = (DWORD)(MCI_MSF_MINUTE(m_MCIStatus.dwReturn)*60 + MCI_MSF_SECOND(m_MCIStatus.dwReturn));
-		m_nTracks[i].Length = nTrackLength;
-
-		m_MCIStatus.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
-		iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus);
-		if (iErr)
-		{
-			MCIErrorMessageBox (iErr);
-			return FALSE;
-		}
-		m_nTracks[i].IsAudio = (m_MCIStatus.dwReturn == MCI_CDA_TRACK_AUDIO);
-	}
-
-	return TRUE;
-}
-
-
-// ------------
-// CD_TotalTime
-// returns total time for all audio tracks in seconds
-// ------------
-static int CD_TotalTime (void)
-{
-	int nTotalLength = 0;
-	int nTrack;
-	for (nTrack = 0; nTrack < m_nTracksCount; nTrack++)
-	{
-		if (m_nTracks[nTrack].IsAudio)
-			nTotalLength = nTotalLength + m_nTracks[nTrack].Length;
-	}
-	return nTotalLength;
-}
-
-
-//======================================================================
-//                   CD AUDIO MUSIC SUBSYSTEM
-//======================================================================
-
-UINT8  cdaudio_started = 0;   // for system startup/shutdown
-
-static boolean cdPlaying = false;
-static int     cdPlayTrack;         // when cdPlaying is true
-static boolean cdLooping = false;
-static UINT8   cdRemap[MAX_CD_TRACKS];
-static boolean cdEnabled = true;      // cd info available
-static boolean cdValid;             // true when last cd audio info was ok
-static boolean wasPlaying;
-//static int     cdVolume = 0;          // current cd volume (0-31)
-
-// 0-31 like Music & Sfx, though CD hardware volume is 0-255.
-consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-// allow Update for next/loop track
-// some crap cd drivers take up to
-// a second for a simple 'busy' check..
-// (on those Update can be disabled)
-consvar_t cdUpdate  = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-// hour,minutes,seconds
-static char *hms(int seconds)
-{
-	int hours, minutes;
-	static char s[9];
-
-	minutes = seconds / 60;
-	seconds %= 60;
-	hours = minutes / 60;
-	minutes %= 60;
-	if (hours > 0)
-		sprintf (s, "%d:%02d:%02d", hours, minutes, seconds);
-	else
-		sprintf (s, "%2d:%02d", minutes, seconds);
-	return s;
-}
-
-static void Command_Cd_f (void)
-{
-	LPCSTR    s;
-	int       i,j;
-
-	if (!cdaudio_started)
-		return;
-
-	if (COM_Argc()<2)
-	{
-		CONS_Printf ("cd [on] [off] [remap] [reset] [open]\n"
-		             "   [info] [play <track>] [loop <track>]\n"
-		             "   [stop] [resume]\n");
-		return;
-	}
-
-	s = COM_Argv(1);
-
-	// activate cd music
-	if (!strncmp(s,"on",2))
-	{
-		cdEnabled = true;
-		return;
-	}
-
-	// stop/deactivate cd music
-	if (!strncmp(s,"off",3))
-	{
-		if (cdPlaying)
-			I_StopCD ();
-		cdEnabled = false;
-		return;
-	}
-
-	// remap tracks
-	if (!strncmp(s,"remap",5))
-	{
-		i = (int)COM_Argc() - 2;
-		if (i <= 0)
-		{
-			CONS_Printf ("CD tracks remapped in that order :\n");
-			for (j = 1; j < MAX_CD_TRACKS; j++)
-				if (cdRemap[j] != j)
-					CONS_Printf (" %2d -> %2d\n", j, cdRemap[j]);
-			return;
-		}
-		for (j = 1; j <= i; j++)
-			cdRemap[j] = (UINT8)atoi (COM_Argv (j+1));
-		return;
-	}
-
-	// reset the CD driver, useful on some odd cd's
-	if (!strncmp(s,"reset",5))
-	{
-		cdEnabled = true;
-		if (cdPlaying)
-			I_StopCD ();
-		for (i = 0; i < MAX_CD_TRACKS; i++)
-			cdRemap[i] = (UINT8)i;
-		CD_Reset();
-		cdValid = CD_ReadTrackInfo();
-		return;
-	}
-
-	// any other command is not allowed until we could retrieve cd information
-	if (!cdValid)
-	{
-		CONS_Printf ("CD is not ready.\n");
-		return;
-	}
-
-	/* faB: not with MCI, didn't find it, useless anyway
-	if (!strncmp(s,"open",4))
-	{
-		if (cdPlaying)
-			I_StopCD ();
-		bcd_open_door();
-		cdValid = false;
-		return;
-	}*/
-
-	if (!strncmp(s,"info",4))
-	{
-		if (!CD_ReadTrackInfo())
-		{
-			cdValid = false;
-			return;
-		}
-
-		cdValid = true;
-
-		if (m_nTracksCount <= 0)
-			CONS_Printf ("No audio tracks\n");
-		else
-		{
-			// display list of tracks
-			// highlight current playing track
-			for (i = 0; i < m_nTracksCount; i++)
-			{
-				CONS_Printf("%s%2d. %s  %s\n",
-				            cdPlaying && (cdPlayTrack == i) ? "\2 " : " ",
-				            i+1, m_nTracks[i].IsAudio ? "audio" : "data ",
-				            hms(m_nTracks[i].Length));
-			}
-			CONS_Printf ("\2Total time : %s\n", hms(CD_TotalTime()));
-		}
-		if (cdPlaying)
-		{
-			CONS_Printf ("%s track : %d\n", cdLooping ? "looping" : "playing",
-			             cdPlayTrack);
-		}
-		return;
-	}
-
-	if (!strncmp(s,"play",4))
-	{
-		I_PlayCD ((UINT8)atoi(COM_Argv (2)), false);
-		return;
-	}
-
-	if (!strncmp(s,"stop",4))
-	{
-		I_StopCD ();
-		return;
-	}
-
-	if (!strncmp(s,"loop",4))
-	{
-		I_PlayCD ((UINT8)atoi(COM_Argv (2)), true);
-		return;
-	}
-
-	if (!strncmp(s,"resume",4))
-	{
-		I_ResumeCD ();
-		return;
-	}
-
-	CONS_Printf ("cd command '%s' unknown\n", s);
-}
-
-
-// ------------
-// I_ShutdownCD
-// Shutdown CD Audio subsystem, release whatever was allocated
-// ------------
-void I_ShutdownCD (void)
-{
-	MCIERROR    iErr;
-
-	if (!cdaudio_started)
-		return;
-
-	CONS_Printf("I_ShutdownCD()\n");
-
-	I_StopCD();
-
-	// closes MCI CD
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0);
-	if (iErr)
-		MCIErrorMessageBox (iErr);
-}
-
-
-// --------
-// I_InitCD
-// Init CD Audio subsystem
-// --------
-void I_InitCD (void)
-{
-	MCI_SET_PARMS   mciSet;
-	MCIERROR    iErr;
-	int         i;
-
-	// We don't have an open device yet
-	m_MCIOpen.wDeviceID = 0;
-	m_nTracksCount = 0;
-
-	cdaudio_started = false;
-
-	m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO;
-	iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen);
-	if (iErr)
-	{
-		MCIErrorMessageBox (iErr);
-		return;
-	}
-
-	// Set the time format to track/minute/second/frame (TMSF).
-	mciSet.dwTimeFormat = MCI_FORMAT_TMSF;
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet);
-	if (iErr)
-	{
-		MCIErrorMessageBox (iErr);
-		mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0);
-		return;
-	}
-
-	I_AddExitFunc (I_ShutdownCD);
-	cdaudio_started = true;
-
-	CONS_Printf("I_InitCD: Init CD audio\n");
-
-	// last saved in config.cfg
-	i = cd_volume.value;
-	//I_SetVolumeCD (0);   // initialize to 0 for some odd cd drivers
-	I_SetVolumeCD (i);   // now set the last saved volume
-
-	for (i = 0; i < MAX_CD_TRACKS; i++)
-		cdRemap[i] = (UINT8)i;
-
-	if (!CD_ReadTrackInfo())
-	{
-		CONS_Printf("\2I_InitCD: no CD in player.\n");
-		cdEnabled = false;
-		cdValid = false;
-	}
-	else
-	{
-		cdEnabled = true;
-		cdValid = true;
-	}
-
-	COM_AddCommand ("cd", Command_Cd_f);
-}
-
-
-
-// loop/go to next track when track is finished (if cd_update var is true)
-// update the volume when it has changed (from console/menu)
-void I_UpdateCD (void)
-{
-		/// \todo check for cd change and restart music ?
-}
-
-
-//
-void I_PlayCD (UINT8 nTrack, UINT8 bLooping)
-{
-	MCI_PLAY_PARMS  mciPlay;
-	MCIERROR        iErr;
-
-	if (!cdaudio_started || !cdEnabled)
-		return;
-
-	//faB: try again if it didn't work (just free the user of typing 'cd reset' command)
-	if (!cdValid)
-		cdValid = CD_ReadTrackInfo();
-	if (!cdValid)
-		return;
-
-	// tracks start at 0 in the code..
-	nTrack--;
-	if (nTrack < 0 || nTrack >= m_nTracksCount)
-		nTrack = nTrack % m_nTracksCount;
-
-	nTrack = cdRemap[nTrack];
-
-	if (cdPlaying)
-	{
-		if (cdPlayTrack == nTrack)
-			return;
-		I_StopCD ();
-	}
-
-	cdPlayTrack = nTrack;
-
-	if (!m_nTracks[nTrack].IsAudio)
-	{
-		//CONS_Printf ("\2CD Play: not an audio track\n"); // Tails 03-25-2001
-		return;
-	}
-
-	cdLooping = bLooping;
-
-	//faB: stop MIDI music, MIDI music will restart if volume is upped later
-	cv_digmusicvolume.value = 0;
-	cv_midimusicvolume.value = 0;
-	I_StopSong (0);
-
-	//faB: I don't use the notify message, I'm trying to minimize the delay
-	mciPlay.dwCallback = (DWORD_PTR)((size_t)hWndMain);
-	mciPlay.dwFrom = MCI_MAKE_TMSF(nTrack+1, 0, 0, 0);
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PLAY, MCI_FROM|MCI_NOTIFY, (DWORD_PTR)&mciPlay);
-	if (iErr)
-	{
-		MCIErrorMessageBox (iErr);
-		cdValid = false;
-		cdPlaying = false;
-		return;
-	}
-
-	cdPlaying = true;
-}
-
-
-// pause cd music
-void I_StopCD (void)
-{
-	MCIERROR    iErr;
-
-	if (!cdaudio_started || !cdEnabled)
-		return;
-
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PAUSE, MCI_WAIT, 0);
-	if (iErr)
-		MCIErrorMessageBox (iErr);
-	else
-	{
-		wasPlaying = cdPlaying;
-		cdPlaying = false;
-	}
-}
-
-
-// continue after a pause
-void I_ResumeCD (void)
-{
-	MCIERROR    iErr;
-
-	if (!cdaudio_started || !cdEnabled)
-		return;
-
-	if (!cdValid)
-		return;
-
-	if (!wasPlaying)
-		return;
-
-	iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_RESUME, MCI_WAIT, 0);
-	if (iErr)
-		MCIErrorMessageBox (iErr);
-	else
-		cdPlaying = true;
-}
-
-
-// volume : logical cd audio volume 0-31 (hardware is 0-255)
-int I_SetVolumeCD (int volume)
-{
-	(void)volume;
-	return 1;
-}
diff --git a/src/win32ce/win_dbg.c b/src/win32ce/win_dbg.c
deleted file mode 100644
index 9cfe77636a9fa19aa8be572029b1d8adb4dff404..0000000000000000000000000000000000000000
--- a/src/win32ce/win_dbg.c
+++ /dev/null
@@ -1,629 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Sources from GameDeveloper magazine article, January 1998, by Bruce Dawson.
-///	this source file contains the exception handler for recording error
-///	information after crashes.
-
-#include <tchar.h>
-#include "win_main.h"
-#include "../doomdef.h" //just for VERSION
-#include "win_dbg.h"
-#include "../m_argv.h" //print the parameter in the log
-
-
-#define NumCodeBytes    16          // Number of code bytes to record.
-#define MaxStackDump    2048    // Maximum number of DWORDS in stack dumps.
-#define StackColumns    8               // Number of columns in stack dump.
-
-#define ONEK                    1024
-#define SIXTYFOURK              (64*ONEK)
-#define ONEM                    (ONEK*ONEK)
-#define ONEG                    (ONEK*ONEK*ONEK)
-
-
-// --------------------------------------------------------------------------
-// return a description for an ExceptionCode
-// --------------------------------------------------------------------------
-static LPCSTR GetExceptionDescription (DWORD ExceptionCode)
-{
-	unsigned int i;
-
-	struct ExceptionNames
-	{
-		DWORD   ExceptionCode;
-		LPCSTR  ExceptionName;
-	};
-
-	struct ExceptionNames ExceptionMap[] =
-	{
-		{EXCEPTION_ACCESS_VIOLATION, "an Access Violation"},
-		{EXCEPTION_ARRAY_BOUNDS_EXCEEDED, "a Array Bounds Exceeded"},
-		{EXCEPTION_BREAKPOINT, "a Breakpoint"},
-		{EXCEPTION_DATATYPE_MISALIGNMENT, "a Datatype Misalignment"},
-		{EXCEPTION_FLT_DENORMAL_OPERAND, "a Float Denormal Operand"},
-		{EXCEPTION_FLT_DIVIDE_BY_ZERO, "a Float Divide By Zero"},
-		{EXCEPTION_FLT_INEXACT_RESULT, "a Float Inexact Result"},
-		{EXCEPTION_FLT_INVALID_OPERATION, "a Float Invalid Operation"},
-		{EXCEPTION_FLT_OVERFLOW, "a Float Overflow"},
-		{EXCEPTION_FLT_STACK_CHECK, "a Float Stack Check"},
-		{EXCEPTION_FLT_UNDERFLOW, "a Float Underflow"},
-		{EXCEPTION_ILLEGAL_INSTRUCTION, "an Illegal Instruction"},
-		{EXCEPTION_IN_PAGE_ERROR, "an In Page Error"},
-		{EXCEPTION_INT_DIVIDE_BY_ZERO, "an Integer Divide By Zero"},
-		{EXCEPTION_INT_OVERFLOW, "an Integer Overflow"},
-		{EXCEPTION_INVALID_DISPOSITION, "an Invalid Disposition"},
-		{EXCEPTION_NONCONTINUABLE_EXCEPTION, "Noncontinuable Exception"},
-		{EXCEPTION_PRIV_INSTRUCTION, "a Privileged Instruction"},
-		{EXCEPTION_SINGLE_STEP, "a Single Step"},
-		{EXCEPTION_STACK_OVERFLOW, "a Stack Overflow"},
-		{0x40010005, "a Control-C"},
-		{0x40010008, "a Control-Break"},
-		{0xc0000006, "an In Page Error"},
-		{0xc0000017, "a No Memory"},
-		{0xc000001d, "an Illegal Instruction"},
-		{0xc0000025, "a Noncontinuable Exception"},
-		{0xc0000142, "a DLL Initialization Failed"},
-		{0xe06d7363, "a Microsoft C++ Exception"},
-	};
-
-	for (i = 0; i < (sizeof (ExceptionMap) / sizeof (ExceptionMap[0])); i++)
-		if (ExceptionCode == ExceptionMap[i].ExceptionCode)
-			return ExceptionMap[i].ExceptionName;
-
-	return "Unknown exception type";
-}
-
-
-// --------------------------------------------------------------------------
-// Directly output a formatted string to the errorlog file, using win32 funcs
-// --------------------------------------------------------------------------
-static VOID FPrintf (HANDLE fileHandle, LPCSTR lpFmt, ...)
-{
-	CHAR    str[1999];
-	va_list arglist;
-	DWORD   bytesWritten;
-
-	va_start (arglist, lpFmt);
-	vsprintf (str, lpFmt, arglist);
-	va_end   (arglist);
-
-	WriteFile (fileHandle, str, (DWORD)strlen(str), &bytesWritten, NULL);
-}
-
-// --------------------------------------------------------------------------
-// Print the specified FILETIME to output in a human readable format,
-// without using the C run time.
-// --------------------------------------------------------------------------
-static VOID PrintTime (LPSTR output, FILETIME TimeToPrint)
-{
-	WORD Date, Time;
-	if (FileTimeToLocalFileTime (&TimeToPrint, &TimeToPrint) &&
-	    FileTimeToDosDateTime (&TimeToPrint, &Date, &Time))
-	{
-		// What a silly way to print out the file date/time.
-		wsprintfA(output, "%d/%d/%d %02d:%02d:%02d",
-		   (Date / 32) & 15, Date & 31, (Date / 512) + 1980,
-		   (Time / 2048), (Time / 32) & 63, (Time & 31) * 2);
-	}
-	else
-		output[0] = 0;
-}
-
-
-static LPTSTR GetFilePart(LPTSTR source)
-{
-	LPTSTR result = _tcsrchr(source, '\\');
-	if (result)
-		result++;
-	else
-		result = source;
-	return result;
-}
-
-// --------------------------------------------------------------------------
-// Print information about a code module (DLL or EXE) such as its size,
-// location, time stamp, etc.
-// --------------------------------------------------------------------------
-static VOID ShowModuleInfo(HANDLE LogFile, HMODULE ModuleHandle)
-{
-	CHAR ModName[MAX_PATH];
-	IMAGE_DOS_HEADER *DosHeader;
-	IMAGE_NT_HEADERS *NTHeader;
-	HANDLE ModuleFile;
-	CHAR TimeBuffer[100] = "";
-	DWORD FileSize = 0;
-#ifdef NO_SEH_MINGW
-	__try1(EXCEPTION_EXECUTE_HANDLER)
-#else
-	__try
-#endif
-	{
-		if (GetModuleFileNameA(ModuleHandle, ModName, sizeof (ModName)) > 0)
-		{
-			// If GetModuleFileName returns greater than zero then this must
-			// be a valid code module address. Therefore we can try to walk
-			// our way through its structures to find the link time stamp.
-			DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle;
-			if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic)
-				return;
-			NTHeader = (IMAGE_NT_HEADERS*)((char *)DosHeader
-				+ DosHeader->e_lfanew);
-			if (IMAGE_NT_SIGNATURE != NTHeader->Signature)
-				return;
-			// Open the code module file so that we can get its file date
-			// and size.
-			ModuleFile = CreateFileA(ModName, GENERIC_READ,
-				FILE_SHARE_READ, 0, OPEN_EXISTING,
-				FILE_ATTRIBUTE_NORMAL, 0);
-			if (ModuleFile != INVALID_HANDLE_VALUE)
-			{
-				FILETIME        LastWriteTime;
-				FileSize = GetFileSize(ModuleFile, 0);
-				if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime))
-				{
-					wsprintfA(TimeBuffer, " - file date is ");
-					PrintTime(TimeBuffer + strlen(TimeBuffer), LastWriteTime);
-				}
-				CloseHandle(ModuleFile);
-			}
-			FPrintf (LogFile, "%s, loaded at 0x%08x - %d bytes - %08x%s\r\n",
-				ModName, ModuleHandle, FileSize,
-				NTHeader->FileHeader.TimeDateStamp, TimeBuffer);
-		}
-	}
-	// Handle any exceptions by continuing from this point.
-#ifdef NO_SEH_MINGW
-	__except1
-#else
-	__except(EXCEPTION_EXECUTE_HANDLER)
-#endif
-	{
-	}
-}
-
-// --------------------------------------------------------------------------
-// Scan memory looking for code modules (DLLs or EXEs). VirtualQuery is used
-// to find all the blocks of address space that were reserved or committed,
-// and ShowModuleInfo will display module information if they are code
-// modules.
-// --------------------------------------------------------------------------
-static VOID RecordModuleList(HANDLE LogFile)
-{
-	SYSTEM_INFO     SystemInfo;
-	size_t PageSize;
-	size_t NumPages;
-	size_t pageNum = 0;
-	LPVOID LastAllocationBase = 0;
-
-	FPrintf (LogFile, "\r\n"
-		"\tModule list: names, addresses, sizes, time stamps "
-		"and file times:\r\n");
-
-	// Set NumPages to the number of pages in the 4GByte address space,
-	// while being careful to avoid overflowing ints.
-	GetSystemInfo(&SystemInfo);
-	PageSize = SystemInfo.dwPageSize;
-	NumPages = 4 * (unsigned int)(ONEG / PageSize);
-	while (pageNum < NumPages)
-	{
-		MEMORY_BASIC_INFORMATION        MemInfo;
-		if (VirtualQuery((LPVOID)(pageNum * PageSize), &MemInfo,
-			sizeof (MemInfo)))
-		{
-			if (MemInfo.RegionSize > 0)
-			{
-				// Adjust the page number to skip over this block of memory.
-				pageNum += MemInfo.RegionSize / PageSize;
-				if (MemInfo.State == MEM_COMMIT && MemInfo.AllocationBase >
-					LastAllocationBase)
-				{
-					// Look for new blocks of committed memory, and try
-					// recording their module names - this will fail
-					// gracefully if they aren't code modules.
-					LastAllocationBase = MemInfo.AllocationBase;
-					ShowModuleInfo(LogFile, (HMODULE)LastAllocationBase);
-				}
-			}
-			else
-				pageNum += SIXTYFOURK / PageSize;
-		}
-		else
-			pageNum += SIXTYFOURK / PageSize;
-		// If VirtualQuery fails we advance by 64K because that is the
-		// granularity of address space doled out by VirtualAlloc().
-	}
-}
-
-
-// --------------------------------------------------------------------------
-// Record information about the user's system, such as processor type, amount
-// of memory, etc.
-// --------------------------------------------------------------------------
-static VOID RecordSystemInformation(HANDLE fileHandle)
-{
-	FILETIME     CurrentTime;
-	CHAR         TimeBuffer[100];
-	CHAR         ModuleName[MAX_PATH];
-	CHAR         UserName[200];
-	DWORD        UserNameSize;
-	SYSTEM_INFO  SystemInfo;
-	MEMORYSTATUS MemInfo;
-
-	GetSystemTimeAsFileTime (&CurrentTime);
-	PrintTime (TimeBuffer, CurrentTime);
-	FPrintf(fileHandle, "Error occurred at %s.\r\n", TimeBuffer);
-
-	if (GetModuleFileNameA(NULL, ModuleName, sizeof (ModuleName)) <= 0)
-		strcpy (ModuleName, "Unknown");
-	UserNameSize = sizeof (UserName);
-	if (!GetUserNameA(UserName, &UserNameSize))
-		strcpy (UserName, "Unknown");
-	FPrintf(fileHandle, "%s, run by %s.\r\n", ModuleName, UserName);
-
-	GetSystemInfo (&SystemInfo);
-	FPrintf (fileHandle, "%d processor(s), type %d %d.%d.\r\n"
-	         "Program Memory from 0x%p to 0x%p\r\n",
-	         SystemInfo.dwNumberOfProcessors,
-	         SystemInfo.dwProcessorType,
-	         SystemInfo.wProcessorLevel,
-	         SystemInfo.wProcessorRevision,
-	         SystemInfo.lpMinimumApplicationAddress,
-	         SystemInfo.lpMaximumApplicationAddress);
-
-	MemInfo.dwLength = sizeof (MemInfo);
-	GlobalMemoryStatus(&MemInfo);
-	// Print out the amount of physical memory, rounded up.
-	FPrintf(fileHandle, "%d MBytes physical memory.\r\n", (MemInfo.dwTotalPhys +
-	        ONEM - 1) / ONEM);
-}
-
-// --------------------------------------------------------------------------
-// What we do here is trivial : open a file, write out the register information
-// from the PEXCEPTION_POINTERS structure, then return EXCEPTION_CONTINUE_SEARCH
-// whose magic value tells Win32 to proceed with its normal error handling
-// mechanism. This is important : an error dialog will popup if possible and
-// the debugger will hopefully coexist peacefully with the structured exception
-// handler.
-// --------------------------------------------------------------------------
-int __cdecl RecordExceptionInfo (PEXCEPTION_POINTERS data/*, LPCSTR Message, LPSTR lpCmdLine*/)
-{
-	PEXCEPTION_RECORD   Exception;
-	PCONTEXT            Context;
-	TCHAR               ModuleName[MAX_PATH];
-	TCHAR               FileName[MAX_PATH] = TEXT("Unknown");
-	LPTSTR              FilePart, lastperiod;
-	TCHAR               CrashModulePathName[MAX_PATH];
-	LPCTSTR             CrashModuleFileName = TEXT("Unknown");
-	MEMORY_BASIC_INFORMATION    MemInfo;
-	static int          BeenHere = false;
-	HANDLE              fileHandle;
-	UINT8              *code;
-	int                 codebyte,i;
-
-	if (data)
-	{
-		Exception = data->ExceptionRecord;
-		Context = data->ContextRecord;
-	}
-	else
-	{
-		return EXCEPTION_CONTINUE_SEARCH;
-	}
-
-	if (BeenHere)       // Going recursive! That must mean this routine crashed!
-		return EXCEPTION_CONTINUE_SEARCH;
-	BeenHere = true;
-
-	// Create a filename to record the error information to.
-	// Store it in the executable directory.
-	if (GetModuleFileName(NULL, ModuleName, sizeof (ModuleName)) <= 0)
-		ModuleName[0] = 0;
-	FilePart = GetFilePart(ModuleName);
-
-	// Extract the file name portion and remove it's file extension. We'll
-	// use that name shortly.
-	lstrcpy (FileName, FilePart);
-	lastperiod = _tcsrchr (FileName, '.');
-	if (lastperiod)
-		lastperiod[0] = 0;
-	// Replace the executable filename with our error log file name.
-	lstrcpy (FilePart, TEXT("errorlog.txt"));
-	fileHandle = CreateFile (ModuleName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
-		FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
-	if (fileHandle == INVALID_HANDLE_VALUE)
-	{
-		OutputDebugString (TEXT("Error creating exception report"));
-		return EXCEPTION_CONTINUE_SEARCH;
-	}
-
-	// Append to the error log.
-	SetFilePointer (fileHandle, 0, 0, FILE_END);
-
-	// Print out some blank lines to separate this error log from any previous ones.
-	FPrintf (fileHandle, "Email Sonic Team Junior so we can fix the bugs\r\n"); // Tails
-	FPrintf (fileHandle, "Make sure you tell us what you were doing to cause the crash, and if possible, record a demo!\r\n"); // Tails
-	FPrintf (fileHandle, "\r\n\r\n\r\n\r\n");
-	FPrintf (fileHandle, "SRB2 %s -ERROR LOG-\r\n\r\n", VERSIONSTRING);
-	FPrintf (fileHandle, "\r\n");
-	// VirtualQuery can be used to get the allocation base associated with a
-	// code address, which is the same as the ModuleHandle. This can be used
-	// to get the filename of the module that the crash happened in.
-	if (VirtualQuery ((LPVOID)(size_t)Context->Eip, &MemInfo, sizeof (MemInfo)) &&
-	     GetModuleFileName ((HMODULE)MemInfo.AllocationBase,
-	                        CrashModulePathName,
-	                        sizeof (CrashModulePathName)) > 0)
-		CrashModuleFileName = GetFilePart(CrashModulePathName);
-
-	// Print out the beginning of the error log in a Win95 error window
-	// compatible format.
-	FPrintf (fileHandle, "%s caused an %s in module %s at %04x:%08x.\r\n",
-		FileName, GetExceptionDescription(Exception->ExceptionCode),
-		CrashModuleFileName, Context->SegCs, Context->Eip);
-	 //if (&Message = Null)
-		FPrintf (fileHandle, "Exception handler called in %s.\r\n", "main thread");
-	 //else
-		//FPrintf (fileHandle, "Exception handler called in %s.\r\n", Message);
-
-	RecordSystemInformation (fileHandle);
-
-	// If the exception was an access violation, print out some additional
-	// information, to the error log and the debugger.
-	if (Exception->ExceptionCode == STATUS_ACCESS_VIOLATION &&
-		Exception->NumberParameters >= 2)
-	{
-		TCHAR DebugMessage[1000];
-		LPCTSTR readwrite = TEXT("Read from");
-		if (Exception->ExceptionInformation[0])
-			readwrite = TEXT("Write to");
-		wsprintf(DebugMessage, TEXT("%s location %08x caused an access violation.\r\n"),
-			readwrite, Exception->ExceptionInformation[1]);
-#ifdef  _DEBUG
-		// The VisualC++ debugger doesn't actually tell you whether a read
-		// or a write caused the access violation, nor does it tell what
-		// address was being read or written. So I fixed that.
-		OutputDebugString(TEXT("Exception handler: "));
-		OutputDebugString(DebugMessage);
-#endif
-		FPrintf(fileHandle, "%s", DebugMessage);
-	}
-
-	FPrintf(fileHandle, "\r\n");
-
-	// Print out the register values in a Win95 error window compatible format.
-	if ((Context->ContextFlags & CONTEXT_FULL) == CONTEXT_FULL)
-	{
-		FPrintf (fileHandle, "Registers:\r\n");
-		FPrintf (fileHandle, "EAX=%.8lx CS=%.4x EIP=%.8lx EFLGS=%.8lx\r\n",
-			Context->Eax,Context->SegCs,Context->Eip,Context->EFlags);
-		FPrintf (fileHandle, "EBX=%.8lx SS=%.4x ESP=%.8lx EBP=%.8lx\r\n",
-			Context->Ebx,Context->SegSs,Context->Esp,Context->Ebp);
-		FPrintf (fileHandle, "ECX=%.8lx DS=%.4x ESI=%.8lx FS=%.4x\r\n",
-			Context->Ecx,Context->SegDs,Context->Esi,Context->SegFs);
-		FPrintf (fileHandle, "EDX=%.8lx ES=%.4x EDI=%.8lx GS=%.4x\r\n",
-			Context->Edx,Context->SegEs,Context->Edi,Context->SegGs);
-	}
-
-	// moved down because it was causing the printout to stop
-	FPrintf (fileHandle, "Command Line parameters: ");
-	for (i = 1;i < myargc;i++)
-		FPrintf (fileHandle, "%s ", myargv[i]);
-
-	FPrintf (fileHandle, "Bytes at CS : EIP:\r\n");
-
-	// Print out the bytes of code at the instruction pointer. Since the
-	// crash may have been caused by an instruction pointer that was bad,
-	// this code needs to be wrapped in an exception handler, in case there
-	// is no memory to read. If the dereferencing of code[] fails, the
-	// exception handler will print '??'.
-	code = (UINT8 *)(size_t)Context->Eip;
-	for (codebyte = 0; codebyte < NumCodeBytes; codebyte++)
-	{
-#ifdef NO_SEH_MINGW
-		__try1(EXCEPTION_EXECUTE_HANDLER)
-#else
-		__try
-#endif
-		{
-			FPrintf (fileHandle, "%02x ", code[codebyte]);
-		}
-#ifdef NO_SEH_MINGW
-		__except1
-#else
-		__except(EXCEPTION_EXECUTE_HANDLER)
-#endif
-		{
-			FPrintf (fileHandle, "?? ");
-		}
-	}
-
-	// Time to print part or all of the stack to the error log. This allows
-	// us to figure out the call stack, parameters, local variables, etc.
-	FPrintf (fileHandle, "\r\n"
-		"Stack dump:\r\n");
-#ifdef NO_SEH_MINGW
-	__try1(EXCEPTION_EXECUTE_HANDLER)
-#else
-	__try
-#endif
-	{
-		// Esp contains the bottom of the stack, or at least the bottom of
-		// the currently used area.
-		DWORD*    pStack = (DWORD *)(size_t)Context->Esp;
-		DWORD*    pStackTop = NULL;
-		size_t    Count = 0;
-		TCHAR     buffer[1000] = TEXT("");
-		const int safetyzone = 50;
-		LPTSTR    nearend = buffer + sizeof (buffer) - safetyzone*sizeof (TCHAR);
-		LPTSTR    output = buffer;
-		const void *Suffix;
-
-		// Load the top (highest address) of the stack from the
-		// thread information block. It will be found there in
-		// Win9x and Windows NT.
-#ifdef __GNUC__
-		__asm__("movl %%fs : 4, %%eax": "=a"(pStackTop));
-#else
-		__asm
-		{
-			mov eax, fs:[4]
-			mov pStackTop, eax
-		}
-#endif
-		if (pStackTop == NULL)
-			goto StackSkip;
-		else if (pStackTop > pStack + MaxStackDump)
-			pStackTop = pStack + MaxStackDump;
-		// Too many calls to WriteFile can take a long time, causing
-		// confusing delays when programs crash. Therefore I implemented
-		// simple buffering for the stack dumping code instead of calling
-		// FPrintf directly.
-		while (pStack + 1 <= pStackTop)
-		{
-			if ((Count % StackColumns) == 0)
-				output += wsprintf(output, TEXT("%08x: "), pStack);
-			if ((++Count % StackColumns) == 0 || pStack + 2 > pStackTop)
-				Suffix = TEXT("\r\n");
-			else
-				Suffix = TEXT(" ");
-			output += wsprintf(output, TEXT("%08x%s"), *pStack, Suffix);
-			pStack++;
-			// Check for when the buffer is almost full, and flush it to disk.
-			if (output > nearend)
-			{
-				FPrintf (fileHandle, "%s", buffer);
-				buffer[0] = 0;
-				output = buffer;
-			}
-		}
-		// Print out any final characters from the cache.
-		StackSkip:
-		FPrintf (fileHandle, "%s", buffer);
-	}
-#ifdef NO_SEH_MINGW
-	__except1
-#else
-	__except(EXCEPTION_EXECUTE_HANDLER)
-#endif
-	{
-		FPrintf(fileHandle, "Exception encountered during stack dump.\r\n");
-	}
-
-	RecordModuleList (fileHandle);
-
-	CloseHandle (fileHandle);
-
-	// Return the magic value which tells Win32 that this handler didn't
-	// actually handle the exception - so that things will proceed as per
-	// normal.
-	//BP: should put message for end user to send this file to fix any bug
-	return EXCEPTION_CONTINUE_SEARCH;
-}
-
-	/*
-	//
-	//FPrintf ("e-mail this file to legacy@newdoom.com, so that we can fix the problem.\r\n\r\n");
-
-	FPrintf ("Exception handler called in %s.\r\n", Message);
-
-	GetSystemTime (&systemTime);
-	FPrintf ("Error occured at %02d/%02d/%04d %02d:%02d:%02d.\r\n",
-			 systemTime.wMonth, systemTime.wDay, systemTime.wYear,
-			 systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
-
-
-	FPrintf ("%s\r\n", filename);
-	FPrintf ("Cmd-line: %s\r\n", lpCmdLine);
-
-	// Nested exceptions can occur, get info for each one
-
-	nER = 1;
-	while (ER)
-	{
-		if (nER++>1)
-			FPrintf ("Exception Record %d.\r\n", nER);
-
-		FPrintf ("application caused an %s", GetExceptionCodeStr(Exception->ExceptionCode));
-
-		if (Context->ContextFlags & CONTEXT_CONTROL)
-			FPrintf (" at %.4x:%.8x.\r\n", Context->SegCs, Context->Eip);
-
-		// in case of..
-		if (Context->Eip != (unsigned long)Exception->ExceptionAddress)
-			FPrintf ("Exception Address = %.8x\r\n", Exception->ExceptionAddress);
-
-		if (Exception->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
-		{
-			FPrintf ("\r\n%s location 0x%x caused an access violation.\r\n",
-					(Exception->ExceptionInformation[0] ? "Write to" : "Read from"),
-					 Exception->ExceptionInformation[1]);
-		}
-
-		ER = Exception->ExceptionRecord;
-	}
-
-
-	if (Context->ContextFlags & CONTEXT_DEBUG_REGISTERS)
-	{
-		FPrintf ("\r\nDebug Registers:\r\n");
-		FPrintf ("Dr0=%.8x  Dr1=%.8x  Dr2=%.8x\r\n"
-				 "Dr3=%.8x  Dr6=%.8x  Dr7=%.8x\r\n",
-				 Context->Dr0, Context->Dr1, Context->Dr2,
-				 Context->Dr3, Context->Dr6, Context->Dr7);
-	}
-
-	if (Context->ContextFlags & CONTEXT_FLOATING_POINT)
-	{
-		FPrintf ("\r\nFloating Save Area:\r\n");
-		FPrintf ("ControlWord  =%.8x  TagWord      =%.8x  ErrorSelector=%.8x  DataSelector =%.8x\r\n"
-				 "StatusWord   =%.8x  ErrorOffset  =%.8x  DataOffset   =%.8x  Cr0NpxState  =%.8x\r\n",
-				 Context->FloatSave.ControlWord, Context->FloatSave.TagWord, Context->FloatSave.ErrorSelector, Context->FloatSave.DataSelector,
-				 Context->FloatSave.StatusWord, Context->FloatSave.ErrorOffset, Context->FloatSave.DataOffset, Context->FloatSave.Cr0NpxState
-				);
-
-		//BYTE    RegisterArea[SIZE_OF_80387_REGISTERS];
-	}
-
-
-	// in case of...
-	if ((Context->ContextFlags & CONTEXT_FULL) != CONTEXT_FULL)
-	{
-		if (!(Context->ContextFlags & CONTEXT_SEGMENTS))
-			FPrintf ("Note! GS,FS,ES,DS are unspecified\r\n");
-		if (!(Context->ContextFlags & CONTEXT_INTEGER))
-			FPrintf ("Note! EDI,ESI,EBX,EDX,ECX,EAX are unspecified\r\n");
-		if (!(Context->ContextFlags & CONTEXT_CONTROL))
-			FPrintf ("Note! EBP,CS : EIP,EFlags,SS : ESP are unspecified\r\n");
-	}
-
-	FPrintf ("\r\nBytes at CS : EIP:\r\n");
-	ucptr = (UINT8 *)Context->Eip;
-	for (i = 0; i < 16; i++)
-		FPrintf ("%.2x ", *ucptr++);
-
-	FPrintf ("\r\n\r\nStack dump:\r\n");
-	ulptr = (unsigned long*)Context->Esp;
-	for (i = 0; i < 16; i++)
-		FPrintf ("%.8x ", *ulptr++);
-
-	//FPrintf ("Bytes at CS : EIP:\r\n");
-	//FPrintf ("%.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x ");
-
-	for (i = 0; i < 16; i++)
-	{
-		FPrintf ("%x
-	}
-*/
diff --git a/src/win32ce/win_dbg.h b/src/win32ce/win_dbg.h
deleted file mode 100644
index acee896e61795636d0d9650c1360b02a78dd49d0..0000000000000000000000000000000000000000
--- a/src/win32ce/win_dbg.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief exception handler
-
-//#define WIN32_LEAN_AND_MEAN
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-
-// called in the exception filter of the __try block, writes all useful debugging information
-// to a file, using only win32 functions in case the C runtime is in a bad state.
-int __cdecl RecordExceptionInfo (PEXCEPTION_POINTERS data/*, LPCSTR Message, LPSTR lpCmdLine*/);
-
-#ifdef __MINGW32__
-
-#include <excpt.h>
-
-#ifndef TRYLEVEL_NONE
-
-#define NO_SEH_MINGW //Alam:?
-FUNCINLINE static ATTRINLINE struct _EXCEPTION_POINTERS *GetExceptionInformation(VOID)
-{
-	LPVOID SEHINFO = NULL;
-	//__asm__("movl -20(%%ebp), %%eax": "=a"(SEHINFO));
-	return SEHINFO;
-}
-
-//Alam_GBC: use __try1(seh)
-#ifndef __try
-#define __try
-#endif //__try
-
-//#undef NO_SEH_MINGW //Alam: win_dbg's code not working with MINGW
-//Alam_GBC: use __except1
-#ifndef __except
-#define __except(x) if (0)
-#endif //__except
-
-#endif // !__TRYLEVEL_NONE
-
-#endif // __MINGW32__
diff --git a/src/win32ce/win_dll.c b/src/win32ce/win_dll.c
deleted file mode 100644
index 8b88f84ddcec13c160b570bd2c5c56a96e0b651c..0000000000000000000000000000000000000000
--- a/src/win32ce/win_dll.c
+++ /dev/null
@@ -1,164 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief load and initialise the 3D driver DLL
-
-#include "../doomdef.h"
-#ifdef HWRENDER
-#include "../hardware/hw_drv.h"        // get the standard 3D Driver DLL exports prototypes
-#endif
-
-#ifdef HW3SOUND
-#include "../hardware/hw3dsdrv.h"      // get the 3D sound driver DLL export prototypes
-#endif
-
-#include "win_dll.h"
-#include "win_main.h"       // I_GetLastErrorMsgBox()
-
-#if defined(HWRENDER) || defined(HW3SOUND)
-typedef struct loadfunc_s {
-	LPCSTR fnName;
-	LPVOID fnPointer;
-} loadfunc_t;
-
-// --------------------------------------------------------------------------
-// Load a DLL, returns the HMODULE handle or NULL
-// --------------------------------------------------------------------------
-static inline HMODULE LoadDLL (LPCSTR dllName, loadfunc_t *funcTable)
-{
-	LPVOID      funcPtr;
-	loadfunc_t *loadfunc;
-	HMODULE     hModule;
-
-	if ((hModule = LoadLibraryA(dllName)) != NULL)
-	{
-		// get function pointers for all functions we use
-		for (loadfunc = funcTable; loadfunc->fnName != NULL; loadfunc++)
-		{
-			funcPtr = GetProcAddress(hModule, loadfunc->fnName);
-			if (!funcPtr) {
-				//I_GetLastErrorMsgBox ();
-				MessageBoxA(NULL, va("The '%s' haven't the good specification (function %s missing)\n\n"
-				           "You must use dll from the same zip of this exe\n", dllName, loadfunc->fnName),
-				           "Error", MB_OK|MB_ICONINFORMATION);
-				return FALSE;
-			}
-			// store function address
-			*((LPVOID*)loadfunc->fnPointer) = funcPtr;
-		}
-	}
-	else
-	{
-		MessageBoxA(NULL, va("LoadLibrary() FAILED : couldn't load '%s'\r\n", dllName), "Warning", MB_OK|MB_ICONINFORMATION);
-		//I_GetLastErrorMsgBox ();
-	}
-
-	return hModule;
-}
-
-
-// --------------------------------------------------------------------------
-// Unload the DLL
-// --------------------------------------------------------------------------
-static inline VOID UnloadDLL (HMODULE* pModule)
-{
-	if (FreeLibrary(*pModule))
-		*pModule = NULL;
-	else
-		I_GetLastErrorMsgBox ();
-}
-#endif
-
-// ==========================================================================
-// STANDARD 3D DRIVER DLL FOR DOOM LEGACY
-// ==========================================================================
-
-// note : the 3D driver loading should be put somewhere else..
-
-#ifdef HWRENDER
-static HMODULE hwdModule = NULL;
-
-static loadfunc_t hwdFuncTable[] = {
-	{"_Init@4",            &hwdriver.pfnInit},
-	{"_Shutdown@0",        &hwdriver.pfnShutdown},
-	{"_GetModeList@8",     &hwdriver.pfnGetModeList},
-	{"_SetPalette@8",      &hwdriver.pfnSetPalette},
-	{"_FinishUpdate@4",    &hwdriver.pfnFinishUpdate},
-	{"_Draw2DLine@12",     &hwdriver.pfnDraw2DLine},
-	{"_DrawPolygon@16",    &hwdriver.pfnDrawPolygon},
-	{"_SetBlend@4",        &hwdriver.pfnSetBlend},
-	{"_ClearBuffer@12",    &hwdriver.pfnClearBuffer},
-	{"_SetTexture@4",      &hwdriver.pfnSetTexture},
-	{"_ReadRect@24",       &hwdriver.pfnReadRect},
-	{"_GClipRect@20",      &hwdriver.pfnGClipRect},
-	{"_ClearMipMapCache@0",&hwdriver.pfnClearMipMapCache},
-	{"_SetSpecialState@8", &hwdriver.pfnSetSpecialState},
-	{"_DrawMD2@16",        &hwdriver.pfnDrawMD2},
-	{"_SetTransform@4",    &hwdriver.pfnSetTransform},
-	{"_GetTextureUsed@0",  &hwdriver.pfnGetTextureUsed},
-	{"_GetRenderVersion@0",&hwdriver.pfnGetRenderVersion},
-	{NULL,NULL}
-};
-
-BOOL Init3DDriver (LPCSTR dllName)
-{
-	hwdModule = LoadDLL(dllName, hwdFuncTable);
-	return (hwdModule != NULL);
-}
-
-VOID Shutdown3DDriver (VOID)
-{
-	UnloadDLL(&hwdModule);
-}
-#endif
-
-#ifdef HW3SOUND
-static HMODULE hwsModule = NULL;
-
-static loadfunc_t hwsFuncTable[] = {
-	{"_Startup@8",              &hw3ds_driver.pfnStartup},
-	{"_Shutdown@0",             &hw3ds_driver.pfnShutdown},
-	{"_AddSfx@4",               &hw3ds_driver.pfnAddSfx},
-	{"_AddSource@8",            &hw3ds_driver.pfnAddSource},
-	{"_StartSource@4",          &hw3ds_driver.pfnStartSource},
-	{"_StopSource@4",           &hw3ds_driver.pfnStopSource},
-	{"_GetHW3DSVersion@0",      &hw3ds_driver.pfnGetHW3DSVersion},
-	{"_BeginFrameUpdate@0",     &hw3ds_driver.pfnBeginFrameUpdate},
-	{"_EndFrameUpdate@0",       &hw3ds_driver.pfnEndFrameUpdate},
-	{"_IsPlaying@4",            &hw3ds_driver.pfnIsPlaying},
-	{"_UpdateListener@8",       &hw3ds_driver.pfnUpdateListener},
-	{"_UpdateSourceParms@12",   &hw3ds_driver.pfnUpdateSourceParms},
-	{"_SetCone@8",              &hw3ds_driver.pfnSetCone},
-	{"_SetGlobalSfxVolume@4",   &hw3ds_driver.pfnSetGlobalSfxVolume},
-	{"_Update3DSource@8",       &hw3ds_driver.pfnUpdate3DSource},
-	{"_ReloadSource@8",         &hw3ds_driver.pfnReloadSource},
-	{"_KillSource@4",           &hw3ds_driver.pfnKillSource},
-	{"_KillSfx@4",              &hw3ds_driver.pfnKillSfx},
-	{"_GetHW3DSTitle@8",        &hw3ds_driver.pfnGetHW3DSTitle},
-	{NULL, NULL}
-};
-
-BOOL Init3DSDriver(LPCSTR dllName)
-{
-	hwsModule = LoadDLL(dllName, hwsFuncTable);
-	return (hwsModule != NULL);
-}
-
-VOID Shutdown3DSDriver (VOID)
-{
-	UnloadDLL(&hwsModule);
-}
-#endif
diff --git a/src/win32ce/win_dll.h b/src/win32ce/win_dll.h
deleted file mode 100644
index b4b259587caacbf91dd97523c850bf7a96a1b57a..0000000000000000000000000000000000000000
--- a/src/win32ce/win_dll.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief load/unload a DLL at run-time
-
-//#define WIN32_LEAN_AND_MEAN
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-
-#ifdef HWRENDER
-BOOL Init3DDriver (LPCSTR dllName);
-VOID Shutdown3DDriver (VOID);
-#endif
-
-#ifdef HW3SOUND
-BOOL Init3DSDriver(LPCSTR dllName);
-VOID Shutdown3DSDriver(VOID);
-#endif
diff --git a/src/win32ce/win_file.c b/src/win32ce/win_file.c
deleted file mode 100644
index f9f6210119febd5bbbba2976eaa8ca80e2f889c5..0000000000000000000000000000000000000000
--- a/src/win32ce/win_file.c
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <stdlib.h>
-#include <windows.h>
-#include "win_file.h"
-
-
-int FileAccess(LPCTSTR FileName, DWORD mode)
-{
-	HANDLE hFile;
-
-	hFile = CreateFile( FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-
-	if (hFile == INVALID_HANDLE_VALUE)
-		return -1;
-	else
-	{
-		FileClose(hFile);
-		return 0;
-	}
-}
-
-HANDLE FileCreate(LPCTSTR FileName)
-{
-	HANDLE hFile;
-
-	if (FileAccess( FileName, 0) == 0)
-		hFile = CreateFile( FileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-	else
-		hFile = CreateFile( FileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
-
-	return hFile;
-}
-
-void FileClose(HANDLE hFile)
-{
-	CloseHandle(hFile);
-}
-
-DWORD FileLength(HANDLE hFile)
-{
-	return GetFileSize(hFile, NULL);
-}
-
-HANDLE FileOpen(LPCTSTR FileName)
-{
-	HANDLE hFile;
-
-	hFile = CreateFile( FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-
-	return hFile;
-}
-
-HANDLE FileAppend(LPCTSTR FileName)
-{
-	HANDLE hFile;
-
-	hFile = CreateFile( FileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-	FileSeek(hFile, 0, FILE_END );
-
-	return hFile;
-}
-
-DWORD FileRead(HANDLE hFile, LPVOID data, DWORD size)
-{
-	DWORD readin = 0;
-
-	ReadFile(hFile, data, size, &readin, NULL);
-
-	return readin;
-}
-
-DWORD FileSeek(HANDLE hFile, LONG distance, DWORD method)
-{
-	DWORD position;
-
-	position = SetFilePointer(hFile, distance, NULL, method);
-
-	return position;
-}
-
-DWORD FileWrite(HANDLE hFile, LPCVOID data, DWORD size)
-{
-	DWORD written = 0;
-
-	WriteFile(hFile, data, size, &written, NULL);
-
-	return written;
-}
-
-//These functions are provided as CRT replacements. (missing from WinCE)
-
-int access(char* file,int type)
-{
-	FILE* file_access = 0;
-
-	file_access = fopen(file,"rb");
-
-	if(file_access)
-	{
-		fclose(file_access);
-		return 0;
-	}
-
-	return -1;
-}
-
-unsigned int file_len(char* file)
-{
-	FILE* file_access;
-	unsigned int len = 0;
-
-	file_access = fopen(file,"rb");
-
-	if(!file_access)
-		return 0;
-
-	fseek(file_access,0,SEEK_END);
-
-	len = ftell(file_access);
-
-	fclose(file_access);
-
-	return len;
-}
diff --git a/src/win32ce/win_file.h b/src/win32ce/win_file.h
deleted file mode 100644
index d1dc5e9c75ebc4df260bdf3f268d201236fe9c8b..0000000000000000000000000000000000000000
--- a/src/win32ce/win_file.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef FILE_H
-#define FILE_H
-
-// New File I/O functions
-
-int		FileAccess(LPCTSTR, DWORD);
-HANDLE	FileAppend(LPCTSTR FileName);
-void	FileClose(HANDLE);
-HANDLE	FileCreate(LPCTSTR);
-DWORD	FileLength(HANDLE);
-HANDLE	FileOpen(LPCTSTR);
-DWORD	FileRead(HANDLE, LPCVOID, DWORD);
-DWORD	FileSeek(HANDLE hFile, LONG distance, DWORD method);
-DWORD	FileWrite(HANDLE, LPCVOID, DWORD);
-
-int access(char* file,int type);
-unsigned int file_len(char* file);
-
-#endif
\ No newline at end of file
diff --git a/src/win32ce/win_main.c b/src/win32ce/win_main.c
deleted file mode 100644
index a8a5c7cf20f2f1c92c094d6a4987254ac1798d16..0000000000000000000000000000000000000000
--- a/src/win32ce/win_main.c
+++ /dev/null
@@ -1,539 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Win32 WinMain Entry Point
-///
-///	Win32 Sonic Robo Blast 2
-///
-///	NOTE:
-///		To compile WINDOWS SRB2 version : define a '_WINDOWS' symbol.
-///		to do this go to Project/Settings/ menu, click C/C++ tab, in
-///		'Preprocessor definitions:' add '_WINDOWS'
-
-#include "../doomdef.h"
-#include <stdio.h>
-
-#include "../doomstat.h"  // netgame
-#include "resource.h"
-
-#include "../m_argv.h"
-#include "../d_main.h"
-#include "../i_system.h"
-
-#include "../keys.h"    //hack quick test
-
-#include "../console.h"
-
-#include "fabdxlib.h"
-#include "win_main.h"
-#include "win_dbg.h"
-#include "../i_sound.h" // midi pause/unpause
-#include "../g_input.h" // KEY_MOUSEWHEELxxx
-
-// MSWheel support for Win95/NT3.51
-#include <zmouse.h>
-
-#ifndef WM_XBUTTONDOWN
-#define WM_XBUTTONDOWN 523
-#endif
-#ifndef WM_XBUTTONUP
-#define WM_XBUTTONUP 524
-#endif
-#ifndef MK_XBUTTON1
-#define MK_XBUTTON1 32
-#endif
-#ifndef MK_XBUTTON2
-#define MK_XBUTTON2 64
-#endif
-
-typedef BOOL (WINAPI *MyFunc)(VOID);
-
-HINSTANCE myInstance = NULL;
-HWND hWndMain = NULL;
-static HCURSOR windowCursor = NULL; // main window cursor
-
-boolean appActive = false; // app window is active
-
-#ifdef LOGMESSAGES
-// this is were I log debug text, cons_printf, I_error ect for window port debugging
-HANDLE logstream;
-#endif
-
-BOOL nodinput = FALSE;
-
-static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-	event_t ev; //Doom input event
-	int mouse_keys;
-
-	// judgecutor:
-	// Response MSH Mouse Wheel event
-
-	if (message == MSHWheelMessage)
-	{
-			message = WM_MOUSEWHEEL;
-		if (win9x)
-			wParam <<= 16;
-	}
-
-
-	switch (message)
-	{
-		case WM_CREATE:
-			nodinput = M_CheckParm("-nodinput");
-			break;
-
-		case WM_ACTIVATEAPP:           // Handle task switching
-			appActive = (int)wParam;
-			// pause music when alt-tab
-			if (appActive  && !paused)
-				I_ResumeSong(0);
-			else if (!paused)
-				I_PauseSong(0);
-			{
-				HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
-				if (ci != INVALID_HANDLE_VALUE && GetFileType(ci) == FILE_TYPE_CHAR)
-					appActive = true;
-			}
-			InvalidateRect (hWnd, NULL, TRUE);
-			break;
-
-		//for MIDI music
-		case WM_MSTREAM_UPDATEVOLUME:
-			I_SetMidiChannelVolume((DWORD)wParam, dwVolumePercent);
-			break;
-
-		case WM_PAINT:
-			if (!appActive && !bAppFullScreen && !netgame)
-				// app becomes inactive (if windowed)
-			{
-				// Paint "Game Paused" in the middle of the screen
-				PAINTSTRUCT ps;
-				RECT        rect;
-				HDC hdc = BeginPaint (hWnd, &ps);
-				GetClientRect (hWnd, &rect);
-				DrawText (hdc, TEXT("Game Paused"), -1, &rect,
-					DT_SINGLELINE | DT_CENTER | DT_VCENTER);
-				EndPaint (hWnd, &ps);
-				return 0;
-			}
-			break;
-
-		//case WM_RBUTTONDOWN:
-		//case WM_LBUTTONDOWN:
-
-		case WM_MOVE:
-			if (bAppFullScreen)
-			{
-				SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
-				return 0;
-			}
-			else
-			{
-				windowPosX = (SHORT) LOWORD(lParam);    // horizontal position
-				windowPosY = (SHORT) HIWORD(lParam);    // vertical position
-				break;
-			}
-			break;
-
-			// This is where switching windowed/fullscreen is handled. DirectDraw
-			// objects must be destroyed, recreated, and artwork reloaded.
-
-		case WM_DISPLAYCHANGE:
-		case WM_SIZE:
-			break;
-
-		case WM_SETCURSOR:
-			if (bAppFullScreen)
-				SetCursor(NULL);
-			else
-				SetCursor(windowCursor);
-			return TRUE;
-
-		case WM_KEYUP:
-			ev.type = ev_keyup;
-			goto handleKeyDoom;
-			break;
-
-		case WM_KEYDOWN:
-			ev.type = ev_keydown;
-
-	handleKeyDoom:
-			ev.data1 = 0;
-			if (wParam == VK_PAUSE)
-			// intercept PAUSE key
-			{
-				ev.data1 = KEY_PAUSE;
-			}
-			else if (!keyboard_started)
-			// post some keys during the game startup
-			// (allow escaping from network synchronization, or pressing enter after
-			//  an error message in the console)
-			{
-				switch (wParam)
-				{
-					case VK_ESCAPE: ev.data1 = KEY_ESCAPE;  break;
-					case VK_RETURN: ev.data1 = KEY_ENTER;   break;
-					default: ev.data1 = MapVirtualKey((DWORD)wParam,2); // convert in to char
-				}
-			}
-
-			if (ev.data1)
-				D_PostEvent (&ev);
-
-			return 0;
-			break;
-
-		// judgecutor:
-		// Handle mouse events
-		case WM_LBUTTONDOWN:
-		case WM_LBUTTONUP:
-		case WM_RBUTTONDOWN:
-		case WM_RBUTTONUP:
-		case WM_MBUTTONDOWN:
-		case WM_MBUTTONUP:
-		case WM_XBUTTONDOWN:
-		case WM_XBUTTONUP:
-		case WM_MOUSEMOVE:
-			if (nodinput)
-			{
-				mouse_keys = 0;
-				if (wParam & MK_LBUTTON)
-					mouse_keys |= 1;
-				if (wParam & MK_RBUTTON)
-					mouse_keys |= 2;
-				if (wParam & MK_MBUTTON)
-					mouse_keys |= 4;
-				if (wParam & MK_XBUTTON1)
-					mouse_keys |= 8;
-				if (wParam & MK_XBUTTON2)
-					mouse_keys |= 16;
-				I_GetSysMouseEvents(mouse_keys);
-			}
-			break;
-
-
-		case WM_MOUSEWHEEL:
-			//CONS_Printf("MW_WHEEL dispatched.\n");
-			ev.type = ev_keydown;
-			if ((INT16)HIWORD(wParam) > 0)
-				ev.data1 = KEY_MOUSEWHEELUP;
-			else
-				ev.data1 = KEY_MOUSEWHEELDOWN;
-			D_PostEvent(&ev);
-			break;
-
-		case WM_SETTEXT:
-			COM_BufAddText((LPCSTR)lParam);
-			return TRUE;
-			break;
-
-		case WM_CLOSE:
-			PostQuitMessage(0);         //to quit while in-game
-			ev.data1 = KEY_ESCAPE;      //to exit network synchronization
-			ev.type = ev_keydown;
-			D_PostEvent (&ev);
-			return 0;
-		case WM_DESTROY:
-			//faB: main app loop will exit the loop and proceed with I_Quit()
-			PostQuitMessage(0);
-			break;
-
-		default:
-			break;
-	}
-
-	return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-
-static inline VOID OpenTextConsole(void)
-{
-	HANDLE ci, co;
-	const BOOL tco = M_CheckParm("-console") != 0;
-	dedicated = M_CheckParm("-dedicated") != 0;
-	if (!(dedicated || tco))
-		return;
-	FreeConsole();
-	AllocConsole(); //Let get the real console HANDLE, because Mingw's Bash is bad!
-	ci = CreateFile(TEXT("CONIN$") ,               GENERIC_READ, FILE_SHARE_READ,  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-	co = CreateFile(TEXT("CONOUT$"), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-	if (ci != (HANDLE)-1)
-	{
-		const DWORD CM = ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT;
-		SetStdHandle(STD_INPUT_HANDLE,ci);
-		if(GetFileType(ci) == FILE_TYPE_CHAR)
-			SetConsoleMode(ci,CM); //default mode but no ENABLE_MOUSE_INPUT
-	}
-	if(co != (HANDLE)-1)
-	{
-		SetStdHandle(STD_OUTPUT_HANDLE,co);
-		SetStdHandle(STD_ERROR_HANDLE,co); //maybe logstream?
-	}
-}
-
-//
-// Do that Windows initialization stuff...
-//
-static HWND OpenMainWindow (HINSTANCE hInstance, int nCmdShow, LPSTR wTitle)
-{
-	HWND        hWnd;
-	WNDCLASS    wc;
-
-	// Set up and register window class
-	nCmdShow = 0;
-	wc.style         = CS_HREDRAW | CS_VREDRAW /*| CS_DBLCLKS*/;
-	wc.lpfnWndProc   = MainWndproc;
-	wc.cbClsExtra    = 0;
-	wc.cbWndExtra    = 0;
-	wc.hInstance     = hInstance;
-	wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DLICON1));
-	windowCursor     = LoadCursor(NULL, IDC_WAIT); //LoadCursor(hInstance, MAKEINTRESOURCE(IDC_DLCURSOR1));
-	wc.hCursor       = windowCursor;
-	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
-	wc.lpszMenuName  = NULL;
-	wc.lpszClassName = TEXT("SRB2WC");
-	if (!RegisterClass(&wc))
-		return (HANDLE)-1;
-
-	// Create a window
-	// CreateWindowEx - seems to create just the interior, not the borders
-
-	hWnd = CreateWindowExA(
-#ifdef _DEBUG
-	       0,     //ExStyle
-#else
-	       dedicated ? 0:WS_EX_TOPMOST,     //ExStyle
-#endif
-	       "SRB2WC",                         //Classname
-	       wTitle,                           //Windowname
-	       WS_CAPTION|WS_POPUP|WS_SYSMENU,   //dwStyle       //WS_VISIBLE|WS_POPUP for bAppFullScreen
-	       0,
-	       0,
-	       dedicated ? 0:BASEVIDWIDTH,  //GetSystemMetrics(SM_CXSCREEN),
-	       dedicated ? 0:BASEVIDHEIGHT,  //GetSystemMetrics(SM_CYSCREEN),
-	       NULL,                             //hWnd Parent
-	       NULL,                             //hMenu Menu
-	       hInstance,
-	       NULL);
-
-	return hWnd;
-}
-
-
-static inline BOOL tlErrorMessage(const TCHAR *err)
-{
-	/* make the cursor visible */
-	SetCursor(LoadCursor(NULL, IDC_ARROW));
-
-	//
-	// warn user if there is one
-	//
-	printf("Error %s..\n", err);
-	fflush(stdout);
-
-	MessageBox(hWndMain, err, TEXT("ERROR"), MB_OK);
-	return FALSE;
-}
-
-
-// ------------------
-// Command line stuff
-// ------------------
-#define         MAXCMDLINEARGS          64
-static  char *  myWargv[MAXCMDLINEARGS+1];
-static  char    myCmdline[512];
-
-static VOID     GetArgcArgv (LPSTR cmdline)
-{
-	LPSTR   token;
-	size_t  i = 0, len;
-	char    cSep = ' ';
-	BOOL    bCvar = FALSE, prevCvar = FALSE;
-
-	// split arguments of command line into argv
-	strncpy (myCmdline, cmdline, 511);      // in case window's cmdline is in protected memory..for strtok
-	len = strlen (myCmdline);
-
-	myargc = 0;
-	while (myargc < MAXCMDLINEARGS)
-	{
-		// get token
-		while (myCmdline[i] == cSep)
-			i++;
-		if (i >= len)
-			break;
-		token = myCmdline + i;
-		if (myCmdline[i] == '"')
-		{
-			cSep = '"';
-			i++;
-			if (!prevCvar)    //cvar leave the "" in
-				token++;
-		}
-		else
-			cSep = ' ';
-
-		//cvar
-		if (myCmdline[i] == '+' && cSep == ' ')   //a + begins a cvarname, but not after quotes
-			bCvar = TRUE;
-		else
-			bCvar = FALSE;
-
-		while (myCmdline[i] &&
-				myCmdline[i] != cSep)
-			i++;
-
-		if (myCmdline[i] == '"')
-		{
-			 cSep = ' ';
-			 if (prevCvar)
-				 i++;       // get ending " quote in arg
-		}
-
-		prevCvar = bCvar;
-
-		if (myCmdline + i > token)
-		{
-			myWargv[myargc++] = token;
-		}
-
-		if (!myCmdline[i] || i >= len)
-			break;
-
-		myCmdline[i++] = '\0';
-	}
-	myWargv[myargc] = NULL;
-
-	// m_argv.c uses myargv[], we used myWargv because we fill the arguments ourselves
-	// and myargv is just a pointer, so we set it to point myWargv
-	myargv = myWargv;
-}
-
-
-static inline VOID MakeCodeWritable(VOID)
-{
-#ifdef USEASM
-	// Disable write-protection of code segment
-	DWORD OldRights;
-	BYTE *pBaseOfImage = (BYTE *)GetModuleHandle(NULL);
-	IMAGE_OPTIONAL_HEADER *pHeader = (IMAGE_OPTIONAL_HEADER *)
-		(pBaseOfImage + ((IMAGE_DOS_HEADER*)pBaseOfImage)->e_lfanew +
-		sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER));
-	if (!VirtualProtect(pBaseOfImage+pHeader->BaseOfCode,pHeader->SizeOfCode,PAGE_EXECUTE_READWRITE,&OldRights))
-		I_Error("Could not make code writable\n");
-#endif
-}
-
-
-
-
-// -----------------------------------------------------------------------------
-// HandledWinMain : called by exception handler
-// -----------------------------------------------------------------------------
-static int WINAPI HandledWinMain(HINSTANCE hInstance,
-                                 HINSTANCE hPrevInstance,
-                                 LPSTR lpCmdLine,
-                                 int nCmdShow)
-{
-	int             i;
-	LPSTR          args;
-
-	lpCmdLine = NULL;
-	hPrevInstance = NULL;
-#ifdef LOGMESSAGES
-	// DEBUG!!! - set logstream to NULL to disable debug log
-	logstream = INVALID_HANDLE_VALUE;
-
-	logstream = CreateFile (TEXT("log.txt"), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
-	                        FILE_ATTRIBUTE_NORMAL, NULL);  //file flag writethrough?
-#endif
-
-	// fill myargc,myargv for m_argv.c retrieval of cmdline arguments
-	CONS_Printf("GetArgcArgv() ...\n");
-	args = GetCommandLineA();
-	CONS_Printf("lpCmdLine is '%s'\n", args);
-	GetArgcArgv(args);
-	// Create a text console window
-	OpenTextConsole();
-
-	CONS_Printf("Myargc: %d\n", myargc);
-	for (i = 0; i < myargc; i++)
-		CONS_Printf("myargv[%d] : '%s'\n", i, myargv[i]);
-
-	// store for later use, will we need it ?
-	myInstance = hInstance;
-
-	// open a dummy window, both OpenGL and DirectX need one.
-	if ((hWndMain = OpenMainWindow(hInstance,nCmdShow,
-				va("SRB2 "VERSIONSTRING))) == (HANDLE)-1)
-	{
-		tlErrorMessage(TEXT("Couldn't open window"));
-		return FALSE;
-	}
-
-	// currently starts DirectInput
-	CONS_Printf("I_StartupSystem() ...\n");
-	I_StartupSystem();
-	MakeCodeWritable();
-
-	// startup SRB2
-	CONS_Printf("D_SRB2Main() ...\n");
-	D_SRB2Main();
-	CONS_Printf("Entering main app loop...\n");
-	// never return
-	D_SRB2Loop();
-
-	// back to Windoze
-	return 0;
-}
-
-// -----------------------------------------------------------------------------
-// Exception handler calls WinMain for catching exceptions
-// -----------------------------------------------------------------------------
-int WINAPI WinMain (HINSTANCE hInstance,
-                    HINSTANCE hPrevInstance,
-                    LPSTR     lpCmdLine,
-                    int       nCmdShow)
-{
-	int Result = -1;
-#if 1
-	HMODULE h = GetModuleHandleA("kernel32.dll");
-	MyFunc pfnIsDebuggerPresent = NULL;
-	if (h)
-		pfnIsDebuggerPresent = (MyFunc)GetProcAddress(h,"IsDebuggerPresent");
-	if (!pfnIsDebuggerPresent || !pfnIsDebuggerPresent())
-		LoadLibrary("exchndl.dll");
-#endif
-#ifdef NO_SEH_MINGW
-	__try1(RecordExceptionInfo(GetExceptionInformation()/*, "main thread", lpCmdLine*/))
-#else
-	__try
-#endif
-	{
-		Result = HandledWinMain (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
-	}
-#ifdef NO_SEH_MINGW
-	__except1
-#else
-	__except (RecordExceptionInfo(GetExceptionInformation()/*, "main thread", lpCmdLine*/))
-#endif
-	{
-		SetUnhandledExceptionFilter(EXCEPTION_CONTINUE_SEARCH); //Do nothing here.
-	}
-
-	return Result;
-}
diff --git a/src/win32ce/win_main.h b/src/win32ce/win_main.h
deleted file mode 100644
index fef25327d44b3c7b7cd7bc8f5243223cd82ab9ba..0000000000000000000000000000000000000000
--- a/src/win32ce/win_main.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Win32 Sharing
-
-//#define WIN32_LEAN_AND_MEAN
-#define RPC_NO_WINDOWS_H
-#include <windows.h>
-#include <stdio.h>
-
-extern HINSTANCE myInstance;
-extern HWND hWndMain;
-
-// debugging CONS_Printf to file
-#ifdef LOGMESSAGES
-extern HANDLE logstream;
-#endif
-extern int appActive;
-
-// the MIDI callback is another thread, and Midi volume is delayed here in window proc
-VOID I_SetMidiChannelVolume(DWORD dwChannel, DWORD dwVolumePercent);
-extern DWORD dwVolumePercent;
-
-VOID I_GetSysMouseEvents(int mouse_state);
-extern unsigned int MSHWheelMessage;
-
-extern BOOL nodinput;
-extern BOOL win9x;
-
-//faB: midi channel Volume set is delayed by the MIDI stream callback thread, see win_snd.c
-#define WM_MSTREAM_UPDATEVOLUME (WM_USER + 101)
-
-// defined in win_sys.c
-VOID I_BeginProfile(VOID); //for timing code
-DWORD I_EndProfile(VOID);
-
-VOID I_GetLastErrorMsgBox(VOID);
-VOID I_LoadingScreen (LPCSTR msg);
-
-void I_RestartSysMouse(void);
-void I_DoStartupMouse(void);
-BOOL I_SaveMemToFile(const void *pData, size_t iLength, const char *sFileName);
diff --git a/src/win32ce/win_net.c b/src/win32ce/win_net.c
deleted file mode 100644
index dac1bed53cd29ebb68134076a57b4ad90989d103..0000000000000000000000000000000000000000
--- a/src/win32ce/win_net.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief Win32 network interface
-
-#include "../doomdef.h"
-#include "../m_argv.h"
-#include "../i_net.h"
-
-//
-// NETWORKING
-//
-
-//
-// I_InitNetwork
-//
-boolean I_InitNetwork (void)
-{
-	if (M_CheckParm ("-net"))
-	{
-		I_Error("The Win32 version of SRB2 doesn't work with external drivers like ipxsetup, sersetup, or doomatic\n"
-		        "Read the documentation about \"-server\" and \"-connect\" parameters or just use the launcher\n");
-	}
-
-	return false;
-}
diff --git a/src/win32ce/win_snd.c b/src/win32ce/win_snd.c
deleted file mode 100644
index f9c6521786717c45fabd620a54a500295e82a708..0000000000000000000000000000000000000000
--- a/src/win32ce/win_snd.c
+++ /dev/null
@@ -1,2406 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief interface level code for sound
-///
-///	Uses the midiStream* Win32 functions to play MIDI data
-///	with low latency and low processor overhead.
-#include "../doomdef.h"
-
-#include "win_main.h"
-#include <mmsystem.h>
-#define DIRECTSOUND_VERSION     0x0600       /* version 6.0 */
-#define DIRECTINPUT_VERSION     0x0700
-#define DXVERSION_NTCOMPATIBLE  0x0300
-#ifdef _MSC_VER
-#pragma warning(disable :  4201)
-#endif
-#include <dsound.h>
-
-#include "../command.h"
-#include "../i_sound.h"
-#include "../s_sound.h"
-#include "../i_system.h"
-#include "../m_argv.h"
-#include "../w_wad.h"
-#include "../z_zone.h"
-#include "../doomstat.h"
-
-#include "dx_error.h"
-
-#include "mid2strm.h"
-
-#ifdef HW3SOUND
-#include "../hardware/hw3dsdrv.h"
-#include "../hardware/hw3sound.h"
-#include "win_dll.h"
-#endif
-
-#ifndef SURROUND
-#define SURROUND // comment out this to disable the SurroundSound code
-#endif
-
-#ifdef SURROUND
-ATTRNOINLINE static FUNCNOINLINE void CopyAndInvertMemory(void *dest, void *src, int bytes); //Can't inline ASM that haves lables
-#endif
-
-#define FMODSOUND // comment out this to disable MOD/IT/MP3/OGG music playback
-
-///////////////////////////////////////////////////////////
-#ifdef FMODSOUND
-#ifdef __MINGW32__
-#include <FMOD/fmod.h>
-#else
-#include <fmod.h>
-#endif
-#ifdef FSOUND_INIT_DONTLATENCYADJUST //Alam: why didn't I think about this before? :)
-#define FSOUND_Stream_OpenFile(name,mode,length) FSOUND_Stream_Open(name,mode,0,length)
-#else
-#define FSOUND_INIT_DONTLATENCYADJUST 0
-#endif
-#ifdef __MINGW32__
-#include <FMOD/fmod_errors.h>
-#else
-#include <fmod_errors.h>	/* optional */
-#endif
-//#include <conio.h>
-#endif
-/////////////////////////////////////////////////////////
-
-//#define TESTCODE            // remove this for release version
-
-/* briefly described here for convenience:
-typedef struct {
-	WORD  wFormatTag;       // WAVE_FORMAT_PCM is the only format accepted for DirectSound:
-							// this tag indicates Pulse Code Modulation (PCM), an uncompressed format
-							// in which each samples represents the amplitude of the signal at the time
-							// of sampling.
-	WORD  nChannels;        // either one (mono) or two (stereo)
-	DWORD nSamplesPerSec;   // the sampling rate, or frequency, in hertz.
-							//  Typical values are 11,025, 22,050, and 44,100
-	DWORD nAvgBytesPerSec;  // nAvgBytesPerSec is the product of nBlockAlign and nSamplesPerSec
-	WORD  nBlockAlign;      // the number of bytes required for each complete sample, for PCM formats
-							// is equal to (wBitsPerSample * nChannels / 8).
-	WORD  wBitsPerSample;   // gives the size of each sample, generally 8 or 16 bits
-	WORD  cbSize;           // cbSize gives the size of any extra fields required to describe a
-							// specialized wave format. This member is always zero for PCM formats.
-} WAVEFORMATEX;
-*/
-
-// Tails 11-21-2002
-#ifdef FMODSOUND
-static FMUSIC_MODULE  *mod = NULL;
-static int fsoundchannel = -1;
-static int fsoundfreq = 0;
-static int fmodvol = 127;
-static FSOUND_STREAM *fmus = NULL;
-#endif
-
-// --------------------------------------------------------------------------
-// DirectSound stuff
-// --------------------------------------------------------------------------
-static LPDIRECTSOUND           DSnd = NULL;
-static LPDIRECTSOUNDBUFFER     DSndPrimary = NULL; ;
-
-// Stack sounds means sounds put on top of each other, since DirectSound can't play
-// the same sound buffer at different locations at the same time, we need to dupli-
-// cate existing buffers to play multiple instances of the same sound in the same
-// time frame. A duplicate sound is freed when it is no more used. The priority that
-// comes from the s_sound engine, is kept so that the lowest priority sounds are
-// stopped to make place for the new sound, unless the new sound has a lower priority
-// than all playing sounds, in which case the sound is not started.
-#define MAXSTACKSOUNDS      32          // this is the absolute number of sounds that
-                                        // can play simultaneously, whatever the value
-                                        // of cv_numChannels
-typedef struct {
-	LPDIRECTSOUNDBUFFER lpSndBuf;
-#ifdef SURROUND
-		// judgecutor:
-		// Need for produce surround sound
-	LPDIRECTSOUNDBUFFER lpSurround;
-#endif
-	int                 priority;
-	boolean             duplicate;
-} StackSound_t;
-static StackSound_t    StackSounds[MAXSTACKSOUNDS];
-
-// --------------------------------------------------------------------------
-// Fill the DirectSoundBuffer with data from a sample, made separate so that
-// sound data cna be reloaded if a sound buffer was lost.
-// --------------------------------------------------------------------------
-static boolean CopySoundData (LPDIRECTSOUNDBUFFER dsbuffer, LPBYTE data, DWORD length)
-{
-	LPVOID  lpvAudio1;              // receives address of lock start
-	DWORD   dwBytes1;               // receives number of bytes locked
-	LPVOID  lpvAudio2;              // receives address of lock start
-	DWORD   dwBytes2;               // receives number of bytes locked
-	HRESULT hr;
-
-	// Obtain memory address of write block.
-	hr = IDirectSoundBuffer_Lock (dsbuffer, 0, length, &lpvAudio1, &dwBytes1, &lpvAudio2, &dwBytes2, 0);
-
-	// If DSERR_BUFFERLOST is returned, restore and retry lock.
-	if (hr == DSERR_BUFFERLOST)
-	{
-		hr = IDirectSoundBuffer_Restore (dsbuffer);
-		if (FAILED (hr))
-			I_Error("Restore fail on %x, %s\n",dsbuffer,DXErrorToString(hr));
-		hr = IDirectSoundBuffer_Lock (dsbuffer, 0, length, &lpvAudio1, &dwBytes1, &lpvAudio2, &dwBytes2, 0);
-		if (FAILED (hr))
-			I_Error("Lock fail(2) on %x, %s\n",dsbuffer,DXErrorToString(hr));
-	}
-	else
-		if (FAILED (hr))
-			I_Error("Lock fail(1) on %x, %s\n",dsbuffer,DXErrorToString(hr));
-
-	// copy wave data into the buffer (note: dwBytes1 should equal to dsbdesc->dwBufferBytes ...)
-	CopyMemory (lpvAudio1, data, dwBytes1);
-
-	if (dwBytes2 && lpvAudio2)
-		CopyMemory(lpvAudio2, data+dwBytes1, dwBytes2);
-
-	// finally, unlock the buffer
-	hr = IDirectSoundBuffer_Unlock (dsbuffer, lpvAudio1, dwBytes1, lpvAudio2, dwBytes2);
-
-	if (FAILED (hr))
-		I_Error("Unlock fail on %x, %s\n",dsbuffer,DXErrorToString(hr));
-
-	return true;
-}
-
-#ifdef SURROUND
-// judgecutor:
-// Hmmm... May be this function is not too good...
-static void CopyAndInvertMemory(void *dest, void *src, int bytes)
-{
-#ifdef __GNUC__
-	__asm__("CAIM:;lodsb;neg %%al;stosb;loop CAIM;"::"c"(bytes),"D"(dest),"S"(src): "memory","cc");
-#else
-	_asm
-	{
-		push esi
-		push edi
-		push ecx
-		mov ecx,bytes
-		mov esi,src
-		mov edi,dest
-a:
-		lodsb
-		neg  al
-		stosb
-		loop a
-		pop ecx
-		pop edi
-		pop esi
-	}
-#endif
-}
-
-// judgecutor:
-// Like normal CopySoundData but sound data will be inverted
-static boolean CopyAndInvertSoundData(LPDIRECTSOUNDBUFFER dsbuffer, LPBYTE data, DWORD length)
-{
-	LPVOID  lpvAudio1 = NULL; // receives address of lock start
-	DWORD   dwBytes1 = 0;     // receives number of bytes locked
-	LPVOID  lpvAudio2 = NULL;
-	DWORD   dwBytes2 = 0;
-	HRESULT hr;
-
-	// Obtain memory address of write block.
-	hr = IDirectSoundBuffer_Lock (dsbuffer, 0, length, &lpvAudio1, &dwBytes1, &lpvAudio2, &dwBytes2, 0);
-
-	// If DSERR_BUFFERLOST is returned, restore and retry lock.
-	if (hr == DSERR_BUFFERLOST)
-	{
-		hr = IDirectSoundBuffer_Restore (dsbuffer);
-		if (FAILED (hr))
-			I_Error("CopyAndInvert: Restore fail on %x, %s\n",dsbuffer,DXErrorToString(hr));
-		hr = IDirectSoundBuffer_Lock (dsbuffer, 0, length, &lpvAudio1, &dwBytes1, &lpvAudio2, &dwBytes2, 0);
-		if (FAILED (hr))
-			I_Error("CopyAndInvert: Lock fail(2) on %x, %s\n",dsbuffer,DXErrorToString(hr));
-	} else if (FAILED (hr))
-			  I_Error("CopyAndInvetrt: Lock fail(1) on %x, %s\n",dsbuffer,DXErrorToString(hr));
-
-	// copy wave data into the buffer (note: dwBytes1 should equal to dsbdesc->dwBufferBytes ...)
-	CopyAndInvertMemory (lpvAudio1, data, dwBytes1);
-
-	if (dwBytes2 && lpvAudio2)
-		CopyAndInvertMemory(lpvAudio2, data+dwBytes1, dwBytes2);
-
-	hr = IDirectSoundBuffer_Unlock (dsbuffer, lpvAudio1, dwBytes1, lpvAudio2, dwBytes2);
-	if (FAILED (hr))
-		I_Error("CopyAndInvert: Unlock fail on %x, %s\n",dsbuffer,DXErrorToString(hr));
-
-	return false;
-}
-#endif
-
-static DWORD sound_buffer_flags = DSBCAPS_CTRLPAN |
-                                  DSBCAPS_CTRLVOLUME |
-                                  DSBCAPS_STICKYFOCUS |
-                                //DSBCAPS_LOCSOFTWARE |
-                                  DSBCAPS_STATIC;
-
-// --------------------------------------------------------------------------
-// raw2DS : convert a raw sound data, returns a LPDIRECTSOUNDBUFFER
-// --------------------------------------------------------------------------
-//   dsdata points a 4 UINT16 header:
-//    +0 : value 3 what does it mean?
-//    +2 : sample rate, either 11025 or 22050.
-//    +4 : number of samples, each sample is a single byte since it's 8bit
-//    +6 : value 0
-//
-#ifdef SURROUND
-// judgecutor:
-// We need an another function definition for supporting the surround sound
-// Invert just cause to copy an inverted sound data
-static LPDIRECTSOUNDBUFFER raw2DS(LPBYTE *dsdata, size_t len, UINT8 invert)
-#else
-static LPDIRECTSOUNDBUFFER raw2DS(LPBYTE *dsdata, size_t len)
-#endif
-{
-	HRESULT             hr;
-	WAVEFORMATEX        wfm;
-	DSBUFFERDESC        dsbdesc;
-	LPDIRECTSOUNDBUFFER dsbuffer;
-
-	// initialise WAVEFORMATEX structure describing the wave format
-	ZeroMemory (&wfm, sizeof (WAVEFORMATEX));
-	wfm.wFormatTag = WAVE_FORMAT_PCM;
-	wfm.nChannels = 1;
-	wfm.nSamplesPerSec = (dsdata[3]<<8)+dsdata[2];      //mostly 11025, but some at 22050.
-	wfm.wBitsPerSample = 8;
-	wfm.nBlockAlign = (WORD)(wfm.wBitsPerSample / 8 * wfm.nChannels);
-	wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;
-
-	// Set up DSBUFFERDESC structure.
-	ZeroMemory (&dsbdesc, sizeof (DSBUFFERDESC));
-	dsbdesc.dwSize = sizeof (DSBUFFERDESC);
-/*    dsbdesc.dwFlags = DSBCAPS_CTRLPAN |
-					  DSBCAPS_CTRLVOLUME |
-					  DSBCAPS_STICKYFOCUS |
-					  //DSBCAPS_LOCSOFTWARE |
-					  DSBCAPS_STATIC
-					  | DSBCAPS_CTRLFREQUENCY;    // This one for pitching
-*/
-	dsbdesc.dwFlags = sound_buffer_flags;
-	dsbdesc.dwBufferBytes = len-8;
-	dsbdesc.lpwfxFormat = &wfm; // pointer to WAVEFORMATEX structure
-
-	// Create the sound buffer
-	hr = IDirectSound_CreateSoundBuffer (DSnd, &dsbdesc, &dsbuffer, NULL);
-
-	if (hr == DSERR_CONTROLUNAVAIL)
-	{
-		CONS_Printf("\tSoundBufferCreate error - a buffer control is not available.\n\tTrying to disable frequency control.\n");
-
-		sound_buffer_flags &= ~DSBCAPS_CTRLFREQUENCY;
-		dsbdesc.dwFlags = sound_buffer_flags;
-
-		hr = IDirectSound_CreateSoundBuffer (DSnd, &dsbdesc, &dsbuffer, NULL);
-	}
-
-	if (FAILED(hr))
-		I_Error("CreateSoundBuffer() FAILED: %s\n", DXErrorToString(hr));
-
-#ifdef SURROUND
-	if (invert)
-		// just invert a sound data for producing the surround sound
-		CopyAndInvertSoundData(dsbuffer, (LPBYTE)dsdata + 8, dsbdesc.dwBufferBytes);
-	else
-		// Do a normal operation
-#endif
-	// fill the DirectSoundBuffer waveform data
-	CopySoundData (dsbuffer, (LPBYTE)dsdata + 8, dsbdesc.dwBufferBytes);
-
-	return dsbuffer;
-}
-
-
-// --------------------------------------------------------------------------
-// This function loads the sound data from the WAD lump, for single sound.
-// --------------------------------------------------------------------------
-void *I_GetSfx (sfxinfo_t * sfx)
-{
-	LPBYTE dssfx;
-
-	if (sfx->lumpnum < 0)
-		sfx->lumpnum = S_GetSfxLumpNum (sfx);
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-		return HW3S_GetSfx(sfx);
-#endif
-
-	sfx->length = W_LumpLength (sfx->lumpnum);
-
-	// PU_CACHE because the data is copied to the DIRECTSOUNDBUFFER, the one here will not be used
-	dssfx = (LPBYTE) W_CacheLumpNum (sfx->lumpnum, PU_CACHE);
-
-#ifdef SURROUND
-	// Make a normal (not inverted) sound buffer
-	return (void *)raw2DS (dssfx, sfx->length, FALSE);
-#else
-	// return the LPDIRECTSOUNDBUFFER, which will be stored in S_sfx[].data
-	return (void *)raw2DS (dssfx, sfx->length);
-#endif
-}
-
-
-// --------------------------------------------------------------------------
-// Free all allocated resources for a single sound
-// --------------------------------------------------------------------------
-void I_FreeSfx (sfxinfo_t *sfx)
-{
-	LPDIRECTSOUNDBUFFER dsbuffer;
-
-	if (sfx->lumpnum < 0)
-		return;
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-	{
-		HW3S_FreeSfx(sfx);
-	}
-	else
-#endif
-	{
-		//CONS_Printf("I_FreeSfx(%d)\n", sfx->lumpnum);
-
-		// free DIRECTSOUNDBUFFER
-		dsbuffer = (LPDIRECTSOUNDBUFFER) sfx->data;
-		if (dsbuffer)
-		{
-			size_t i;
-			for (i = 0; i < MAXSTACKSOUNDS; i++)
-			{
-				if (StackSounds[i].lpSndBuf == dsbuffer)
-				{
-					StackSounds[i].lpSndBuf = NULL;
-#ifdef SURROUND
-					if (StackSounds[i].lpSurround)
-					{
-						IDirectSoundBuffer_Stop(StackSounds[i].lpSurround);
-						IDirectSoundBuffer_Release(StackSounds[i].lpSurround);
-					}
-					StackSounds[i].lpSurround = NULL;
-#endif
-				}
-			}
-			IDirectSoundBuffer_Stop (dsbuffer);
-			IDirectSoundBuffer_Release (dsbuffer);
-		}
-	}
-	sfx->data = NULL;
-	sfx->lumpnum = -1;
-}
-
-
-// --------------------------------------------------------------------------
-// Set the global volume for sound effects
-// --------------------------------------------------------------------------
-void I_SetSfxVolume(INT32 volume)
-{
-	int     vol;
-	HRESULT hr;
-
-	if (nosound || !sound_started)
-		return;
-
-	// use the last quarter of volume range
-	if (volume)
-		vol = (volume * ((DSBVOLUME_MAX-DSBVOLUME_MIN)/4)) / 31 +
-		      (DSBVOLUME_MAX - ((DSBVOLUME_MAX-DSBVOLUME_MIN)/4));
-	else
-		vol = DSBVOLUME_MIN;    // make sure 0 is silence
-	//CONS_Printf("setvolume to %d\n", vol);
-	hr = IDirectSoundBuffer_SetVolume (DSndPrimary, vol);
-	//if (FAILED(hr))
-	//    CONS_Printf("setvolumne failed\n");
-}
-
-
-// --------------------------------------------------------------------------
-// Update the volume for a secondary buffer, make sure it was created with
-// DSBCAPS_CTRLVOLUME
-// --------------------------------------------------------------------------
-static void I_UpdateSoundVolume (LPDIRECTSOUNDBUFFER lpSnd, int volume)
-{
-	HRESULT hr;
-	volume = (volume * ((DSBVOLUME_MAX-DSBVOLUME_MIN)/4)) / 256 +
-	         (DSBVOLUME_MAX - ((DSBVOLUME_MAX-DSBVOLUME_MIN)/4));
-	hr = IDirectSoundBuffer_SetVolume (lpSnd, volume);
-	//if (FAILED(hr))
-	//    CONS_Printf("\2SetVolume FAILED\n");
-}
-
-
-// --------------------------------------------------------------------------
-// Update the panning for a secondary buffer, make sure it was created with
-// DSBCAPS_CTRLPAN
-// --------------------------------------------------------------------------
-#define DSBPAN_RANGE    (DSBPAN_RIGHT-(DSBPAN_LEFT))
-#define SEP_RANGE       256     //Doom sounds pan range 0-255 (128 is centre)
-static void I_UpdateSoundPanning (LPDIRECTSOUNDBUFFER lpSnd, int sep)
-{
-	HRESULT hr;
-	hr = IDirectSoundBuffer_SetPan (lpSnd, (sep * DSBPAN_RANGE)/SEP_RANGE - DSBPAN_RIGHT);
-	//if (FAILED(hr))
-	//    CONS_Printf("SetPan FAILED for sep %d pan %d\n", sep, (sep * DSBPAN_RANGE)/SEP_RANGE - DSBPAN_RIGHT);
-}
-
-// search a free slot in the stack, free it if needed
-static int GetFreeStackNum(int  newpriority)
-{
-	int  lowestpri = 256,lowestprihandle = 0;
-	int  i;
-	// DirectSound can't play multiple instances of the same sound buffer
-	// unless they are duplicated, so if the sound buffer is in use, make a duplicate
-	for (i = 0; i < MAXSTACKSOUNDS; i++)
-	{
-		// find a free 'playing sound slot' to use
-		if (StackSounds[i].lpSndBuf == NULL)
-		{
-			//CONS_Printf("\t\tfound free slot %d\n", i);
-			return i;
-		}
-		else if (!I_SoundIsPlaying(i)) // check for sounds that finished playing, and can be freed
-		{
-			//CONS_Printf("\t\tfinished sound in slot %d\n", i);
-			//stop sound and free the 'slot'
-			I_StopSound (i);
-			// we can use this one since it's now freed
-			return i;
-		}
-		else if (StackSounds[i].priority < lowestpri) //remember lowest priority sound
-		{
-			lowestpri = StackSounds[i].priority;
-			lowestprihandle = i;
-		}
-	}
-
-	// the maximum of sounds playing at the same time is reached, if we have at least
-	// one sound playing with a lower priority, stop it and replace it with the new one
-
-	//CONS_Printf("\t\tall slots occupied..\n");
-	if (newpriority >= lowestpri)
-	{
-		I_StopSound (lowestprihandle);
-		return lowestprihandle;
-		//CONS_Printf(" kicking out lowest priority slot: %d pri: %d, my priority: %d\n",
-		//             handle, lowestpri, priority);
-	}
-
-	return -1;
-}
-
-#ifdef SURROUND
-static LPDIRECTSOUNDBUFFER CreateInvertedSound(int id)
-{
-	lumpnnum_t lumpnum;
-	LBYPTE dsdata;
-
-	lumpnum = S_sfx[id].lumpnum;
-	if (lumpnum < 0)
-		lumpnum = S_GetSfxLumpNum (&S_sfx[id]);
-	dsdata = W_CacheLumpNum (lumpnum, PU_CACHE);
-	return raw2DS(dsdata, S_sfx[id].length, TRUE);
-}
-#endif
-
-// Calculate internal pitch from Doom pitch
-#if 0
-static float recalc_pitch(int doom_pitch)
-{
-	return doom_pitch < NORMAL_PITCH ?
-	       (float)(doom_pitch + NORMAL_PITCH) / (NORMAL_PITCH * 2)
-	       :(float)doom_pitch / (float)NORMAL_PITCH;
-}
-#endif
-
-// --------------------------------------------------------------------------
-// Start the given S_sfx[id] sound with given properties (panning, volume..)
-// --------------------------------------------------------------------------
-INT32 I_StartSound (sfxenum_t      id,
-                  INT32          vol,
-                  INT32          sep,
-                  INT32          pitch,
-                  INT32          priority)
-{
-	HRESULT     hr;
-	LPDIRECTSOUNDBUFFER     dsbuffer;
-	DWORD       dwStatus;
-	int         handle;
-	int         i;
-	//DWORD       freq;
-#ifdef SURROUND
-	LPDIRECTSOUNDBUFFER     dssurround;
-#endif
-
-	if (nosound)
-		return -1;
-
-	//CONS_Printf("I_StartSound:\n\t\tS_sfx[%d]\n", id);
-	handle = GetFreeStackNum(priority);
-	if (handle < 0)
-		return -1;
-
-	//CONS_Printf("\t\tusing handle %d\n", handle);
-
-	// if the original buffer is playing, duplicate it (DirectSound specific)
-	// else, use the original buffer
-	dsbuffer = (LPDIRECTSOUNDBUFFER) S_sfx[id].data;
-	IDirectSoundBuffer_GetStatus (dsbuffer, &dwStatus);
-	if (dwStatus & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING))
-	{
-		//CONS_Printf("\t\toriginal sound S_sfx[%d] is playing, duplicating.. ", id);
-		hr = IDirectSound_DuplicateSoundBuffer(DSnd,  (LPDIRECTSOUNDBUFFER) S_sfx[id].data, &dsbuffer);
-		if (FAILED(hr))
-		{
-			//CONS_Printf("Cound't duplicate sound buffer\n");
-			// re-use the original then..
-			dsbuffer = (LPDIRECTSOUNDBUFFER) S_sfx[id].data;
-			// clean up stacksounds info
-			for (i = 0; i < MAXSTACKSOUNDS; i++)
-				if (handle != i &&
-					StackSounds[i].lpSndBuf == dsbuffer)
-				{
-					StackSounds[i].lpSndBuf = NULL;
-				}
-		}
-		// stop the duplicate or the re-used original
-		IDirectSoundBuffer_Stop (dsbuffer);
-	}
-
-	//judgecutor: Sound pitching
-#if 0
-	if (cv_rndsoundpitch.value)
-	{
-		// At first reset the buffer back to original frequency
-		hr = IDirectSoundBuffer_SetFrequency(dsbuffer, DSBFREQUENCY_ORIGINAL);
-		if (SUCCEEDED (hr))
-		{
-
-			IDirectSoundBuffer_GetFrequency(dsbuffer, &freq);
-
-			// Now pitch it
-			freq *= recalc_pitch(pitch);
-			IDirectSoundBuffer_SetFrequency(dsbuffer, freq);
-		}
-		else
-			cv_rndsoundpitch = 0;
-	}
-#else
-	pitch = 0;
-#endif
-	// store information on the playing sound
-	StackSounds[handle].lpSndBuf = dsbuffer;
-	StackSounds[handle].priority = priority;
-	StackSounds[handle].duplicate = (dsbuffer != (LPDIRECTSOUNDBUFFER)S_sfx[id].data);
-
-	//CONS_Printf("StackSounds[%d].lpSndBuf is %s\n", handle, StackSounds[handle].lpSndBuf == NULL ? "Null":"valid");
-	//CONS_Printf("StackSounds[%d].priority is %d\n", handle, StackSounds[handle].priority);
-	//CONS_Printf("StackSounds[%d].duplicate is %s\n", handle, StackSounds[handle].duplicate ? "TRUE":"FALSE");
-
-	I_UpdateSoundVolume (dsbuffer, vol);
-
-#ifdef SURROUND
-		// Prepare the surround sound buffer
-	// Use a normal sound data for the left channel (with pan == 0)
-	// and an inverted sound data for the right channel (with pan == 255)
-
-	dssurround = CreateInvertedSound(id);
-
-	// Surround must be pitched too
-#if 0
-	if (cv_rndsoundpitch.value)
-		IDirectSoundBuffer_SetFrequency(dssurround, freq);
-#endif
-	if (sep == -128)
-	{
-		I_UpdateSoundPanning(dssurround, 255);
-		I_UpdateSoundVolume(dssurround, vol);
-		I_UpdateSoundPanning(dsbuffer, 0);
-		IDirectSoundBuffer_SetCurrentPosition(dssurround, 0);
-	}
-		else
-	// Perform normal operation
-#endif
-
-	I_UpdateSoundPanning (dsbuffer, sep);
-
-	IDirectSoundBuffer_SetCurrentPosition (dsbuffer, 0);
-
-	hr = IDirectSoundBuffer_Play (dsbuffer, 0, 0, 0);
-	if (hr == DSERR_BUFFERLOST)
-	{
-		//CONS_Printf("buffer lost\n");
-		// restores the buffer memory and all other settings for the buffer
-		hr = IDirectSoundBuffer_Restore (dsbuffer);
-		if (SUCCEEDED (hr))
-		{
-			LPBYTE dsdata;
-			// reload sample data here
-			int     lumpnum = S_sfx[id].lumpnum;
-			if (lumpnum < 0)
-				lumpnum = S_GetSfxLumpNum (&S_sfx[id]);
-			dsdata = W_CacheLumpNum (lumpnum, PU_CACHE);
-
-			// Well... Data lenght must be -8!!!
-			CopySoundData (dsbuffer, dsdata + 8, S_sfx[id].length - 8);
-
-			// play
-			hr = IDirectSoundBuffer_Play (dsbuffer, 0, 0, 0);
-		}
-		else
-			I_Error("I_StartSound : ->Restore FAILED, %s",DXErrorToString(hr));
-	}
-
-#ifdef SURROUND
-	if (sep == -128)
-	{
-		hr = IDirectSoundBuffer_Play (dssurround, 0, 0, 0);
-		//CONS_Printf("Surround playback\n");
-		if (hr == DSERR_BUFFERLOST)
-		{
-			// restores the buffer memory and all other settings for the surround buffer
-			hr = IDirectSoundBuffer_Restore (dssurround);
-			if (SUCCEEDED (hr))
-			{
-				LPBYTE dsdata;
-				lumpnumt_t lumpnum = S_sfx[id].lumpnum;
-
-				if (lumpnum < 0)
-					lumpnum = S_GetSfxLumpNum (&S_sfx[id]);
-				dsdata = W_CacheLumpNum (lumpnum, PU_CACHE);
-				CopyAndInvertSoundData (dssurround, (LPBYTE)dsdata + 8, S_sfx[id].length - 8);
-
-				hr = IDirectSoundBuffer_Play (dssurround, 0, 0, 0);
-			}
-			else
-				I_Error("I_StartSound : ->Restore FAILED, %s",DXErrorToString(hr));
-		}
-	}
-	StackSounds[handle].lpSurround = dssurround;
-#endif
-
-	// Returns a handle
-	return handle;
-}
-
-
-// --------------------------------------------------------------------------
-// Stop a sound if it is playing,
-// free the corresponding 'playing sound slot' in StackSounds[]
-// --------------------------------------------------------------------------
-void I_StopSound (INT32 handle)
-{
-	LPDIRECTSOUNDBUFFER dsbuffer;
-	HRESULT hr;
-
-	if (nosound || handle < 0)
-		return;
-
-	//CONS_Printf("I_StopSound (%d)\n", handle);
-
-	dsbuffer = StackSounds[handle].lpSndBuf;
-	hr = IDirectSoundBuffer_Stop (dsbuffer);
-
-	// free duplicates of original sound buffer (DirectSound hassles)
-	if (StackSounds[handle].duplicate)
-	{
-		//CONS_Printf("\t\trelease a duplicate..\n");
-		IDirectSoundBuffer_Release (dsbuffer);
-	}
-
-#ifdef SURROUND
-	// Stop and release the surround sound buffer
-	dsbuffer = StackSounds[handle].lpSurround;
-	if (dsbuffer != NULL)
-	{
-		IDirectSoundBuffer_Stop(dsbuffer);
-		IDirectSoundBuffer_Release(dsbuffer);
-	}
-	StackSounds[handle].lpSurround = NULL;
-#endif
-
-	StackSounds[handle].lpSndBuf = NULL;
-}
-
-
-// --------------------------------------------------------------------------
-// Returns whether the sound is currently playing or not
-// --------------------------------------------------------------------------
-INT32 I_SoundIsPlaying(INT32 handle)
-{
-	LPDIRECTSOUNDBUFFER dsbuffer;
-	DWORD   dwStatus;
-
-	if (nosound || handle == -1)
-		return FALSE;
-
-	dsbuffer = StackSounds[handle].lpSndBuf;
-	if (dsbuffer)
-	{
-		IDirectSoundBuffer_GetStatus (dsbuffer, &dwStatus);
-		if (dwStatus & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING))
-			return TRUE;
-	}
-
-	return FALSE;
-}
-
-
-// --------------------------------------------------------------------------
-// Update properties of a sound currently playing
-// --------------------------------------------------------------------------
-void I_UpdateSoundParams(INT32    handle,
-                         INT32    vol,
-                         INT32    sep,
-                         INT32    pitch)
-{
-	LPDIRECTSOUNDBUFFER dsbuffer;
-#ifdef SURROUND
-	LPDIRECTSOUNDBUFFER dssurround;
-	DWORD               dwStatus;
-	DWORD               pos;
-	boolean             surround_inuse = FALSE;
-#endif
-
-	if (nosound)
-		return;
-
-	pitch = 0; /// \todo pitch setup
-	dsbuffer = StackSounds[handle].lpSndBuf;
-
-#ifdef SURROUND
-	if (dsbuffer == NULL)
-		return;
-
-	dssurround = StackSounds[handle].lpSurround;
-	if (dssurround)
-	{
-		IDirectSoundBuffer_GetStatus(dssurround, &dwStatus);
-		surround_inuse = (dwStatus & (DSBSTATUS_PLAYING | DSBSTATUS_LOOPING));
-	}
-		// If pan changed to stereo...
-	if (sep != -128)
-	{
-		if (surround_inuse)
-		{
-			IDirectSoundBuffer_Stop(dssurround);
-			surround_inuse = FALSE;
-		}
-	}
-	else  if (!surround_inuse) // Just update volumes and start the surround if need
-	{
-		I_UpdateSoundVolume(dssurround, vol);
-		I_UpdateSoundPanning(dsbuffer, 0);
-		IDirectSoundBuffer_GetCurrentPosition(dsbuffer, &pos, NULL);
-		IDirectSoundBuffer_SetCurrentPosition(dssurround, pos);
-		IDirectSoundBuffer_Play(dssurround, 0, 0, 0);
-		surround_inuse = TRUE;
-	}
-	else
-		I_UpdateSoundVolume(dssurround, vol);
-	I_UpdateSoundVolume(dsbuffer, vol);
-
-	if (!surround_inuse)
-		I_UpdateSoundPanning(dsbuffer, sep);
-#else
-	if (dsbuffer)
-	{
-		I_UpdateSoundVolume (dsbuffer, vol);
-		I_UpdateSoundPanning (dsbuffer, sep);
-	}
-#endif
-}
-
-
-//
-// Shutdown DirectSound
-//
-void I_ShutdownSound(void)
-{
-	int i;
-
-	CONS_Printf("I_ShutdownSound()\n");
-
-#ifdef HW3SOUND
-	if (hws_mode != HWS_DEFAULT_MODE)
-	{
-		HW3S_Shutdown();
-		Shutdown3DSDriver();
-		return;
-	}
-#endif
-	// release any temporary 'duplicated' secondary buffers
-	for (i = 0; i < MAXSTACKSOUNDS; i++)
-		if (StackSounds[i].lpSndBuf)
-			// stops the sound and release it if it is a duplicate
-			I_StopSound (i);
-
-	if (DSnd)
-	{
-		IDirectSound_Release(DSnd);
-		DSnd = NULL;
-	}
-}
-
-
-// ==========================================================================
-// Startup DirectSound
-// ==========================================================================
-void I_StartupSound(void)
-{
-	HRESULT             hr;
-	LPDIRECTSOUNDBUFFER lpDsb;
-	DSBUFFERDESC        dsbdesc;
-	WAVEFORMATEX        wfm;
-	int                 cooplevel;
-	int                 frequency;
-
-#ifdef HW3SOUND
-	const char         *sdrv_name = NULL;
-	snddev_t            snddev;
-#endif
-
-	sound_started = false;
-
-	if (dedicated)
-		return;
-
-	if (nosound)
-		return;
-
-	// Secure and configure sound device first.
-	CONS_Printf("I_StartupSound: ");
-
-	// frequency of primary buffer may be set at cmd-line
-	if (M_CheckParm ("-freq") && M_IsNextParm())
-	{
-		frequency = atoi(M_GetNextParm());
-		CONS_Printf(" requested frequency of %d hz\n", frequency);
-		CV_SetValue(&cv_samplerate,frequency);
-	}
-	else
-		frequency = cv_samplerate.value;
-
-	// Set cooperative level
-	// Cooperative sound with other applications can be requested at cmd-line
-	if (M_CheckParm("-coopsound"))
-		cooplevel = DSSCL_PRIORITY;
-	else
-		cooplevel = DSSCL_EXCLUSIVE;
-
-#ifdef HW3SOUND
-	if (M_CheckParm("-ds3d"))
-	{
-		hws_mode = HWS_DS3D;
-		sdrv_name = "s_ds3d.dll";
-	}
-#if 1
-	else if (M_CheckParm("-fmod3d"))
-	{
-		hws_mode = HWS_FMOD3D;
-		sdrv_name = "s_fmod.dll";
-	}
-	else if (M_CheckParm("-sounddriver") &&  M_IsNextParm())
-	{
-		hws_mode = HWS_OTHER;
-		sdrv_name = M_GetNextParm();
-	}
-#else
-	else if (M_CheckParm("-sounddriver") &&  M_IsNextParm())
-	{
-		hws_mode = HWS_OTHER;
-		sdrv_name = M_GetNextParm();
-	}
-	else if (!M_CheckParm("-nosd"))
-	{
-		hws_mode = HWS_FMOD3D;
-		sdrv_name = "s_fmod.dll";
-	}
-#endif
-
-	// There must be further sound drivers (such as A3D and EAX)!!!
-
-	if (hws_mode != HWS_DEFAULT_MODE && sdrv_name != NULL)
-	{
-		if (Init3DSDriver(sdrv_name))
-		{
-			//nosound = true;
-			snddev.sample_rate = frequency;
-			snddev.bps = 16;
-			snddev.numsfxs = NUMSFX;
-			snddev.cooplevel = cooplevel;
-			snddev.hWnd = hWndMain;
-			if (HW3S_Init(I_Error, &snddev))
-			{
-				CONS_Printf("Using external sound driver %s\n", sdrv_name);
-				I_AddExitFunc(I_ShutdownSound);
-				return;
-			}
-			// Falls back to default sound system
-			CONS_Printf("Not using external sound driver %s\n", sdrv_name);
-			HW3S_Shutdown();
-			Shutdown3DSDriver();
-		}
-		hws_mode = HWS_DEFAULT_MODE;
-	}
-#endif
-
-	// Create DirectSound, use the default sound device
-	hr = DirectSoundCreate(NULL, &DSnd, NULL);
-	if (FAILED(hr))
-	{
-		CONS_Printf(" DirectSoundCreate FAILED\n"
-					 " there is no sound device or the sound device is under\n"
-					 " the control of another application\n");
-		nosound = true;
-		return;
-	}
-
-	// register exit code, now that we have at least DirectSound to close
-	I_AddExitFunc(I_ShutdownSound);
-	hr = IDirectSound_SetCooperativeLevel (DSnd, hWndMain, cooplevel);
-	if (FAILED(hr))
-	{
-		CONS_Printf(" SetCooperativeLevel FAILED\n");
-		nosound = true;
-		return;
-	}
-
-	// Set up DSBUFFERDESC structure.
-	ZeroMemory (&dsbdesc, sizeof (DSBUFFERDESC));
-	dsbdesc.dwSize        = sizeof (DSBUFFERDESC);
-	dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER |
-	                  DSBCAPS_CTRLVOLUME;
-	dsbdesc.dwBufferBytes = 0;      // Must be 0 for primary buffer
-	dsbdesc.lpwfxFormat = NULL;     // Must be NULL for primary buffer
-
-	// Set up structure for the desired format
-	ZeroMemory (&wfm, sizeof (WAVEFORMATEX));
-	wfm.wFormatTag = WAVE_FORMAT_PCM;
-	wfm.nChannels = 2;                              //STEREO SOUND!
-	wfm.nSamplesPerSec = frequency;
-	wfm.wBitsPerSample = 16;
-	wfm.nBlockAlign = (WORD)(wfm.wBitsPerSample / 8 * wfm.nChannels);
-	wfm.nAvgBytesPerSec = wfm.nSamplesPerSec * wfm.nBlockAlign;
-
-	// Gain access to the primary buffer
-	hr = IDirectSound_CreateSoundBuffer (DSnd, &dsbdesc, &lpDsb, NULL);
-	if (FAILED(hr))
-	{
-		CONS_Printf("CreateSoundBuffer FAILED: %s (ErrNo %d)\n", DXErrorToString(hr), hr);
-		nosound = true;
-		return;
-	}
-
-	// Set the primary buffer to the desired format,
-	// but only if we are allowed to do it
-	if (cooplevel >= DSSCL_PRIORITY)
-	{
-		if (SUCCEEDED (hr))
-		{
-			// Set primary buffer to the desired format. If this fails,
-			// we'll just ignore and go with the default.
-			hr = IDirectSoundBuffer_SetFormat (lpDsb, &wfm);
-			if (FAILED(hr))
-				CONS_Printf("I_StartupSound :  couldn't set primary buffer format.\n");
-			else
-				CV_SetValue(&cv_samplerate,wfm.nSamplesPerSec);
-		}
-		// move any on-board sound memory into a contiguous block
-		// to make the largest portion of free memory available.
-
-		CONS_Printf(" Compacting onboard sound-memory...");
-		hr = IDirectSound_Compact (DSnd);
-		CONS_Printf(" %s\n", SUCCEEDED(hr) ? "Done\n" : "Failed\n"));
-	}
-
-	// set the primary buffer to play continuously, for performance
-	// "... this method will ensure that the primary buffer is playing even when no secondary
-	// buffers are playing; in that case, silence will be played. This can reduce processing
-	// overhead when sounds are started and stopped in sequence, because the primary buffer
-	// will be playing continuously rather than stopping and starting between secondary buffers."
-	hr = IDirectSoundBuffer_Play (lpDsb, 0, 0, DSBPLAY_LOOPING);
-	if (FAILED (hr))
-		CONS_Printf(" Primary buffer continuous play FAILED\n");
-
-#ifdef DEBUGSOUND
-	{
-		DSCAPS              DSCaps;
-		DSCaps.dwSize = sizeof (DSCAPS);
-		hr = IDirectSound_GetCaps (DSnd, &DSCaps);
-		if (SUCCEEDED (hr))
-		{
-			if (DSCaps.dwFlags & DSCAPS_CERTIFIED)
-				CONS_Printf("This driver has been certified by Microsoft\n");
-			if (DSCaps.dwFlags & DSCAPS_EMULDRIVER)
-				CONS_Printf("No driver with DirectSound support installed (no hardware mixing)\n");
-			if (DSCaps.dwFlags & DSCAPS_PRIMARY16BIT)
-				CONS_Printf("Supports 16-bit primary buffer\n");
-			if (DSCaps.dwFlags & DSCAPS_PRIMARY8BIT)
-				CONS_Printf("Supports 8-bit primary buffer\n");
-			if (DSCaps.dwFlags & DSCAPS_SECONDARY16BIT)
-				CONS_Printf("Supports 16-bit, hardware-mixed secondary buffers\n");
-			if (DSCaps.dwFlags & DSCAPS_SECONDARY8BIT)
-				CONS_Printf("Supports 8-bit, hardware-mixed secondary buffers\n");
-
-			CONS_Printf("Maximum number of hardware buffers: %d\n", DSCaps.dwMaxHwMixingStaticBuffers);
-			CONS_Printf("Size of total hardware memory: %d\n", DSCaps.dwTotalHwMemBytes);
-			CONS_Printf("Size of free hardware memory= %d\n", DSCaps.dwFreeHwMemBytes);
-			CONS_Printf("Play Cpu Overhead (%% cpu cycles): %d\n", DSCaps.dwPlayCpuOverheadSwBuffers);
-		}
-		else
-			CONS_Printf(" couldn't get sound device caps.\n");
-	}
-#endif
-
-	// save pointer to the primary DirectSound buffer for volume changes
-	DSndPrimary = lpDsb;
-
-	ZeroMemory (StackSounds, sizeof (StackSounds));
-
-	CONS_Printf("sound initialised.\n");
-	sound_started = true;
-}
-
-
-// ==========================================================================
-//
-// MUSIC API using MidiStream
-//
-// ==========================================================================
-
-#define SPECIAL_HANDLE_CLEANMIDI  -1999 // tell I_StopSong() to do a full (slow) midiOutReset() on exit
-
-static  BOOL        bMusicStarted;
-
-static  UINT        uMIDIDeviceID, uCallbackStatus;
-static  HMIDISTRM   hStream;
-static  HANDLE      hBufferReturnEvent; // for synch between the callback thread and main program thread
-                                        // (we need to synch when we decide to stop/free stream buffers)
-
-static  int         nCurrentBuffer = 0, nEmptyBuffers;
-
-static  BOOL        bBuffersPrepared = FALSE;
-static  DWORD       dwVolCache[MAX_MIDI_IN_TRACKS];
-        DWORD       dwVolumePercent;    // accessed by win_main.c
-
-        // this is accessed by mid2strm.c conversion code
-        BOOL bMidiLooped = FALSE;
-static  BOOL bMidiPlaying = FALSE;
-static  BOOL bMidiPaused = FALSE;
-static  CONVERTINFO ciStreamBuffers[NUM_STREAM_BUFFERS];
-
-#define STATUS_KILLCALLBACK         100     // Signals that the callback should die
-#define STATUS_CALLBACKDEAD         200     // Signals callback is done processing
-#define STATUS_WAITINGFOREND        300     // Callback's waiting for buffers to play
-
-#define DEBUG_CALLBACK_TIMEOUT 2000         // Wait 2 seconds for callback
-                                            // faB: don't freeze the main code if we debug..
-
-#define VOL_CACHE_INIT              127     // for dwVolCache[]
-
-static BOOL bMidiCanSetVolume;          // midi caps
-
-static void Mid2StreamFreeBuffers(void);
-static void CALLBACK MidiStreamCallback (HMIDIIN hMidi, UINT uMsg, DWORD dwInstance,
-                                         DWORD dwParam1, DWORD dwParam2);
-static BOOL StreamBufferSetup(LPBYTE pMidiData, size_t iMidiSize);
-
-// -------------------
-// MidiErrorMessageBox
-// Calls the midiOutGetErrorText() function and displays the text which
-// corresponds to a midi subsystem error code.
-// -------------------
-static void MidiErrorMessageBox(MMRESULT mmr)
-{
-	char szTemp[256] = "";
-
-	/*szTemp[0] = '\2';   //white text to stand out*/
-	if((MMSYSERR_NOERROR == midiOutGetErrorTextA(mmr, szTemp/*+1*/, sizeof (szTemp))) && *szTemp)
-		CONS_Printf("%s\n",szTemp);
-	/*MessageBox (GetActiveWindow(), szTemp+1, "LEGACY",
-				MB_OK | MB_ICONSTOP);*/
-	//wsprintf(szDebug, "Midi subsystem error: %s", szTemp);
-}
-
-
-// ----------------
-// I_InitAudioMixer
-// ----------------
-#ifdef TESTCODE
-void I_InitAudioMixer (void)
-{
-	UINT        cMixerDevs = mixerGetNumDevs();
-	CONS_Printf("%d mixer devices available\n", cMixerDevs);
-}
-#endif
-
-// -----------
-// I_InitDigMusic
-// Startup Digital device for streaming output
-// -----------
-void I_InitDigMusic(void)
-{
-	if (dedicated)
-		nodigimusic = true;
-	else
-		CONS_Printf("I_InitDigMusic()\n");
-
-#ifdef FMODSOUND
-	if (!nodigimusic)
-	{
-		// Tails 11-21-2002
-		if (FSOUND_GetVersion() < FMOD_VERSION)
-		{
-			//I_Error("FMOD Error : You are using the wrong DLL version!\nYou should be using FMOD %s\n", "FMOD_VERSION");
-			CONS_Printf("FMOD Error : You are using the wrong DLL version!\nYou should be using FMOD %s\n", "FMOD_VERSION");
-			nodigimusic = true;
-		}
-
-		/*
-			INITIALIZE
-		*/
-#if 1
-		if (!FSOUND_SetHWND(hWndMain))
-		{
-//			I_Error("FMOD(Init,FSOUND_SetHWND): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			//FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
-		}
-		//else
-#endif
-
-		if (!FSOUND_Init(44100, 32, FSOUND_INIT_DONTLATENCYADJUST))
-		{
-			//I_Error("FMOD(Init,FSOUND_Init): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			CONS_Printf("FMOD(Init,FSOUND_Init): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			nodigimusic = true;
-		}
-		else
-			I_AddExitFunc(I_ShutdownDigMusic);
-	}
-#endif
-}
-
-// -----------
-// I_InitMIDIMusic
-// Startup Midi device for streaming output
-// -----------
-void I_InitMIDIMusic(void)
-{
-	DWORD       idx;
-	MMRESULT    mmrRetVal;
-	UINT        cMidiDevs;
-	MIDIOUTCAPS MidiOutCaps;
-	const char *szTechnology;
-
-	bMusicStarted = false;
-
-	if (dedicated)
-		nomidimusic = true;
-	else
-		CONS_Printf("I_InitMIDIMusic()\n");
-
-	if (nomidimusic)
-		return;
-
-	// check out number of MIDI devices available
-	//
-	cMidiDevs = midiOutGetNumDevs();
-	if (!cMidiDevs)
-	{
-		CONS_Printf("No MIDI devices available, music is disabled\n");
-		nomidimusic = true;
-		return;
-	}
-#ifdef DEBUGMIDISTREAM
-	else
-	{
-		CONS_Printf("%d MIDI devices available\n", cMidiDevs);
-	}
-#endif
-
-	if (M_CheckParm("-winmidi") && M_IsNextParm())
-		uMIDIDeviceID = atoi(M_GetNextParm());
-	else
-		uMIDIDeviceID = MIDI_MAPPER;
-
-	// get MIDI device caps
-	//
-	if ((mmrRetVal = midiOutGetDevCaps (uMIDIDeviceID, &MidiOutCaps, sizeof (MIDIOUTCAPS))) !=
-	     MMSYSERR_NOERROR)
-	{
-		CONS_Printf("midiOutGetCaps FAILED : \n");
-		MidiErrorMessageBox (mmrRetVal);
-	}
-	else
-	{
-		CONS_Printf("MIDI product name: %s\n", MidiOutCaps.szPname);
-		switch (MidiOutCaps.wTechnology)
-		{
-			case MOD_FMSYNTH:   szTechnology = "FM Synth"; break;
-			case MOD_MAPPER:    szTechnology = "Microsoft MIDI Mapper"; break;
-			case MOD_MIDIPORT:  szTechnology = "MIDI hardware port"; break;
-			case MOD_SQSYNTH:   szTechnology = "Square wave synthesizer"; break;
-			case MOD_SYNTH:     szTechnology = "Synthesizer"; break;
-			default:            szTechnology = "unknown"; break;
-		}
-		CONS_Printf("MIDI technology: %s\n", szTechnology);
-		CONS_Printf("MIDI caps:\n");
-		if (MidiOutCaps.dwSupport & MIDICAPS_CACHE)
-			CONS_Printf("-Patch caching\n");
-		if (MidiOutCaps.dwSupport & MIDICAPS_LRVOLUME)
-			CONS_Printf("-Separate left and right volume control\n");
-		if (MidiOutCaps.dwSupport & MIDICAPS_STREAM)
-			CONS_Printf("-Direct support for midiStreamOut()\n");
-		if (MidiOutCaps.dwSupport & MIDICAPS_VOLUME)
-			CONS_Printf("-Volume control\n");
-		bMidiCanSetVolume = ((MidiOutCaps.dwSupport & MIDICAPS_VOLUME)!=0);
-	}
-
-#ifdef TESTCODE
-	I_InitAudioMixer ();
-#endif
-
-	// ----------------------------------------------------------------------
-	// Midi2Stream initialization
-	// ----------------------------------------------------------------------
-
-	// create event for synch'ing the callback thread to main program thread
-	// when we will need it
-	hBufferReturnEvent = CreateEvent(NULL, FALSE, FALSE,
-	                                  TEXT("SRB2 Midi Playback: Wait For Buffer Return"));
-
-	if (!hBufferReturnEvent)
-	{
-		I_GetLastErrorMsgBox();
-		nomidimusic = true;
-		return;
-	}
-
-	if ((mmrRetVal = midiStreamOpen(&hStream,
-	                                &uMIDIDeviceID,
-	                                (DWORD)1, (DWORD_PTR)MidiStreamCallback/*NULL*/,
-	                                (DWORD)0,
-	                                CALLBACK_FUNCTION /*CALLBACK_NULL*/)) != MMSYSERR_NOERROR)
-	{
-		CONS_Printf("I_RegisterSong: midiStreamOpen FAILED\n");
-		MidiErrorMessageBox(mmrRetVal);
-		nomidimusic = true;
-		return;
-	}
-
-	// stream buffers are initially unallocated (set em NULL)
-	for (idx = 0; idx < NUM_STREAM_BUFFERS; idx++)
-		ZeroMemory (&ciStreamBuffers[idx].mhBuffer, sizeof (MIDIHDR));
-	// ----------------------------------------------------------------------
-
-	// register exit code
-	I_AddExitFunc(I_ShutdownMIDIMusic);
-
-	bMusicStarted = true;
-}
-
-// ---------------
-// I_InitMusic
-// ---------------
-void I_InitMusic(void)
-{
-	I_InitDigMusic();
-	I_InitMIDIMusic();
-}
-
-// ---------------
-// I_ShutdownDigMusic
-// ---------------
-void I_ShutdownDigMusic(void)
-{
-	CONS_Printf("I_ShutdownDigMusic: \n");
-
-#ifdef FMODSOUND
-	if (!nodigimusic && FSOUND_GetError() != FMOD_ERR_UNINITIALIZED)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER)
-			if (devparm) CONS_Printf("FMOD(Shutdown,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (mod)
-		{
-			if (FMUSIC_IsPlaying(mod))
-				if (!FMUSIC_StopSong(mod))
-					if (devparm) CONS_Printf("FMOD(Shutdown,FMUSIC_StopSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			if (!FMUSIC_FreeSong(mod))
-				if (devparm) CONS_Printf("FMOD(Shutdown,FMUSIC_FreeSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		if (fmus)
-		{
-			if (FSOUND_IsPlaying(fsoundchannel))
-				if (!FSOUND_Stream_Stop(fmus))
-					if (devparm) CONS_Printf("FMOD(Shutdown,FSOUND_Stream_Stop): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			if (!FSOUND_Stream_Close(fmus))
-				if (devparm) CONS_Printf("FMOD(Shutdown,FSOUND_Stream_Close): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		FSOUND_Close();
-		remove("fmod.tmp"); // Delete the temp file
-		//if (!FSOUND_StopSound(FSOUND_ALL))
-			//if (FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Shutdown,FSOUND_StopSound): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		//FMUSIC_StopAllSongs();
-			//if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Shutdown,FMUSIC_StopAllSongs): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-	}
-#endif
-}
-
-// ---------------
-// I_ShutdownMIDIMusic
-// ---------------
-void I_ShutdownMIDIMusic(void)
-{
-	DWORD       idx;
-	MMRESULT    mmrRetVal;
-	HGLOBAL lp = NULL;
-
-	CONS_Printf("I_ShutdownMIDIMusic: \n");
-
-	if (nomidimusic)
-		return;
-
-	if (!bMusicStarted)
-		return;
-
-	if (hStream)
-	{
-		I_StopSong (SPECIAL_HANDLE_CLEANMIDI);
-	}
-
-	Mid2StreamConverterCleanup();
-	Mid2StreamFreeBuffers();
-
-	// Free our stream buffers
-	for (idx = 0; idx < NUM_STREAM_BUFFERS; idx++)
-	{
-		if (ciStreamBuffers[idx].mhBuffer.lpData)
-		{
-			//GlobalFreePtr(ciStreamBuffers[idx].mhBuffer.lpData);
-			lp = GlobalPtrHandle(ciStreamBuffers[idx].mhBuffer.lpData);
-			GlobalUnlock(lp);
-			GlobalFree(lp);
-			ciStreamBuffers[idx].mhBuffer.lpData = NULL;
-		}
-	}
-
-	if (hStream)
-	{
-		if ((mmrRetVal = midiStreamClose(hStream)) != MMSYSERR_NOERROR)
-			MidiErrorMessageBox(mmrRetVal);
-		hStream = NULL;
-	}
-
-	CloseHandle(hBufferReturnEvent);
-
-	bMusicStarted = false;
-}
-
-// ---------------
-// I_ShutdownMusic
-// ---------------
-void I_ShutdownMusic(void)
-{
-	if (!nodigimusic)
-		I_ShutdownDigMusic();
-
-	if (!nomidimusic)
-		I_ShutdownMIDIMusic();
-}
-
-// --------------------
-// SetAllChannelVolumes
-// Given a percent in tenths of a percent, sets volume on all channels to
-// reflect the new value.
-// --------------------
-static void SetAllChannelVolumes(DWORD dwVolumePercent)
-{
-	DWORD       dwEvent, dwStatus, dwVol, idx;
-	MMRESULT    mmrRetVal;
-
-	if (!bMidiPlaying)
-		return;
-
-	for (idx = 0, dwStatus = MIDI_CTRLCHANGE; idx < MAX_MIDI_IN_TRACKS; idx++, dwStatus++)
-	{
-		dwVol = (dwVolCache[idx] * dwVolumePercent) / 1000;
-		//CONS_Printf("channel %d vol %d\n", idx, dwVol);
-		dwEvent = dwStatus | ((DWORD)MIDICTRL_VOLUME << 8)
-			| ((DWORD)dwVol << 16);
-		if ((mmrRetVal = midiOutShortMsg((HMIDIOUT)hStream, dwEvent))
-			!= MMSYSERR_NOERROR)
-		{
-			MidiErrorMessageBox(mmrRetVal);
-			return;
-		}
-	}
-}
-
-
-// ----------------
-// I_SetMusicVolume
-// Set the midi output volume
-// ----------------
-void I_SetMIDIMusicVolume(INT32 volume)
-{
-	MMRESULT    mmrRetVal;
-	int         iVolume;
-
-	if (nomidimusic)
-		return;
-
-	if (bMidiCanSetVolume)
-	{
-		// method A
-		// current volume is 0-31, we need 0-0xFFFF in each word (left/right channel)
-		iVolume = (volume << 11) | (volume << 27);
-		if ((mmrRetVal = midiOutSetVolume ((HMIDIOUT)(size_t)uMIDIDeviceID, iVolume)) != MMSYSERR_NOERROR)
-		{
-			CONS_Printf("I_SetMusicVolume: couldn't set volume\n");
-			MidiErrorMessageBox(mmrRetVal);
-		}
-	}
-	else
-	{
-		// method B
-		dwVolumePercent = (volume * 1000) / 32;
-		SetAllChannelVolumes (dwVolumePercent);
-	}
-}
-
-void I_SetDigMusicVolume(INT32 volume)
-{
-#ifdef FMODSOUND
-	if (volume != -1)
-		fmodvol = (volume<<3)+(volume>>2);
-	if (!nodigimusic)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER)
-			if (devparm) CONS_Printf("FMOD(Volume,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (mod)
-		{
-			if (FMUSIC_GetType(mod) != FMUSIC_TYPE_NONE)
-			{
-				if (!FMUSIC_SetMasterVolume(mod, fmodvol) && devparm)
-					CONS_Printf("FMOD(Volume,FMUSIC_SetMasterVolume): %s\n",
-						FMOD_ErrorString(FSOUND_GetError()));
-			}
-			else if (devparm)
-				CONS_Printf("FMOD(Volume,FMUSIC_GetType): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		if (fmus)
-		{
-			if (!FSOUND_SetVolume(fsoundchannel, fmodvol))
-				if (devparm) CONS_Printf("FMOD(Volume,FSOUND_SetVolume): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-	}
-#else
-	(void)volume;
-#endif
-}
-
-
-// ----------
-// I_PlaySong
-// Note: doesn't use the handle, would be useful to switch between mid's after
-//       some trigger (would do several RegisterSong, then PlaySong the chosen one)
-// ----------
-boolean I_PlaySong(INT32 handle, INT32 bLooping)
-{
-	MMRESULT        mmrRetVal;
-
-	if (nomidimusic)
-		return false;
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_PlaySong: looping %d\n", bLooping);
-#endif
-
-	// unpause the song first if it was paused
-	if (bMidiPaused)
-		I_PauseSong(handle);
-
-	// Clear the status of our callback so it will handle
-	// MOM_DONE callbacks once more
-	uCallbackStatus = 0;
-	bMidiPlaying = FALSE;
-	if ((mmrRetVal = midiStreamRestart(hStream)) != MMSYSERR_NOERROR)
-	{
-		MidiErrorMessageBox(mmrRetVal);
-		Mid2StreamConverterCleanup();
-		Mid2StreamFreeBuffers();
-		midiStreamClose(hStream);
-		//I_Error("I_PlaySong: midiStreamRestart error");
-		midiStreamOpen(&hStream, &uMIDIDeviceID, (DWORD)1,
-		               (DWORD_PTR)MidiStreamCallback/*NULL*/,
-		               (DWORD)0, CALLBACK_FUNCTION /*CALLBACK_NULL*/);
-	}
-	else bMidiPlaying = TRUE;
-	bMidiLooped = bLooping;
-	return bMidiPlaying;
-}
-
-
-// -----------
-// I_PauseSong
-// calls midiStreamPause() to pause the midi playback
-// -----------
-void I_PauseSong (INT32 handle)
-{
-	(void)handle;
-#ifdef FMODSOUND
-	if (!nodigimusic)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER)
-			if (devparm) CONS_Printf("FMOD(Pause,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (mod)
-		{
-			if (!FMUSIC_GetPaused(mod))
-				if (!FMUSIC_SetPaused(mod, true))
-					if (devparm) CONS_Printf("FMOD(Pause,FMUSIC_SetPaused): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		if (fmus)
-		{
-			if (!FSOUND_GetPaused(fsoundchannel))
-				if (!FSOUND_SetPaused(fsoundchannel, true))
-					if (devparm) CONS_Printf("FMOD(Pause,FSOUND_SetPaused): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-	}
-#endif
-
-	if (nomidimusic)
-		return;
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_PauseSong: \n");
-#endif
-
-	if (!bMidiPaused)
-	{
-		midiStreamPause(hStream);
-		bMidiPaused = true;
-	}
-}
-
-
-// ------------
-// I_ResumeSong
-// un-pause the midi song with midiStreamRestart
-// ------------
-void I_ResumeSong (INT32 handle)
-{
-	(void)handle;
-#ifdef FMODSOUND
-	if (!nodigimusic)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER)
-			if (devparm) CONS_Printf("FMOD(Resume,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (mod != NULL)
-		{
-			if (FMUSIC_GetPaused(mod))
-				if (!FMUSIC_SetPaused(mod, false))
-					if (devparm) CONS_Printf("FMOD(Resume,FMUSIC_SetPaused): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		if (fmus != NULL)
-		{
-			if (FSOUND_GetPaused(fsoundchannel))
-				if (!FSOUND_SetPaused(fsoundchannel, false))
-					if (devparm) CONS_Printf("FMOD(Resume,FSOUND_SetPaused): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-	}
-#endif
-
-	if (nomidimusic)
-		return;
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_ResumeSong: \n");
-#endif
-
-	if (bMidiPaused)
-	{
-		midiStreamRestart(hStream);
-		bMidiPaused = false;
-	}
-}
-
-
-// ----------
-// I_StopSong
-// ----------
-// faB: -1999 is a special handle here, it means we stop the midi when exiting
-//      Legacy, this will do a midiOutReset() for a more 'sure' midi off.
-void I_StopSong(INT32 handle)
-{
-	MMRESULT        mmrRetVal;
-
-	if (nomidimusic)
-		return;
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_StopSong: \n");
-#endif
-
-	if (bMidiPlaying || (uCallbackStatus != STATUS_CALLBACKDEAD))
-	{
-		bMidiPlaying = bMidiPaused = FALSE;
-		if (uCallbackStatus != STATUS_CALLBACKDEAD &&
-		    uCallbackStatus != STATUS_WAITINGFOREND)
-			uCallbackStatus = STATUS_KILLCALLBACK;
-
-		//CONS_Printf("a: %d\n",I_GetTime());
-		if ((mmrRetVal = midiStreamStop(hStream)) != MMSYSERR_NOERROR)
-		{
-			MidiErrorMessageBox(mmrRetVal);
-			return;
-		}
-
-		//faB: if we don't call midiOutReset() seems we have to stop the buffers
-		//     ourselves (or it doesn't play anymore)
-		if (!bMidiPaused && (handle != SPECIAL_HANDLE_CLEANMIDI))
-		{
-			midiStreamPause(hStream);
-		}
-		//CONS_Printf("b: %d\n",I_GetTime());
-		else
-		//faB: this damn call takes 1 second and a half !!! still do it on exit
-		//     to be sure everything midi is cleaned as much as possible
-		if (handle == SPECIAL_HANDLE_CLEANMIDI)
-		{
-			if ((mmrRetVal = midiOutReset((HMIDIOUT)hStream)) != MMSYSERR_NOERROR)
-			{
-				MidiErrorMessageBox(mmrRetVal);
-				return;
-			}
-		}
-		//CONS_Printf("c: %d\n",I_GetTime());
-
-		// Wait for the callback thread to release this thread, which it will do by
-		// calling SetEvent() once all buffers are returned to it
-		if ((devparm)
-			&& (WaitForSingleObject(hBufferReturnEvent, DEBUG_CALLBACK_TIMEOUT)
-			    == WAIT_TIMEOUT))
-		{
-			// Note, this is a risky move because the callback may be genuinely busy, but
-			// when we're debugging, it's safer and faster than freezing the application,
-			// which leaves the MIDI device locked up and forces a system reset...
-			CONS_Printf("Timed out waiting for MIDI callback\n");
-			uCallbackStatus = STATUS_CALLBACKDEAD;
-		}
-		//CONS_Printf("d: %d\n",I_GetTime());
-	}
-
-	if (uCallbackStatus == STATUS_CALLBACKDEAD)
-	{
-		uCallbackStatus = 0;
-		Mid2StreamConverterCleanup();
-		Mid2StreamFreeBuffers();
-		//faB: we could close the stream here and re-open later to avoid
-		//     a little quirk in mmsystem (see DirectX6 mstream note)
-		midiStreamClose(hStream);
-		midiStreamOpen(&hStream, &uMIDIDeviceID, (DWORD)1,
-		               (DWORD_PTR)MidiStreamCallback/*NULL*/,
-		               (DWORD)0, CALLBACK_FUNCTION /*CALLBACK_NULL*/);
-	}
-}
-
-void I_StopDigSong(void)
-{
-#ifdef FMODSOUND
-	if (!nodigimusic)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_INVALID_PARAM && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER)
-			if (devparm) CONS_Printf("FMOD(Stop,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (mod)
-		{
-			if (FMUSIC_IsPlaying(mod))
-			{
-				if (!FMUSIC_StopSong(mod))
-					if (devparm) CONS_Printf("FMOD(Stop,FMUSIC_StopSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			}
-		}
-		if (fmus)
-		{
-			if (FSOUND_IsPlaying(fsoundchannel))
-			{
-				if (!FSOUND_Stream_Stop(fmus))
-					if (devparm) CONS_Printf("FMOD(Stop,FSOUND_Stream_Stop): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			}
-		}
-		//if (!FSOUND_StopSound(FSOUND_ALL))
-			//if (FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Stop,FSOUND_StopSound): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		//FMUSIC_StopAllSongs();
-			//if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Stop,FMUSIC_StopAllSongs): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-	}
-#endif
-}
-
-void I_UnRegisterSong(INT32 handle)
-{
-	handle = 0;
-	if (nomidimusic)
-		return;
-
-	//faB: we might free here whatever is allocated per-music
-	//     (but we don't cause I hate malloc's)
-	Mid2StreamConverterCleanup();
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_UnregisterSong: \n");
-#endif
-}
-
-int I_SetSongSpeed(unsigned int speed)
-{
-#ifdef FMODSOUND
-	if (music_disabled || nodigimusic)
-		return 0; //there no music or FMOD is not loaded
-
-	if((!fmus || !FSOUND_IsPlaying(fsoundchannel)) && (!mod || !FMUSIC_IsPlaying(mod)))
-		return 0; //there no FMOD music playing
-
-	if (speed == 0)
-		return 1; //yes, we can set the speed
-
-	if (fmus)
-	{
-		if (FSOUND_IsPlaying(fsoundchannel)
-		&& !FSOUND_SetFrequency(fsoundchannel,(int)(((float)speed*(float)fsoundfreq)/100.0f)))
-		{
-			if (devparm)
-				CONS_Printf("FMOD(ChangeSpeed,FSOUND_SetFrequency): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		else
-			return 1;
-	}
-	else if (mod)
-	{
-		if (FMUSIC_IsPlaying(mod)
-		&& !FMUSIC_SetMasterSpeed(mod,(float)speed/100.0f))
-		{
-			if (devparm)
-				CONS_Printf("FMOD(ChangeSpeed,FMUSIC_SetMasterSpeed): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		else
-			return 1;
-	}
-#else
-	(void)speed;
-#endif
-	return 0;
-}
-
-// Special FMOD support Tails 11-21-2002
-boolean I_StartDigSong(const char *musicname, INT32 looping)
-{
-#ifdef FMODSOUND
-	char filename[9];
-	void *data;
-	int lumpnum;
-
-	if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_CHANNEL_ALLOC &&
-	   FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER && FSOUND_GetError() != FMOD_ERR_INVALID_PARAM)
-		if (devparm) CONS_Printf("FMOD(Start,Unknown): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-
-	if (fmus)
-	{
-		if (FSOUND_IsPlaying(fsoundchannel))
-			if (!FSOUND_Stream_Stop(fmus))
-				if (devparm) CONS_Printf("FMOD(Start,FSOUND_Stream_Stop): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (!FSOUND_Stream_Close(fmus))
-			if (devparm) CONS_Printf("FMOD(Start,FSOUND_Stream_Close): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		fsoundchannel = -1;
-		fmus = NULL;
-	}
-	if (mod)
-	{
-		if (FMUSIC_IsPlaying(mod))
-			if (!FMUSIC_StopSong(mod))
-				if (devparm) CONS_Printf("FMOD(Start,FMUSIC_StopSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		if (!FMUSIC_FreeSong(mod))
-			if (devparm) CONS_Printf("FMOD(Start,FMUSIC_FreeSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		mod = NULL;
-	}
-	//if (!FSOUND_StopSound(FSOUND_ALL))
-		//if (FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Start,FSOUND_StopSound): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-	//FMUSIC_StopAllSongs();
-		//if (FSOUND_GetError() != FMOD_ERR_NONE && FSOUND_GetError() != FMOD_ERR_MEDIAPLAYER) CONS_Printf("FMOD(Start,FMUSIC_StopAllSongs): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-
-	// Create the filename we need
-	sprintf(filename, "o_%s", musicname);
-
-	lumpnum = W_CheckNumForName(filename);
-
-	if (lumpnum == -1)
-	{
-		// Graue 02-29-2004: don't worry about missing music, there might still be a MIDI
-		return false; // No music found. Oh well!
-	}
-
-	data = W_CacheLumpName (filename, PU_CACHE);
-
-	I_SaveMemToFile (data, W_LumpLength(lumpnum), "fmod.tmp");
-
-	Z_Free(data);
-
-	mod = FMUSIC_LoadSong("fmod.tmp");
-
-	if (FSOUND_GetError() != FMOD_ERR_NONE)
-	{
-		if (FSOUND_GetError() != FMOD_ERR_FILE_FORMAT)
-			if (devparm) CONS_Printf("FMOD(Start,FMUSIC_LoadSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-
-		if (mod)
-		{
-			if (FMUSIC_IsPlaying(mod))
-				if (!FMUSIC_StopSong(mod))
-					if (devparm) CONS_Printf("FMOD(Start,FMUSIC_StopSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			if (!FMUSIC_FreeSong(mod))
-				if (devparm) CONS_Printf("FMOD(Start,FMUSIC_FreeSong): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			mod = NULL;
-		}
-	}
-
-	if (mod)
-	{
-		if (!FMUSIC_SetLooping(mod, (signed char)looping))
-		{
-			if (devparm) CONS_Printf("FMOD(Start,FMUSIC_SetLooping): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-//		else if (FMUSIC_GetType(mod) == FMUSIC_TYPE_MOD || FMUSIC_GetType(mod) == FMUSIC_TYPE_S3M)
-//		{
-//			if (!FMUSIC_SetPanSeperation(mod, 0.85f))		/* 15% crossover */
-//				CONS_Printf("FMOD(Start,FMUSIC_SetPanSeperation): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-//		}
-		else if (!FMUSIC_SetPanSeperation(mod, 0.0f))
-		{
-			if (devparm) CONS_Printf("FMOD(Start,FMUSIC_SetPanSeperation): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-	}
-	else
-	{
-		fmus = FSOUND_Stream_OpenFile("fmod.tmp", ((looping) ? (FSOUND_LOOP_NORMAL) : (0)),0);
-		if (fmus == NULL)
-		{
-			if (devparm) CONS_Printf("FMOD(Start,FSOUND_Stream_Open): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-			return false;
-		}
-	}
-
-	// Scan the Ogg Vorbis file for the COMMENT= field for a custom loop point
-	if (fmus && looping)
-	{
-		int scan;
-		char *dataum;
-		char looplength[64];
-		unsigned int loopstart = 0;
-		int newcount = 0;
-		const int freq = 44100;
-		int lumplength = W_LumpLength(lumpnum);
-		int length = FSOUND_Stream_GetLengthMs(fmus);
-
-		if (length == 0)
-		{
-			if (devparm) CONS_Printf("FMOD(Start,FSOUND_Stream_GetLengthMs): %s\n", FMOD_ErrorString(FSOUND_GetError()));
-		}
-		else
-		{
-			//freq = FSOUND_GetFrequency(fsoundchannel);
-
-			data = W_CacheLumpName (filename, PU_CACHE);
-
-			dataum = (char *)data;
-
-			for (scan = 0;scan < lumplength; scan++)
-			{
-				if (*dataum++ == 'C'){
-				if (*dataum++ == 'O'){
-				if (*dataum++ == 'M'){
-				if (*dataum++ == 'M'){
-				if (*dataum++ == 'E'){
-				if (*dataum++ == 'N'){
-				if (*dataum++ == 'T'){
-				if (*dataum++ == '='){
-				if (*dataum++ == 'L'){
-				if (*dataum++ == 'O'){
-				if (*dataum++ == 'O'){
-				if (*dataum++ == 'P'){
-				if (*dataum++ == 'P'){
-				if (*dataum++ == 'O'){
-				if (*dataum++ == 'I'){
-				if (*dataum++ == 'N'){
-				if (*dataum++ == 'T'){
-				if (*dataum++ == '=')
-				{
-
-					while (*dataum != 1 && newcount != 63)
-					{
-						looplength[newcount++] = *dataum++;
-					}
-
-					looplength[newcount] = '\n';
-
-					loopstart = atoi(looplength);
-				}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-				else
-					dataum--;}
-			}
-
-			Z_Free(data);
-		}
-
-		if (loopstart > 0)
-		{
-			const unsigned int loopend = (unsigned int)((freq/1000.0f)*length-(freq/1000.0f));
-			//const unsigned int loopend = (((freq/2)*length)/500)-8;
-			if (!FSOUND_Stream_SetLoopPoints(fmus, loopstart, loopend) && devparm)
-				CONS_Printf("FMOD(Start,FSOUND_Stream_SetLoopPoints): %s\n",
-					FMOD_ErrorString(FSOUND_GetError()));
-		}
-	}
-
-	/*
-		PLAY SONG
-	*/
-	if (mod)
-	{
-		if (FMUSIC_PlaySong(mod))
-		{
-			fsoundchannel = -1;
-			I_SetDigMusicVolume(-1);
-			return true;
-		}
-		else
-		{
-			if (devparm)
-				CONS_Printf("FMOD(Start,FMUSIC_PlaySong): %s\n",
-				            FMOD_ErrorString(FSOUND_GetError()));
-			return false;
-		}
-	}
-	if (fmus)
-	{
-		fsoundchannel = FSOUND_Stream_PlayEx(FSOUND_FREE, fmus, NULL, TRUE);
-
-		if (fsoundchannel == -1)
-		{
-			if (devparm)
-				CONS_Printf("FMOD(Start,FSOUND_Stream_PlayEx): %s\n",
-				            FMOD_ErrorString(FSOUND_GetError()));
-			return false;
-		}
-		else if (!FSOUND_SetPaused(fsoundchannel, FALSE))
-		{
-			if (devparm)
-				CONS_Printf("FMOD(Start,FSOUND_SetPaused): %s\n",
-					FMOD_ErrorString(FSOUND_GetError()));
-			return false;
-		}
-
-		I_SetDigMusicVolume(-1);
-		fsoundfreq = FSOUND_GetFrequency(fsoundchannel);
-		return true;
-	}
-#else
-	(void)musicname;
-	(void)looping;
-#endif
-	return false;
-
-/////////////////////////////////////////////////////////////////////////////////
-}
-
-// --------------
-// I_RegisterSong
-// Prepare a song for playback
-// - setup midi stream buffers, and activate the callback procedure
-//   which will continually fill the buffers with new data
-// --------------
-
-INT32 I_RegisterSong(void *data, int len)
-{
-	char *pMidiFileData = NULL; // MIDI music buffer to be played or NULL
-
-	if (nomidimusic)
-		return 1;
-	if (!data || !len)
-		return 0;
-
-#ifdef DEBUGMIDISTREAM
-	CONS_Printf("I_RegisterSong: \n");
-#endif
-	// check for MID format file
-	if (!memcmp(data, "MThd", 4))
-		pMidiFileData = data;
-	else
-	{
-		CONS_Printf("Music lump is not MID music format\n");
-		return 0;
-	}
-
-#ifdef DEBUGMIDISTREAM
-	I_SaveMemToFile(pMidiFileData, len, "debug.mid");
-#endif
-
-	// setup midi stream buffer
-	if (StreamBufferSetup((LPBYTE)pMidiFileData, len))
-	{
-		Mid2StreamConverterCleanup();
-		I_Error("I_RegisterSong: StreamBufferSetup FAILED");
-	}
-
-	return 1;
-}
-
-// -----------------
-// StreamBufferSetup
-// This function uses the filename stored in the global character array to
-// open a MIDI file. Then it goes about converting at least the first part of
-// that file into a midiStream buffer for playback.
-// -----------------
-
-// -----------------
-// StreamBufferSetup
-// - returns TRUE if a problem occurs
-// -----------------
-static BOOL StreamBufferSetup(LPBYTE pMidiData, size_t iMidiSize)
-{
-	MMRESULT mmrRetVal;
-	MIDIPROPTIMEDIV mptd;
-	BOOL bFoundEnd = FALSE;
-	int dwConvertFlag, nChkErr, idx;
-
-#ifdef DEBUGMIDISTREAM
-	if (hStream == NULL)
-		I_Error("StreamBufferSetup: hStream is NULL!");
-#endif
-
-	// pause midi stream before manipulating the buffers
-	midiStreamPause(hStream);
-
-	// allocate the stream buffers (only once)
-	for (idx = 0; idx < NUM_STREAM_BUFFERS; idx++)
-	{
-		ciStreamBuffers[idx].mhBuffer.dwBufferLength = OUT_BUFFER_SIZE;
-		if (!ciStreamBuffers[idx].mhBuffer.lpData)
-		{
-			ciStreamBuffers[idx].mhBuffer.lpData = GlobalAllocPtr(GHND, OUT_BUFFER_SIZE);
-			if (!ciStreamBuffers[idx].mhBuffer.lpData)
-				return FALSE;
-		}
-	}
-
-	// returns TRUE in case of conversion error
-	if (Mid2StreamConverterInit(pMidiData, iMidiSize))
-		return TRUE;
-
-	// Initialize the volume cache array to some pre-defined value
-	for (idx = 0; idx < MAX_MIDI_IN_TRACKS; idx++)
-		dwVolCache[idx] = VOL_CACHE_INIT;
-
-	mptd.cbStruct = sizeof (mptd);
-	mptd.dwTimeDiv = ifs.dwTimeDivision;
-	if ((mmrRetVal = midiStreamProperty(hStream, (LPBYTE)&mptd, MIDIPROP_SET|MIDIPROP_TIMEDIV))
-	   != MMSYSERR_NOERROR)
-	{
-		MidiErrorMessageBox(mmrRetVal);
-		return TRUE;
-	}
-
-	nEmptyBuffers = 0;
-	dwConvertFlag = CONVERTF_RESET;
-
-	for (nCurrentBuffer = 0; nCurrentBuffer < NUM_STREAM_BUFFERS; nCurrentBuffer++)
-	{
-		// Tell the converter to convert up to one entire buffer's length of output
-		// data. Also, set a flag so it knows to reset any saved state variables it
-		// may keep from call to call.
-		ciStreamBuffers[nCurrentBuffer].dwStartOffset = 0;
-		ciStreamBuffers[nCurrentBuffer].dwMaxLength = OUT_BUFFER_SIZE;
-		ciStreamBuffers[nCurrentBuffer].tkStart = 0;
-		ciStreamBuffers[nCurrentBuffer].bTimesUp = FALSE;
-
-		if ((nChkErr = Mid2StreamConvertToBuffer(dwConvertFlag, &ciStreamBuffers[nCurrentBuffer]))
-		   != CONVERTERR_NOERROR)
-		{
-			if (nChkErr == CONVERTERR_DONE)
-				bFoundEnd = TRUE;
-			else
-			{
-				CONS_Printf("StreamBufferSetup: initial conversion pass failed\n");
-				return TRUE;
-			}
-		}
-		ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded
-			= ciStreamBuffers[nCurrentBuffer].dwBytesRecorded;
-
-		if (!bBuffersPrepared)
-		{
-			if ((mmrRetVal = midiOutPrepareHeader((HMIDIOUT)hStream,
-				&ciStreamBuffers[nCurrentBuffer].mhBuffer, sizeof (MIDIHDR))) != MMSYSERR_NOERROR)
-			{
-				MidiErrorMessageBox(mmrRetVal);
-				return TRUE;
-			}
-		}
-		if ((mmrRetVal = midiStreamOut(hStream, &ciStreamBuffers[nCurrentBuffer].mhBuffer,
-			sizeof (MIDIHDR))) != MMSYSERR_NOERROR)
-		{
-			MidiErrorMessageBox(mmrRetVal);
-			break;
-		}
-		dwConvertFlag = 0;
-
-		if (bFoundEnd)
-			break;
-	}
-
-	bBuffersPrepared = TRUE;
-	nCurrentBuffer = 0;
-
-	// MIDI volume
-	dwVolumePercent = (cv_midimusicvolume.value * 1000) / 32;
-	if (hStream)
-		SetAllChannelVolumes(dwVolumePercent);
-
-	return FALSE;
-}
-
-// ----------------
-// SetChannelVolume
-// Call here delayed by MIDI stream callback, to adapt the volume event of the
-// midi stream to our own set volume percentage.
-// ----------------
-void I_SetMidiChannelVolume(DWORD dwChannel, DWORD dwVolumePercent)
-{
-	DWORD dwEvent, dwVol;
-	MMRESULT mmrRetVal;
-
-	if (!bMidiPlaying)
-		return;
-
-	dwVol = (dwVolCache[dwChannel] * dwVolumePercent) / 1000;
-	dwEvent = MIDI_CTRLCHANGE|dwChannel|((DWORD)MIDICTRL_VOLUME << 8)|((DWORD)dwVol << 16);
-	if ((mmrRetVal = midiOutShortMsg((HMIDIOUT)hStream, dwEvent)) != MMSYSERR_NOERROR)
-	{
-#ifdef DEBUGMIDISTREAM
-		MidiErrorMessageBox(mmrRetVal);
-#endif
-		return;
-	}
-}
-
-// ------------------
-// MidiStreamCallback
-// This is the callback handler which continually refills MIDI data buffers
-// as they're returned to us from the audio subsystem.
-// ------------------
-static void CALLBACK MidiStreamCallback(HMIDIIN hMidi, UINT uMsg, DWORD dwInstance,
-	DWORD dwParam1, DWORD dwParam2)
-{
-	MMRESULT mmrRetVal;
-	int nChkErr;
-	MIDIEVENT* pme;
-	MIDIHDR* pmh;
-
-	hMidi = NULL;
-	dwParam1 = dwParam2 = dwInstance = 0;
-	switch (uMsg)
-	{
-		case MOM_DONE:
-			// dwParam1 is LPMIDIHDR
-			if (uCallbackStatus == STATUS_CALLBACKDEAD)
-				return;
-
-			nEmptyBuffers++;
-
-			// we reached end of song, but we wait until all the buffers are returned
-			if (uCallbackStatus == STATUS_WAITINGFOREND)
-			{
-				if (nEmptyBuffers < NUM_STREAM_BUFFERS)
-					return;
-				else
-				{
-					// stop the song when end reached (was not looping)
-					uCallbackStatus = STATUS_CALLBACKDEAD;
-					SetEvent(hBufferReturnEvent);
-					I_StopSong(0);
-					return;
-				}
-			}
-
-			// This flag is set whenever the callback is waiting for all buffers to come back.
-			if (uCallbackStatus == STATUS_KILLCALLBACK)
-			{
-				// Count NUM_STREAM_BUFFERS-1 being returned for the last time
-				if (nEmptyBuffers < NUM_STREAM_BUFFERS)
-					return;
-				// Then send a stop message when we get the last buffer back...
-				else
-				{
-					// Change the status to callback dead
-					uCallbackStatus = STATUS_CALLBACKDEAD;
-					SetEvent(hBufferReturnEvent);
-					return;
-				}
-			}
-
-			dwProgressBytes += ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded;
-
-			// -------------------------------------------------
-			// Fill an available buffer with audio data again...
-			// -------------------------------------------------
-
-			if (bMidiPlaying && nEmptyBuffers)
-			{
-				ciStreamBuffers[nCurrentBuffer].dwStartOffset = 0;
-				ciStreamBuffers[nCurrentBuffer].dwMaxLength = OUT_BUFFER_SIZE;
-				ciStreamBuffers[nCurrentBuffer].tkStart = 0;
-				ciStreamBuffers[nCurrentBuffer].dwBytesRecorded = 0;
-				ciStreamBuffers[nCurrentBuffer].bTimesUp = FALSE;
-
-				if ((nChkErr = Mid2StreamConvertToBuffer(0, &ciStreamBuffers[nCurrentBuffer]))
-				   != CONVERTERR_NOERROR)
-				{
-					if (nChkErr == CONVERTERR_DONE)
-					{
-						// Don't include this one in the count
-						uCallbackStatus = STATUS_WAITINGFOREND;
-						return;
-					}
-					else
-					{
-						// We're not in the main thread, so we can't call I_Error() now.
-						// Log the error message out, and post exit message.
-						CONS_Printf("MidiStreamCallback(): conversion pass failed!\n");
-						PostMessage(hWndMain, WM_CLOSE, 0, 0);
-						return;
-					}
-				}
-
-				ciStreamBuffers[nCurrentBuffer].mhBuffer.dwBytesRecorded
-					= ciStreamBuffers[nCurrentBuffer].dwBytesRecorded;
-
-				if ((mmrRetVal = midiStreamOut(hStream, &ciStreamBuffers[nCurrentBuffer].mhBuffer,
-					sizeof (MIDIHDR))) != MMSYSERR_NOERROR)
-				{
-					MidiErrorMessageBox(mmrRetVal);
-					Mid2StreamConverterCleanup();
-					return;
-				}
-
-				nCurrentBuffer = (nCurrentBuffer + 1) % NUM_STREAM_BUFFERS;
-				nEmptyBuffers--;
-			}
-
-			break;
-		case MOM_POSITIONCB:
-			pmh = (MIDIHDR*)(size_t)dwParam1;
-			pme = (MIDIEVENT*)(pmh->lpData + pmh->dwOffset);
-			if (MIDIEVENT_TYPE(pme->dwEvent) == MIDI_CTRLCHANGE)
-			{
-#ifdef DEBUGMIDISTREAM
-				if (MIDIEVENT_DATA1(pme->dwEvent) == MIDICTRL_VOLUME_LSB)
-				{
-					CONS_Printf("Got an LSB volume event\n");
-					PostMessage(hWndMain, WM_CLOSE, 0, 0); // can't I_Error() here
-					break;
-				}
-#endif
-				// this is meant to respond to our own intention, from mid2strm.c
-				if (MIDIEVENT_DATA1(pme->dwEvent) != MIDICTRL_VOLUME)
-					break;
-
-				// Mask off the channel number and cache the volume data byte
-				dwVolCache[MIDIEVENT_CHANNEL(pme->dwEvent)] = MIDIEVENT_VOLUME(pme->dwEvent);
-				// call SetChannelVolume() later to adjust MIDI volume control message to our
-				// own current volume level.
-				PostMessage(hWndMain, WM_MSTREAM_UPDATEVOLUME,
-					MIDIEVENT_CHANNEL(pme->dwEvent), 0L);
-			}
-			break;
-		default:
-			break;
-	}
-
-	return;
-}
-
-// ---------------------
-// Mid2StreamFreeBuffers
-// This function unprepares and frees all our buffers -- something we must
-// do to work around a bug in MMYSYSTEM that prevents a device from playing
-// back properly unless it is closed and reopened after each stop.
-// ---------------------
-static void Mid2StreamFreeBuffers(void)
-{
-	DWORD idx;
-	MMRESULT mmrRetVal;
-
-	if (bBuffersPrepared)
-	{
-		for (idx = 0; idx < NUM_STREAM_BUFFERS; idx++)
-		{
-			if ((mmrRetVal = midiOutUnprepareHeader((HMIDIOUT)hStream,
-			   &ciStreamBuffers[idx].mhBuffer, sizeof (MIDIHDR))) != MMSYSERR_NOERROR)
-			{
-				MidiErrorMessageBox(mmrRetVal);
-			}
-		}
-		bBuffersPrepared = FALSE;
-	}
-
-	// Don't free the stream buffers here, but rather allocate them once at startup,
-	// and free them at shutdown.
-}
diff --git a/src/win32ce/win_sys.c b/src/win32ce/win_sys.c
deleted file mode 100644
index 3b6a472587cc161f214736005c48df406dde9925..0000000000000000000000000000000000000000
--- a/src/win32ce/win_sys.c
+++ /dev/null
@@ -1,3542 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief win32 system i/o
-///
-///	Startup & Shutdown routines for music,sound,timer,keyboard,...
-///	Signal handler to trap errors and exit cleanly.
-
-#include "../doomdef.h"
-#include <stdlib.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <io.h>
-#include <stdarg.h>
-#include <direct.h>
-
-#include <mmsystem.h>
-
-#include "../m_misc.h"
-#include "../i_video.h"
-#include "../i_sound.h"
-#include "../i_system.h"
-
-#include "../d_net.h"
-#include "../g_game.h"
-
-#include "../d_main.h"
-
-#include "../m_argv.h"
-
-#include "../w_wad.h"
-#include "../z_zone.h"
-#include "../g_input.h"
-
-#include "../keys.h"
-
-#include "../screen.h"
-
-// Wheel support for Win95/WinNT3.51
-#include <zmouse.h>
-
-// Taken from Win98/NT4.0
-#ifndef SM_MOUSEWHEELPRESENT
-#define SM_MOUSEWHEELPRESENT 75
-#endif
-
-#ifndef MSH_MOUSEWHEEL
-#ifdef UNICODE
-#define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG"
-#else
-#define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
-#endif
-#endif
-
-#include "win_main.h"
-#include "../i_joy.h"
-
-#define DIRECTINPUT_VERSION     0x700
-// Force dinput.h to generate old DX3 headers.
-#define DXVERSION_NTCOMPATIBLE  0x0300
-#include <dinput.h>
-
-#include "fabdxlib.h"
-
-#ifdef __DEBUG__
-#undef NDEBUG
-#endif
-
-/// \brief max number of joystick buttons
-#define JOYBUTTONS_MAX 32 // rgbButtons[32]
-/// \brief max number of joystick button events
-#define JOYBUTTONS_MIN min((JOYBUTTONS),(JOYBUTTONS_MAX))
-
-/// \brief max number of joysick axies
-#define JOYAXISSET_MAX 4 // (lX, lY), (lZ,lRx), (lRy, lRz), rglSlider[2] is very diff
-/// \brief max number ofjoystick axis events
-#define JOYAXISSET_MIN min((JOYAXISSET),(JOYAXISSET_MAX))
-
-/// \brief max number of joystick hats
-#define JOYHATS_MAX 4 // rgdwPOV[4];
-/// \brief max number of joystick hat events
-#define JOYHATS_MIN min((JOYHATS),(JOYHATS_MAX))
-
-/// \brief max number of mouse buttons
-#define MOUSEBUTTONS_MAX 8 // 8 bit of BYTE and DIMOFS_BUTTON7
-/// \brief max number of muse button events
-#define MOUSEBUTTONS_MIN min((MOUSEBUTTONS),(MOUSEBUTTONS_MAX))
-
-// ==================
-// DIRECT INPUT STUFF
-// ==================
-BOOL bDX0300; // if true, we created a DirectInput 0x0300 version
-static LPDIRECTINPUT lpDI = NULL;
-static LPDIRECTINPUTDEVICE lpDIK = NULL;   // Keyboard
-static LPDIRECTINPUTDEVICE lpDIM = NULL;   // mice
-static LPDIRECTINPUTDEVICE lpDIJ = NULL;   // joystick 1P
-static LPDIRECTINPUTEFFECT lpDIE[NumberofForces];   // joystick 1Es
-static LPDIRECTINPUTDEVICE2 lpDIJA = NULL; // joystick 1I
-static LPDIRECTINPUTDEVICE lpDIJ2 = NULL;  // joystick 2P
-static LPDIRECTINPUTEFFECT lpDIE2[NumberofForces];  // joystick 1Es
-static LPDIRECTINPUTDEVICE2 lpDIJ2A = NULL;// joystick 2I
-
-// Do not execute cleanup code more than once. See Shutdown_xxx() routines.
-UINT8 graphics_started = 0;
-UINT8 keyboard_started = 0;
-UINT8 sound_started = 0;
-static boolean mouse_enabled = false;
-static boolean joystick_detected = false;
-static boolean joystick2_detected = false;
-
-static void I_ShutdownKeyboard(void);
-static void I_GetKeyboardEvents(void);
-static void I_ShutdownJoystick(void);
-static void I_ShutdownJoystick2 (void);
-
-static boolean entering_con_command = false;
-
-//
-// Why would this be system specific?? hmmmm....
-//
-// it is for virtual reality system, next incoming feature :)
-static ticcmd_t emptycmd;
-ticcmd_t *I_BaseTiccmd(void)
-{
-	return &emptycmd;
-}
-
-static ticcmd_t emptycmd2;
-ticcmd_t *I_BaseTiccmd2(void)
-{
-	return &emptycmd2;
-}
-
-// Allocates the base zone memory,
-// this function returns a valid pointer and size,
-// else it should interrupt the program immediately.
-//
-// now checks if mem could be allocated, this is still
-// prehistoric... there's a lot to do here: memory locking, detection
-// of win95 etc...
-//
-
-BOOL win9x;
-
-/**	\brief WinNT system platform
-*/
-static BOOL winnt;
-
-static void I_DetectWin9x(void)
-{
-	OSVERSIONINFO osvi;
-
-	osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
-	GetVersionEx(&osvi);
-
-	winnt = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT);
-	// 95 or 98 what the hell
-	win9x = true;
-}
-
-// return free and total memory in the system
-UINT32 I_GetFreeMem(UINT32* total)
-{
-	MEMORYSTATUS info;
-
-	info.dwLength = sizeof (MEMORYSTATUS);
-	GlobalMemoryStatus(&info);
-	if (total)
-		*total = (ULONG)info.dwTotalPhys;
-	return (ULONG)info.dwAvailPhys;
-}
-
-// ---------
-// I_Profile
-// Two little functions to profile our code using the high resolution timer
-// ---------
-static LARGE_INTEGER ProfileCount;
-void I_BeginProfile(void)
-{
-	if (!QueryPerformanceCounter(&ProfileCount))
-		I_Error("I_BeginProfile failed"); // can't profile without the high res timer
-}
-
-// we're supposed to use this to measure very small amounts of time,
-// that's why we return a DWORD and not a 64bit value
-DWORD I_EndProfile(void)
-{
-	LARGE_INTEGER CurrTime;
-	DWORD ret;
-	if (!QueryPerformanceCounter (&CurrTime))
-		I_Error("I_EndProfile failed");
-	if (CurrTime.QuadPart - ProfileCount.QuadPart > (LONGLONG)0xFFFFFFFFUL)
-		I_Error("I_EndProfile overflow");
-	ret = (DWORD)(CurrTime.QuadPart - ProfileCount.QuadPart);
-	// we can call I_EndProfile() several time, I_BeginProfile() need be called just once
-	ProfileCount = CurrTime;
-
-	return ret;
-}
-
-// ---------
-// I_GetTime
-// Use the High Resolution Timer if available,
-// else use the multimedia timer which has 1 millisecond precision on Windowz 95,
-// but lower precision on Windows NT
-// ---------
-static long hacktics = 0; // used locally for keyboard repeat keys
-static DWORD starttickcount = 0; // hack for win2k time bug
-
-tic_t I_GetTime(void)
-{
-	tic_t newtics = 0;
-
-	if (!starttickcount) // high precision timer
-	{
-		LARGE_INTEGER currtime; // use only LowPart if high resolution counter is not available
-		static LARGE_INTEGER basetime = {{0, 0}};
-
-		// use this if High Resolution timer is found
-		static LARGE_INTEGER frequency;
-
-		if (!basetime.LowPart)
-		{
-			if (!QueryPerformanceFrequency(&frequency))
-				frequency.QuadPart = 0;
-			else
-				QueryPerformanceCounter(&basetime);
-		}
-
-		if (frequency.LowPart && QueryPerformanceCounter(&currtime))
-		{
-			newtics = (int)((currtime.QuadPart - basetime.QuadPart) * TICRATE
-				/ frequency.QuadPart);
-		}
-		else
-		{
-			currtime.LowPart = timeGetTime();
-			if (!basetime.LowPart)
-				basetime.LowPart = currtime.LowPart;
-			newtics = ((currtime.LowPart - basetime.LowPart)/(1000/TICRATE));
-		}
-	}
-	else
-		newtics = (GetTickCount() - starttickcount)/(1000/TICRATE);
-
-	hacktics = newtics; // a local counter for keyboard repeat key
-	return newtics;
-}
-
-
-void I_Sleep(void)
-{
-	if (cv_sleep.value != -1)
-		Sleep(cv_sleep.value);
-}
-
-
-// should move to i_video
-void I_WaitVBL(INT32 count)
-{
-	count = 0;
-}
-
-// this is probably to activate the 'loading' disc icon
-// it should set a flag, that I_FinishUpdate uses to know
-// whether it draws a small 'loading' disc icon on the screen or not
-//
-// also it should explicitly draw the disc because the screen is
-// possibly not refreshed while loading
-//
-void I_BeginRead(void) {}
-
-// see above, end the 'loading' disc icon, set the flag false
-//
-void I_EndRead(void) {}
-
-// ===========================================================================================
-//                                                                                      EVENTS
-// ===========================================================================================
-static inline BOOL I_ReadyConsole(HANDLE ci)
-{
-	DWORD gotinput;
-	if (ci == (HANDLE)-1) return FALSE;
-	if (WaitForSingleObject(ci,0) != WAIT_OBJECT_0) return FALSE;
-	if (GetFileType(ci) != FILE_TYPE_CHAR) return FALSE;
-	return (GetNumberOfConsoleInputEvents(ci, &gotinput) && gotinput);
-}
-
-static inline VOID I_GetConsoleEvents(VOID)
-{
-	event_t ev = {0,0,0,0};
-	HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
-	HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-	CONSOLE_SCREEN_BUFFER_INFO CSBI;
-	INPUT_RECORD input;
-	DWORD t;
-
-	while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t)
-	{
-		memset(&ev,0x00,sizeof (ev));
-		switch (input.EventType)
-		{
-			case KEY_EVENT:
-				if (input.Event.KeyEvent.bKeyDown)
-				{
-					ev.type = ev_console;
-					entering_con_command = true;
-					switch (input.Event.KeyEvent.wVirtualKeyCode)
-					{
-						case VK_ESCAPE:
-						case VK_TAB:
-							ev.data1 = KEY_NULL;
-							break;
-						case VK_SHIFT:
-							ev.data1 = KEY_SHIFT;
-							break;
-						case VK_RETURN:
-							entering_con_command = false;
-							// Fall through.
-						default:
-							ev.data1 = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char
-					}
-					if (co != (HANDLE)-1 && GetFileType(co) == FILE_TYPE_CHAR)
-					{
-						if (ev.data1 && ev.data1 != KEY_SHIFT)
-						{
-#ifdef _UNICODE
-							WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL);
-#else
-							WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1, &t, NULL);
-#endif
-						}
-						if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK
-							&& GetConsoleScreenBufferInfo(co,&CSBI))
-						{
-							WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t);
-						}
-					}
-				}
-				else
-				{
-					ev.type = ev_keyup;
-					switch (input.Event.KeyEvent.wVirtualKeyCode)
-					{
-						case VK_SHIFT:
-							ev.data1 = KEY_SHIFT;
-							break;
-						default:
-							break;
-					}
-				}
-				if (ev.data1) D_PostEvent(&ev);
-				break;
-			case MOUSE_EVENT:
-			case WINDOW_BUFFER_SIZE_EVENT:
-			case MENU_EVENT:
-			case FOCUS_EVENT:
-				break;
-		}
-	}
-}
-
-// ----------
-// I_GetEvent
-// Post new events for all sorts of user-input
-// ----------
-void I_GetEvent(void)
-{
-	I_GetConsoleEvents();
-	I_GetKeyboardEvents();
-	I_GetMouseEvents();
-	I_GetJoystickEvents();
-	I_GetJoystick2Events();
-}
-
-// ----------
-// I_OsPolling
-// ----------
-void I_OsPolling(void)
-{
-	MSG msg;
-	HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
-
-	// we need to dispatch messages to the window
-	// so the window procedure can respond to messages and PostEvent() for keys
-	// during D_SRB2Main startup.
-	// this one replaces the main loop of windows since I_OsPolling is called in the main loop
-	do
-	{
-		while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
-		{
-			if (GetMessage(&msg, NULL, 0, 0))
-			{
-				TranslateMessage(&msg);
-				DispatchMessage(&msg);
-			}
-			else // winspec : this is quit message
-				I_Quit();
-		}
-		if (!appActive && !netgame && !I_ReadyConsole(ci))
-			WaitMessage();
-	} while (!appActive && !netgame && !I_ReadyConsole(ci));
-
-	// this is called by the network synchronization,
-	// check keys and allow escaping
-	I_GetEvent();
-
-	// reset "emulated keys"
-	gamekeydown[KEY_MOUSEWHEELUP] = 0;
-	gamekeydown[KEY_MOUSEWHEELDOWN] = 0;
-}
-
-// ===========================================================================================
-//                                                                              TIMER
-// ===========================================================================================
-
-static void I_ShutdownTimer(void)
-{
-	timeEndPeriod(1);
-}
-
-//
-// Installs the timer interrupt handler with timer speed as TICRATE.
-//
-#define TIMER_ID 1
-#define TIMER_RATE (1000/TICRATE)
-void I_StartupTimer(void)
-{
-	// for win2k time bug
-	if (M_CheckParm("-gettickcount"))
-	{
-		starttickcount = GetTickCount();
-		CONS_Printf("Using GetTickCount()\n");
-	}
-	timeBeginPeriod(1);
-	I_AddExitFunc(I_ShutdownTimer);
-}
-
-// ===========================================================================================
-//                                                                   EXIT CODE, ERROR HANDLING
-// ===========================================================================================
-
-static int errorcount = 0; // phuck recursive errors
-static int shutdowning = false;
-
-//
-// Used to trap various signals, to make sure things get shut down cleanly.
-//
-#ifdef NDEBUG
-static void signal_handler(int num)
-{
-	//static char msg[] = "oh no! back to reality!\r\n";
-	const char *sigmsg;
-	char sigdef[64];
-
-	D_QuitNetGame(); // Fix server freezes
-	I_ShutdownSystem();
-
-	switch (num)
-	{
-		case SIGINT:
-			sigmsg = "interrupt";
-			break;
-		case SIGILL:
-			sigmsg = "illegal instruction - invalid function image";
-			break;
-		case SIGFPE:
-			sigmsg = "floating point exception";
-			break;
-		case SIGSEGV:
-			sigmsg = "segment violation";
-			break;
-		case SIGTERM:
-			sigmsg = "software termination signal from kill";
-			break;
-		case SIGBREAK:
-			sigmsg = "Ctrl-Break sequence";
-			break;
-		case SIGABRT:
-			sigmsg = "abnormal termination triggered by abort call";
-			break;
-		default:
-			sprintf(sigdef, "signal number %d", num);
-			sigmsg = sigdef;
-	}
-
-#ifdef LOGMESSAGES
-	if (logstream != INVALID_HANDLE_VALUE)
-	{
-		I_OutputMsg("signal_handler() error: %s\r\n", sigmsg);
-		CloseHandle(logstream);
-		logstream = INVALID_HANDLE_VALUE;
-	}
-#endif
-
-	MessageBoxA(hWndMain, va("signal_handler(): %s", sigmsg), "SRB2 error", MB_OK|MB_ICONERROR);
-
-	signal(num, SIG_DFL); // default signal action
-	raise(num);
-}
-#endif
-
-//
-// put an error message (with format) on stderr
-//
-void I_OutputMsg(const char *fmt, ...)
-{
-	HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-	DWORD bytesWritten;
-	va_list argptr;
-	char txt[8192];
-
-	va_start(argptr,fmt);
-	vsprintf(txt, fmt, argptr);
-	va_end(argptr);
-
-	OutputDebugStringA(txt);
-	if (co != (HANDLE)-1)
-	{
-		if (GetFileType(co) == FILE_TYPE_CHAR)
-		{
-			static COORD coordNextWrite = {0,0};
-			char *oldLines = NULL;
-			DWORD oldLength = 0;
-			CONSOLE_SCREEN_BUFFER_INFO csbi;
-
-			// Save the lines that we're going to obliterate.
-			GetConsoleScreenBufferInfo(co, &csbi);
-			oldLength = csbi.dwSize.X * (csbi.dwCursorPosition.Y - coordNextWrite.Y) + csbi.dwCursorPosition.X - coordNextWrite.X;
-
-			if(oldLength > 0)
-			{
-				char *blank = malloc(oldLength);
-				oldLines = malloc(oldLength);
-				if(!oldLines || !blank) return;
-
-				ReadConsoleOutputCharacterA(co, oldLines, oldLength, coordNextWrite, &bytesWritten);
-
-				// Move to where we what to print - which is where we would've been,
-				// had console input not been in the way,
-				SetConsoleCursorPosition(co, coordNextWrite);
-
-				// Blank out.
-				memset(blank, ' ', oldLength);
-				WriteConsoleA(co, blank, oldLength, &bytesWritten, NULL);
-				free(blank);
-
-				// And back to where we want to print again.
-				SetConsoleCursorPosition(co, coordNextWrite);
-			}
-
-			// Actually write the string now!
-			WriteConsoleA(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL);
-
-			// Next time, output where we left off.
-			GetConsoleScreenBufferInfo(co, &csbi);
-			coordNextWrite = csbi.dwCursorPosition;
-
-			// Restore what was overwritten.
-			if(oldLines && entering_con_command)
-			{
-				WriteConsoleA(co, oldLines, oldLength, &bytesWritten, NULL);
-				free(oldLines);
-			}
-		}
-		else	// Redirected to a file.
-			WriteFile(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL);
-	}
-
-#ifdef LOGMESSAGES
-	if (logstream != (HANDLE)-1)
-		WriteFile (logstream, txt, (DWORD)strlen(txt), &bytesWritten, NULL);
-#endif
-}
-
-// display error messy after shutdowngfx
-//
-void I_Error(const char *error, ...)
-{
-	va_list argptr;
-	char txt[8192];
-
-	// added 11-2-98 recursive error detecting
-	if (shutdowning)
-	{
-		errorcount++;
-		// try to shutdown each subsystem separately
-		if (errorcount == 5)
-			I_ShutdownGraphics();
-		if (errorcount == 6)
-			I_ShutdownSystem();
-		if (errorcount == 7)
-		{
-			M_SaveConfig(NULL);
-			G_SaveGameData();
-		}
-		if (errorcount > 20)
-		{
-			// Don't print garbage
-			va_start(argptr,error);
-			vsprintf(txt, error, argptr);
-			va_end(argptr);
-
-			MessageBoxA(hWndMain, txt, "SRB2 Recursive Error", MB_OK|MB_ICONERROR);
-			exit(-1); // recursive errors detected
-		}
-	}
-	shutdowning = true;
-
-	// put message to stderr
-	va_start(argptr, error);
-	wvsprintfA(txt, error, argptr);
-	va_end(argptr);
-
-	CONS_Printf("I_Error(): %s\n", txt);
-
-	// uncomment this line to print to stderr as well
-	//wsprintf(stderr, "I_Error(): %s\n", txt);
-
-	// saving one time is enough!
-	if (!errorcount)
-	{
-		M_SaveConfig(NULL); // save game config, cvars..
-		G_SaveGameData();
-	}
-
-	// save demo, could be useful for debug
-	// NOTE: demos are normally not saved here.
-	if (demorecording)
-		G_CheckDemoStatus();
-
-	D_QuitNetGame();
-
-	// shutdown everything that was started
-	I_ShutdownSystem();
-
-#ifdef LOGMESSAGES
-	if (logstream != INVALID_HANDLE_VALUE)
-	{
-		CloseHandle(logstream);
-		logstream = INVALID_HANDLE_VALUE;
-	}
-#endif
-
-	MessageBoxA(hWndMain, txt, "SRB2 Error", MB_OK|MB_ICONERROR);
-
-	exit(-1);
-}
-
-static inline VOID ShowEndTxt(HANDLE co)
-{
-	int i;
-	UINT16 j, att = 0;
-	int nlflag = 1;
-	CONSOLE_SCREEN_BUFFER_INFO backupcon;
-	COORD resizewin = {80,-1};
-	DWORD bytesWritten;
-	CHAR let = 0;
-	UINT16 *text;
-	void *data;
-	int endoomnum = W_GetNumForName("ENDOOM");
-	//HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
-
-	/* get the lump with the text */
-	data = text = W_CacheLumpNum(endoomnum, PU_CACHE);
-
-	backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case
-	GetConsoleScreenBufferInfo(co, &backupcon); //Store old state
-	resizewin.Y = backupcon.dwSize.Y;
-	if (backupcon.dwSize.X < resizewin.X)
-		SetConsoleScreenBufferSize(co, resizewin);
-
-	for (i = 1; i <= 80*25; i++) // print 80x25 text and deal with the attributes too
-	{
-		j = (UINT16)(*text >> 8); // attribute first
-		if (j != att) // attribute changed?
-		{
-			att = j; // save current attribute
-			SetConsoleTextAttribute(co, j); //set fg and bg color for buffer
-		}
-
-		let = (char)(*text++ & 0xff); // now the text
-		WriteConsoleA(co, &let, 1, &bytesWritten, NULL);
-
-		if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl?
-		{
-			att = backupcon.wAttributes;
-			SetConsoleTextAttribute(co, att); // all attributes off
-			WriteConsoleA(co, "\n", 1, &bytesWritten, NULL);
-		}
-	}
-	SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off
-	//if (nlflag)
-	//	WriteConsoleA(co, "\n", 1, &bytesWritten, NULL);
-
-	getchar(); //pause!
-
-	Z_Free(data);
-}
-
-
-//
-// I_Quit: shutdown everything cleanly, in reverse order of Startup.
-//
-void I_Quit(void)
-{
-	HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE);
-	// when recording a demo, should exit using 'q',
-	// but sometimes we forget and use Alt+F4, so save here too.
-	if (demorecording)
-		G_CheckDemoStatus();
-
-	M_SaveConfig(NULL); // save game config, cvars..
-	G_SaveGameData();
-
-	// maybe it needs that the ticcount continues,
-	// or something else that will be finished by I_ShutdownSystem(),
-	// so do it before.
-	D_QuitNetGame();
-
-	// shutdown everything that was started
-	I_ShutdownSystem();
-
-	if (shutdowning || errorcount)
-		I_Error("Error detected (%d)", errorcount);
-
-#ifdef LOGMESSAGES
-	if (logstream != INVALID_HANDLE_VALUE)
-	{
-		I_OutputMsg("I_Quit(): end of logstream.\r\n");
-		CloseHandle(logstream);
-		logstream = INVALID_HANDLE_VALUE;
-	}
-#endif
-	if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM")!=-1
-		&& co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR)
-	{
-		printf("\r");
-		ShowEndTxt(co);
-	}
-	fflush(stderr);
-	exit(0);
-}
-
-// --------------------------------------------------------------------------
-// I_ShowLastError
-// Displays a GetLastError() error message in a MessageBox
-// --------------------------------------------------------------------------
-void I_GetLastErrorMsgBox(void)
-{
-	LPSTR lpMsgBuf = NULL;
-
-	FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
-		NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-		lpMsgBuf, 0, NULL);
-
-	// Display the string.
-	MessageBoxA(NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION);
-
-	// put it in console too and log if any
-	CONS_Printf("Error: %s\n", lpMsgBuf);
-
-	// Free the buffer.
-	LocalFree(lpMsgBuf);
-}
-
-// ===========================================================================================
-// CLEAN STARTUP & SHUTDOWN HANDLING, JUST CLOSE EVERYTHING YOU OPENED.
-// ===========================================================================================
-//
-//
-static quitfuncptr quit_funcs[MAX_QUIT_FUNCS] =
-{
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-// Adds a function to the list that need to be called by I_SystemShutdown().
-//
-void I_AddExitFunc(void (*func)())
-{
-	int c;
-
-	for (c = 0; c < MAX_QUIT_FUNCS; c++)
-	{
-		if (!quit_funcs[c])
-		{
-			quit_funcs[c] = func;
-			break;
-		}
-	}
-}
-
-// Removes a function from the list that need to be called by I_SystemShutdown().
-//
-void I_RemoveExitFunc(void (*func)())
-{
-	int c;
-
-	for (c = 0; c < MAX_QUIT_FUNCS; c++)
-	{
-		if (quit_funcs[c] == func)
-		{
-			while (c < MAX_QUIT_FUNCS - 1)
-			{
-				quit_funcs[c] = quit_funcs[c+1];
-				c++;
-			}
-			quit_funcs[MAX_QUIT_FUNCS-1] = NULL;
-			break;
-		}
-	}
-}
-
-// ===========================================================================================
-// DIRECT INPUT HELPER CODE
-// ===========================================================================================
-
-// Create a DirectInputDevice interface,
-// create a DirectInputDevice2 interface if possible
-static void CreateDevice2(LPDIRECTINPUT di, REFGUID pguid, LPDIRECTINPUTDEVICE* lpDEV,
-                          LPDIRECTINPUTDEVICE2* lpDEV2)
-{
-	HRESULT hr, hr2;
-	LPDIRECTINPUTDEVICE lpdid1;
-	LPDIRECTINPUTDEVICE2 lpdid2 = NULL;
-
-	hr = IDirectInput_CreateDevice(di, pguid, &lpdid1, NULL);
-
-	if (SUCCEEDED(hr))
-	{
-		// get Device2 but only if we are not in DirectInput version 3
-		if (!bDX0300 && lpDEV2)
-		{
-			LPDIRECTINPUTDEVICE2 *rp = &lpdid2;
-			LPVOID *tp  = (LPVOID *)rp;
-			hr2 = IDirectInputDevice_QueryInterface(lpdid1, &IID_IDirectInputDevice2, tp);
-			if (FAILED(hr2))
-			{
-				CONS_Printf("\2Could not create IDirectInput device 2");
-				lpdid2 = NULL;
-			}
-		}
-	}
-	else
-		I_Error("Could not create IDirectInput device");
-
-	*lpDEV = lpdid1;
-	if (lpDEV2) // only if we requested it
-		*lpDEV2 = lpdid2;
-}
-
-// ===========================================================================================
-//                                                                          DIRECT INPUT MOUSE
-// ===========================================================================================
-
-#define DI_MOUSE_BUFFERSIZE 16 // number of data elements in mouse buffer
-
-//
-// Initialise the mouse.
-//
-static void I_ShutdownMouse(void);
-
-void I_StartupMouse(void)
-{
-	// this gets called when cv_usemouse is initted
-	// for the win32 version, we want to startup the mouse later
-}
-
-static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE;
-
-static void I_ShutdownMouse2(void)
-{
-	if (mouse2filehandle != INVALID_HANDLE_VALUE)
-	{
-		event_t event;
-		int i;
-
-		SetCommMask(mouse2filehandle, 0);
-
-		EscapeCommFunction(mouse2filehandle, CLRDTR);
-		EscapeCommFunction(mouse2filehandle, CLRRTS);
-
-		PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR);
-
-		CloseHandle(mouse2filehandle);
-
-		// emulate the up of all mouse buttons
-		for (i = 0; i < MOUSEBUTTONS; i++)
-		{
-			event.type = ev_keyup;
-			event.data1 = KEY_2MOUSE1 + i;
-			D_PostEvent(&event);
-		}
-
-		mouse2filehandle = INVALID_HANDLE_VALUE;
-	}
-}
-
-#define MOUSECOMBUFFERSIZE 256
-static int handlermouse2x, handlermouse2y, handlermouse2buttons;
-
-static void I_PoolMouse2(void)
-{
-	UINT8 buffer[MOUSECOMBUFFERSIZE];
-	COMSTAT ComStat;
-	DWORD dwErrorFlags, dwLength;
-	char dx, dy;
-
-	static int bytenum;
-	static UINT8 combytes[4];
-	DWORD i;
-
-	ClearCommError(mouse2filehandle, &dwErrorFlags, &ComStat);
-	dwLength = min(MOUSECOMBUFFERSIZE, ComStat.cbInQue);
-
-	if (dwLength > 0)
-	{
-		if (!ReadFile(mouse2filehandle, buffer, dwLength, &dwLength, NULL))
-		{
-			CONS_Printf("\2Read Error on secondary mouse port\n");
-			return;
-		}
-
-		// parse the mouse packets
-		for (i = 0; i < dwLength; i++)
-		{
-			if ((buffer[i] & 64) == 64)
-				bytenum = 0;
-
-			if (bytenum < 4)
-				combytes[bytenum] = buffer[i];
-			bytenum++;
-
-			if (bytenum == 1)
-			{
-				handlermouse2buttons &= ~3;
-				handlermouse2buttons |= ((combytes[0] & (32+16)) >>4);
-			}
-			else if (bytenum == 3)
-			{
-				dx = (char)((combytes[0] &  3) << 6);
-				dy = (char)((combytes[0] & 12) << 4);
-				dx = (char)(dx + combytes[1]);
-				dy = (char)(dy + combytes[2]);
-				handlermouse2x += dx;
-				handlermouse2y += dy;
-			}
-			else if (bytenum == 4) // fourth byte (logitech mouses)
-			{
-				if (buffer[i] & 32)
-					handlermouse2buttons |= 4;
-				else
-					handlermouse2buttons &= ~4;
-			}
-		}
-	}
-}
-
-// secondary mouse doesn't use DirectX, therefore forget all about grabbing, acquire, etc.
-void I_StartupMouse2(void)
-{
-	DCB dcb;
-
-	if (mouse2filehandle != INVALID_HANDLE_VALUE)
-		I_ShutdownMouse2();
-
-	if (!cv_usemouse2.value)
-		return;
-
-	if (mouse2filehandle != INVALID_HANDLE_VALUE)
-	{
-		// COM file handle
-		mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ|GENERIC_WRITE,
-		                              0, // exclusive access
-		                              NULL, // no security attrs
-		                              OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-		if (mouse2filehandle == INVALID_HANDLE_VALUE)
-		{
-			int e = GetLastError();
-			if (e == 5)
-				CONS_Printf("\2Can't open %s: Access denied\n"
-					"The port is probably already used by another device (mouse, modem,...)\n",
-						cv_mouse2port.string);
-			else
-				CONS_Printf("\2Can't open %s: error %d\n", cv_mouse2port.string, e);
-			return;
-		}
-	}
-
-	// buffers
-	SetupComm(mouse2filehandle, MOUSECOMBUFFERSIZE, MOUSECOMBUFFERSIZE);
-
-	// purge buffers
-	PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR);
-
-	// setup port to 1200 7N1
-	dcb.DCBlength = sizeof (DCB);
-
-	GetCommState(mouse2filehandle, &dcb);
-
-	dcb.BaudRate = CBR_1200;
-	dcb.ByteSize = 7;
-	dcb.Parity = NOPARITY;
-	dcb.StopBits = ONESTOPBIT;
-
-	dcb.fDtrControl = DTR_CONTROL_ENABLE;
-	dcb.fRtsControl = RTS_CONTROL_ENABLE;
-
-	dcb.fBinary = dcb.fParity = TRUE;
-
-	SetCommState(mouse2filehandle, &dcb);
-
-	I_AddExitFunc(I_ShutdownMouse2);
-}
-
-#define MAX_MOUSE_BTNS 5
-static int center_x, center_y;
-static int old_mparms[3], new_mparms[3] = {0, 0, 1};
-static boolean restore_mouse = FALSE;
-static int old_mouse_state = 0;
-unsigned int MSHWheelMessage = 0;
-
-static void I_DoStartupSysMouse(void)
-{
-	boolean valid;
-	RECT w_rect;
-
-	valid = SystemParametersInfo(SPI_GETMOUSE, 0, old_mparms, 0);
-	if (valid)
-	{
-		new_mparms[2] = old_mparms[2];
-		restore_mouse = SystemParametersInfo(SPI_SETMOUSE, 0, new_mparms, 0);
-	}
-
-	if (bAppFullScreen)
-	{
-		w_rect.top = 0;
-		w_rect.left = 0;
-	}
-	else
-	{
-		w_rect.top = windowPosY;
-		w_rect.left = windowPosX;
-	}
-
-	w_rect.bottom = w_rect.top + VIDHEIGHT;
-	w_rect.right = w_rect.left + VIDWIDTH;
-	center_x = w_rect.left + (VIDWIDTH >> 1);
-	center_y = w_rect.top + (VIDHEIGHT >> 1);
-	SetCursor(NULL);
-	SetCursorPos(center_x, center_y);
-	SetCapture(hWndMain);
-	ClipCursor(&w_rect);
-}
-
-static void I_ShutdownSysMouse(void)
-{
-	if (restore_mouse)
-		SystemParametersInfo(SPI_SETMOUSE, 0, old_mparms, 0);
-	ClipCursor(NULL);
-	ReleaseCapture();
-}
-
-void I_RestartSysMouse(void)
-{
-	if (nodinput)
-	{
-		I_ShutdownSysMouse();
-		I_DoStartupSysMouse();
-	}
-}
-
-void I_GetSysMouseEvents(int mouse_state)
-{
-	int i;
-	event_t event;
-	int xmickeys = 0, ymickeys = 0;
-	POINT c_pos;
-
-	for (i = 0; i < MAX_MOUSE_BTNS; i++)
-	{
-		// check if button pressed
-		if ((mouse_state & (1 << i)) && !(old_mouse_state & (1 << i)))
-		{
-			event.type = ev_keydown;
-			event.data1 = KEY_MOUSE1 + i;
-			D_PostEvent(&event);
-		}
-		// check if button released
-		if (!(mouse_state & (1 << i)) && (old_mouse_state & (1 << i)))
-		{
-			event.type = ev_keyup;
-			event.data1 = KEY_MOUSE1 + i;
-			D_PostEvent(&event);
-		}
-	}
-	old_mouse_state = mouse_state;
-
-	// proceed mouse movements
-	GetCursorPos(&c_pos);
-	xmickeys = c_pos.x - center_x;
-	ymickeys = c_pos.y - center_y;
-
-	if (xmickeys || ymickeys)
-	{
-		event.type  = ev_mouse;
-		event.data1 = 0;
-		event.data2 = xmickeys;
-		event.data3 = -ymickeys;
-		D_PostEvent(&event);
-		SetCursorPos(center_x, center_y);
-	}
-}
-
-// This is called just before entering the main game loop,
-// when we are going fullscreen and the loading screen has finished.
-void I_DoStartupMouse(void)
-{
-	DIPROPDWORD dip;
-
-	// mouse detection may be skipped by setting usemouse false
-	if (!cv_usemouse.value || M_CheckParm("-nomouse"))
-	{
-		mouse_enabled = false;
-		return;
-	}
-
-	if (nodinput)
-	{
-		CONS_Printf("\tMouse will not use DirectInput.\n");
-		// System mouse input will be initiated by VID_SetMode
-		I_AddExitFunc(I_ShutdownMouse);
-
-		MSHWheelMessage = RegisterWindowMessage(MSH_MOUSEWHEEL);
-	}
-	else if (!lpDIM) // acquire the mouse only once
-	{
-		CreateDevice2(lpDI, &GUID_SysMouse, &lpDIM, NULL);
-
-		if (lpDIM)
-		{
-			if (FAILED(IDirectInputDevice_SetDataFormat(lpDIM, &c_dfDIMouse)))
-				I_Error("Couldn't set mouse data format");
-
-			// create buffer for buffered data
-			dip.diph.dwSize = sizeof (dip);
-			dip.diph.dwHeaderSize = sizeof (dip.diph);
-			dip.diph.dwObj = 0;
-			dip.diph.dwHow = DIPH_DEVICE;
-			dip.dwData = DI_MOUSE_BUFFERSIZE;
-			if (FAILED(IDirectInputDevice_SetProperty(lpDIM, DIPROP_BUFFERSIZE, &dip.diph)))
-				I_Error("Couldn't set mouse buffer size");
-
-			if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIM, hWndMain,
-				DISCL_EXCLUSIVE|DISCL_FOREGROUND)))
-			{
-				I_Error("Couldn't set mouse coop level");
-			}
-			I_AddExitFunc(I_ShutdownMouse);
-		}
-		else
-			I_Error("Couldn't create mouse input");
-	}
-
-	// if re-enabled while running, just set mouse_enabled true again,
-	// do not acquire the mouse more than once
-	mouse_enabled = true;
-}
-
-//
-// Shutdown Mouse DirectInput device
-//
-static void I_ShutdownMouse(void)
-{
-	int i;
-	event_t event;
-
-	CONS_Printf("I_ShutdownMouse()\n");
-
-	if (lpDIM)
-	{
-		IDirectInputDevice_Unacquire(lpDIM);
-		IDirectInputDevice_Release(lpDIM);
-		lpDIM = NULL;
-	}
-
-	// emulate the up of all mouse buttons
-	for (i = 0; i < MOUSEBUTTONS; i++)
-	{
-		event.type = ev_keyup;
-		event.data1 = KEY_MOUSE1 + i;
-		D_PostEvent(&event);
-	}
-	if (nodinput)
-		I_ShutdownSysMouse();
-
-	mouse_enabled = false;
-}
-
-//
-// Get buffered data from the mouse
-//
-void I_GetMouseEvents(void)
-{
-	DIDEVICEOBJECTDATA rgdod[DI_MOUSE_BUFFERSIZE];
-	DWORD dwItems, d;
-	HRESULT hr;
-
-	event_t event;
-	int xmickeys, ymickeys;
-
-	if (mouse2filehandle != INVALID_HANDLE_VALUE)
-	{
-		//mouse movement
-		static UINT8 lastbuttons2 = 0;
-
-		I_PoolMouse2();
-		// post key event for buttons
-		if (handlermouse2buttons != lastbuttons2)
-		{
-			int i, j = 1, k;
-			k = handlermouse2buttons ^ lastbuttons2; // only changed bit to 1
-			lastbuttons2 = (UINT8)handlermouse2buttons;
-
-			for (i = 0; i < MOUSEBUTTONS; i++, j <<= 1)
-				if (k & j)
-				{
-					if (handlermouse2buttons & j)
-						event.type = ev_keydown;
-					else
-						event.type = ev_keyup;
-					event.data1 = KEY_2MOUSE1 + i;
-					D_PostEvent(&event);
-				}
-		}
-
-		if (handlermouse2x || handlermouse2y)
-		{
-			event.type = ev_mouse2;
-			event.data1 = 0;
-			event.data2 = handlermouse2x<<1;
-			event.data3 = -handlermouse2y<<1;
-			handlermouse2x = 0;
-			handlermouse2y = 0;
-
-			D_PostEvent(&event);
-		}
-	}
-
-	if (!mouse_enabled || nodinput)
-		return;
-
-getBufferedData:
-	dwItems = DI_MOUSE_BUFFERSIZE;
-	hr = IDirectInputDevice_GetDeviceData(lpDIM, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0);
-
-	// If data stream was interrupted, reacquire the device and try again.
-	if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-	{
-		hr = IDirectInputDevice_Acquire(lpDIM);
-		if (SUCCEEDED(hr))
-			goto getBufferedData;
-	}
-
-	// We got buffered input, act on it
-	if (SUCCEEDED(hr))
-	{
-		xmickeys = ymickeys = 0;
-
-		// dwItems contains number of elements read (could be 0)
-		for (d = 0; d < dwItems; d++)
-		{
-			if (rgdod[d].dwOfs >= DIMOFS_BUTTON0 &&
-				rgdod[d].dwOfs <  DIMOFS_BUTTON0 + MOUSEBUTTONS)
-			{
-				if (rgdod[d].dwData & 0x80) // Button down
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup; // Button up
-
-				event.data1 = rgdod[d].dwOfs - DIMOFS_BUTTON0 + KEY_MOUSE1;
-				D_PostEvent(&event);
-			}
-			else if (rgdod[d].dwOfs == DIMOFS_X)
-				xmickeys += rgdod[d].dwData;
-			else if (rgdod[d].dwOfs == DIMOFS_Y)
-				ymickeys += rgdod[d].dwData;
-
-			else if (rgdod[d].dwOfs == DIMOFS_Z)
-			{
-				// z-axes the wheel
-				if ((int)rgdod[d].dwData > 0)
-					event.data1 = KEY_MOUSEWHEELUP;
-				else
-					event.data1 = KEY_MOUSEWHEELDOWN;
-				event.type = ev_keydown;
-				D_PostEvent(&event);
-			}
-
-		}
-
-		if (xmickeys || ymickeys)
-		{
-			event.type = ev_mouse;
-			event.data1 = 0;
-			event.data2 = xmickeys;
-			event.data3 = -ymickeys;
-			D_PostEvent(&event);
-		}
-	}
-}
-
-// ===========================================================================================
-//                                                                       DIRECT INPUT JOYSTICK
-// ===========================================================================================
-
-struct DIJoyInfo_s
-{
-	BYTE X,Y,Z,Rx,Ry,Rz,U,V;
-	LONG ForceAxises;
-};
-typedef struct DIJoyInfo_s DIJoyInfo_t;
-
-// private info
-	static BYTE iJoyNum;        // used by enumeration
-	static DIJoyInfo_t JoyInfo;
-	static BYTE iJoy2Num;
-	static DIJoyInfo_t JoyInfo2;
-
-//-----------------------------------------------------------------------------
-// Name: EnumAxesCallback()
-// Desc: Callback function for enumerating the axes on a joystick and counting
-//       each force feedback enabled axis
-//-----------------------------------------------------------------------------
-static BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCE* pdidoi,
-                                VOID* pContext)
-{
-	DWORD* pdwNumForceFeedbackAxis = (DWORD*) pContext;
-
-	if ((pdidoi->dwFlags & DIDOI_FFACTUATOR) != 0)
-		(*pdwNumForceFeedbackAxis)++;
-
-	return DIENUM_CONTINUE;
-}
-
-
-static HRESULT SetupForceTacile(LPDIRECTINPUTDEVICE2 DJI, LPDIRECTINPUTEFFECT *DJE, DWORD FFAXIS, FFType EffectType,REFGUID EffectGUID)
-{
-	HRESULT hr;
-	DIEFFECT eff;
-	DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y };
-	LONG rglDirection[2] = { 0, 0 };
-	DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude
-	DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd;
-	DIPERIODIC pf = {0,0,0,0};
-	ZeroMemory(&eff, sizeof (eff));
-	if (FFAXIS > 2)
-		FFAXIS = 2; //up to 2 FFAXIS
-	eff.dwSize                  = sizeof (DIEFFECT);
-	eff.dwFlags                 = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets
-	eff.dwDuration              = INFINITE;
-	eff.dwSamplePeriod          = 0;
-	eff.dwGain                  = DI_FFNOMINALMAX;
-	eff.dwTriggerButton         = DIEB_NOTRIGGER;
-	eff.dwTriggerRepeatInterval = 0;
-	eff.cAxes                   = FFAXIS;
-	eff.rgdwAxes                = rgdwAxes;
-	eff.rglDirection            = rglDirection;
-	eff.lpEnvelope              = NULL;
-	eff.lpvTypeSpecificParams   = NULL;
-	if (EffectType == ConstantForce)
-	{
-		eff.cbTypeSpecificParams    = sizeof (cf);
-		eff.lpvTypeSpecificParams   = &cf;
-	}
-	else if (EffectType == RampForce)
-	{
-		eff.cbTypeSpecificParams    = sizeof (rf);
-		eff.lpvTypeSpecificParams   = &rf;
-	}
-	else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType)
-	{
-		eff.cbTypeSpecificParams    = sizeof (pf);
-		eff.lpvTypeSpecificParams   = &pf;
-	}
-#if (DIRECTINPUT_VERSION >= 0x0600)
-	//eff.dwStartDelay            = 0;
-#endif
-
-	// Create the prepared effect
-	if (FAILED(hr = IDirectInputDevice2_CreateEffect(DJI, EffectGUID,
-	 &eff, DJE, NULL)))
-	{
-		return hr;
-	}
-
-	if (NULL == *DJE)
-		return E_FAIL;
-
-	return hr;
-}
-
-static BOOL CALLBACK DIEnumEffectsCallback1(LPCDIEFFECTINFO pdei, LPVOID pvRef)
-{
-	LPDIRECTINPUTEFFECT *DJE = pvRef;
-	if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE)
-	{
-		if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, ConstantForce, &pdei->guid)))
-			return DIENUM_STOP;
-	}
-	if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE)
-	{
-		if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, RampForce, &pdei->guid)))
-			return DIENUM_STOP;
-	}
-	return DIENUM_CONTINUE;
-}
-
-static BOOL CALLBACK DIEnumEffectsCallback2(LPCDIEFFECTINFO pdei, LPVOID pvRef)
-{
-	LPDIRECTINPUTEFFECT *DJE = pvRef;
-	if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE)
-	{
-		if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, ConstantForce, &pdei->guid)))
-			return DIENUM_STOP;
-	}
-	if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE)
-	{
-		if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, RampForce, &pdei->guid)))
-			return DIENUM_STOP;
-	}
-	return DIENUM_CONTINUE;
-}
-
-static REFGUID DIETable[] =
-{
-	&GUID_ConstantForce, //ConstantForce
-	&GUID_RampForce,     //RampForce
-	&GUID_Square,        //SquareForce
-	&GUID_Sine,          //SineForce
-	&GUID_Triangle,      //TriangleForce
-	&GUID_SawtoothUp,    //SawtoothUpForce
-	&GUID_SawtoothDown,  //SawtoothDownForce
-	(REFGUID)-1,         //NumberofForces
-};
-
-static HRESULT SetupAllForces(LPDIRECTINPUTDEVICE2 DJI, LPDIRECTINPUTEFFECT DJE[], DWORD FFAXIS)
-{
-	FFType ForceType = EvilForce;
-	if (DJI == lpDIJA)
-	{
-		IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[ConstantForce],DIEFT_CONSTANTFORCE);
-		IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[RampForce],DIEFT_RAMPFORCE);
-	}
-	else if (DJI == lpDIJA)
-	{
-		IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[ConstantForce],DIEFT_CONSTANTFORCE);
-		IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[RampForce],DIEFT_RAMPFORCE);
-	}
-	for (ForceType = SquareForce; ForceType >  NumberofForces && DIETable[ForceType] != (REFGUID)-1; ForceType++)
-		if (DIETable[ForceType])
-			SetupForceTacile(DJI,&DJE[ForceType], FFAXIS, ForceType, DIETable[ForceType]);
-	return S_OK;
-}
-
-static void LimitEffect(LPDIEFFECT eff, FFType EffectType)
-{
-	LPDICONSTANTFORCE pCF = eff->lpvTypeSpecificParams;
-	LPDIPERIODIC pDP= eff->lpvTypeSpecificParams;
-	if (eff->rglDirection)
-	{
-	}
-/*	if (eff->dwDuration != INFINITE && eff->dwDuration < 0)
-	{
-		eff->dwDuration = 0;
-	}*/
-	if (eff->dwGain != 0)
-	{
-		if (eff->dwGain > DI_FFNOMINALMAX)
-			eff->dwGain = DI_FFNOMINALMAX;
-		//else if (eff->dwGain < -DI_FFNOMINALMAX)
-		//	eff->dwGain = DI_FFNOMINALMAX;
-	}
-	if (EffectType == ConstantForce && pCF->lMagnitude)
-	{
-	}
-	else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType && pDP)
-	{
-	}
-
-}
-
-static HRESULT SetForceTacile(LPDIRECTINPUTEFFECT SDIE, const JoyFF_t *FF,DWORD FFAXIS, FFType EffectType)
-{
-	DIEFFECT eff;
-	HRESULT hr;
-	LONG Magnitude;
-	LONG rglDirection[2] = { 0, 0 };
-	DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude
-	DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd;
-	DIPERIODIC pf = {0,0,0,0};
-	if (!FF)
-		IDirectInputEffect_Stop(SDIE);
-	Magnitude = FF->Magnitude;
-	ZeroMemory(&eff, sizeof (eff));
-	eff.dwSize                  = sizeof (eff);
-	//DIEP_START
-	eff.dwFlags                 = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets
-	//DIEP_DURATION
-	eff.dwDuration              = FF->Duration;
-	//DIEP_GAIN
-	eff.dwGain                  = FF->Gain;
-	//DIEP_DIRECTION
-	eff.rglDirection            = rglDirection;
-	//DIEP_TYPESPECIFICPARAMS
-	if (FFAXIS > 1)
-	{
-		double dMagnitude;
-		dMagnitude                  = (double)Magnitude;
-		dMagnitude                  = hypot(dMagnitude, dMagnitude);
-		Magnitude                   = (DWORD)dMagnitude;
-		rglDirection[0]             = FF->ForceX;
-		rglDirection[1]             = FF->ForceY;
-	}
-	if (EffectType == ConstantForce)
-	{
-		cf.lMagnitude               = Magnitude;
-		eff.cbTypeSpecificParams    = sizeof (cf);
-		eff.lpvTypeSpecificParams   = &cf;
-	}
-	else if (EffectType == RampForce)
-	{
-		rf.lStart                   = FF->Start;
-		rf.lEnd                     = FF->End;
-		eff.cbTypeSpecificParams    = sizeof (rf);
-		eff.lpvTypeSpecificParams   = &rf;
-	}
-	else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType)
-	{
-		pf.dwMagnitude              = Magnitude;
-		pf.lOffset                  = FF->Offset;
-		pf.dwPhase                  = FF->Phase;
-		pf.dwPeriod                 = FF->Period;
-		eff.cbTypeSpecificParams    = sizeof (pf);
-		eff.lpvTypeSpecificParams   = &pf;
-	}
-
-	LimitEffect(&eff, EffectType);
-
-	hr = IDirectInputEffect_SetParameters(SDIE, &eff,
-	 DIEP_START|DIEP_DURATION|DIEP_GAIN|DIEP_DIRECTION|DIEP_TYPESPECIFICPARAMS);
-	return hr;
-}
-
-void I_Tactile(FFType Type, const JoyFF_t *Effect)
-{
-	if (!lpDIJA) return;
-	if (FAILED(IDirectInputDevice2_Acquire(lpDIJA)))
-		return;
-	if (Type == EvilForce)
-		IDirectInputDevice2_SendForceFeedbackCommand(lpDIJA,DISFFC_STOPALL);
-	if (Type <= EvilForce || Type > NumberofForces || !lpDIE[Type])
-		return;
-	SetForceTacile(lpDIE[Type], Effect, JoyInfo.ForceAxises, Type);
-}
-
-void I_Tactile2(FFType Type, const JoyFF_t *Effect)
-{
-	if (!lpDIJ2A) return;
-	if (FAILED(IDirectInputDevice2_Acquire(lpDIJ2A)))
-		return;
-	if (Type == EvilForce)
-		IDirectInputDevice2_SendForceFeedbackCommand(lpDIJ2A,DISFFC_STOPALL);
-	if (Type <= EvilForce || Type > NumberofForces || !lpDIE2[Type])
-		return;
-	SetForceTacile(lpDIE2[Type],Effect, JoyInfo2.ForceAxises, Type);
-}
-
-// ------------------
-// SetDIDwordProperty (HELPER)
-// Set a DWORD property on a DirectInputDevice.
-// ------------------
-static HRESULT SetDIDwordProperty(LPDIRECTINPUTDEVICE pdev,
-                                   REFGUID guidProperty,
-                                   DWORD dwObject,
-                                   DWORD dwHow,
-                                   DWORD dwValue)
-{
-	DIPROPDWORD dipdw;
-
-	dipdw.diph.dwSize       = sizeof (dipdw);
-	dipdw.diph.dwHeaderSize = sizeof (dipdw.diph);
-	dipdw.diph.dwObj        = dwObject;
-	dipdw.diph.dwHow        = dwHow;
-	dipdw.dwData            = dwValue;
-
-	return IDirectInputDevice_SetProperty(pdev, guidProperty, &dipdw.diph);
-}
-
-
-// ---------------
-// DIEnumJoysticks
-// There is no such thing as a 'system' joystick, contrary to mouse,
-// we must enumerate and choose one joystick device to use
-// ---------------
-static BOOL CALLBACK DIEnumJoysticks (LPCDIDEVICEINSTANCE lpddi,
-                                       LPVOID pvRef)   //cv_usejoystick
-{
-	LPDIRECTINPUTDEVICE pdev;
-	DIPROPRANGE         diprg;
-	DIDEVCAPS           caps;
-	BOOL                bUseThisOne = FALSE;
-
-	iJoyNum++;
-
-	//faB: if cv holds a string description of joystick, the value from atoi() is 0
-	//     else, the value was probably set by user at console to one of the previously
-	//     enumerated joysticks
-	if (((consvar_t *)pvRef)->value == iJoyNum
-#ifndef _UNICODE
-		|| !lstrcmpA(((consvar_t *)pvRef)->string, lpddi->tszProductName)
-#endif
-		)
-		bUseThisOne = TRUE;
-
-	//CONS_Printf(" cv joy is %s\n", ((consvar_t *)pvRef)->string);
-
-	// print out device name
-	CONS_Printf("%c%d: %s\n",
-	             (bUseThisOne) ? '\2' : ' ',   // show name in white if this is the one we will use
-	             iJoyNum,
-	             //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick",
-	             lpddi->tszProductName); //, lpddi->tszInstanceName);
-
-	// use specified joystick (cv_usejoystick.value in pvRef)
-	if (!bUseThisOne)
-		return DIENUM_CONTINUE;
-
-	((consvar_t *)pvRef)->value = iJoyNum;
-	if (IDirectInput_CreateDevice (lpDI, &lpddi->guidInstance,
-	                                &pdev, NULL) != DI_OK)
-	{
-		// if it failed, then we can't use this joystick for some
-		// bizarre reason.  (Maybe the user unplugged it while we
-		// were in the middle of enumerating it.)  So continue enumerating
-		CONS_Printf("DIEnumJoysticks(): CreateDevice FAILED\n");
-		return DIENUM_CONTINUE;
-	}
-
-	// get the Device capabilities
-	//
-	caps.dwSize = sizeof (DIDEVCAPS_DX3);
-	if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps)))
-	{
-		CONS_Printf("DIEnumJoysticks(): GetCapabilities FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-	if (!(caps.dwFlags & DIDC_ATTACHED))   // should be, since we enumerate only attached devices
-		return DIENUM_CONTINUE;
-
-	Joystick.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0);
-
-	if (caps.dwFlags & DIDC_FORCEFEEDBACK)
-		JoyInfo.ForceAxises = 0;
-	else
-		JoyInfo.ForceAxises = -1;
-
-	Joystick.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD);
-	//DEBUG CONS_Printf("Gamepad: %d\n", Joystick.bGamepadStyle);
-
-
-	CONS_Printf("Capabilities: %d axes, %d buttons, %d POVs, poll %d, Gamepad %d\n",
-	             caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick.bJoyNeedPoll, Joystick.bGamepadStyle);
-
-	// Set the data format to "simple joystick" - a predefined data format
-	//
-	// A data format specifies which controls on a device we
-	// are interested in, and how they should be reported.
-	//
-	// This tells DirectInput that we will be passing a
-	// DIJOYSTATE structure to IDirectInputDevice::GetDeviceState.
-	if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK)
-	{
-		CONS_Printf("DIEnumJoysticks(): SetDataFormat FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-
-	// Set the cooperativity level to let DirectInput know how
-	// this device should interact with the system and with other
-	// DirectInput applications.
-	if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain,
-	         DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK)
-	{
-		CONS_Printf("DIEnumJoysticks(): SetCooperativeLevel FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-
-	// set the range of the joystick axis
-	diprg.diph.dwSize       = sizeof (DIPROPRANGE);
-	diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER);
-	diprg.diph.dwHow        = DIPH_BYOFFSET;
-	diprg.lMin              = -JOYAXISRANGE;    // value for extreme left
-	diprg.lMax              = +JOYAXISRANGE;    // value for extreme right
-
-	diprg.diph.dwObj = DIJOFS_X;    // set the x-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//goto SetPropFail;
-		JoyInfo.X = FALSE;
-	}
-	else JoyInfo.X = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_Y;    // set the y-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-//SetPropFail:
-//		CONS_Printf("DIEnumJoysticks(): SetProperty FAILED\n");
-//		IDirectInputDevice_Release (pdev);
-//		return DIENUM_CONTINUE;
-		JoyInfo.Y = FALSE;
-	}
-	else JoyInfo.Y = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_Z;    // set the z-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_Z not found\n");
-		JoyInfo.Z = FALSE;
-	}
-	else JoyInfo.Z = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RX;   // set the x-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RX (x-rudder) not found\n");
-		JoyInfo.Rx = FALSE;
-	}
-	else JoyInfo.Rx = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RY;   // set the y-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RY (y-rudder) not found\n");
-		JoyInfo.Ry = FALSE;
-	}
-	else JoyInfo.Ry = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RZ;   // set the z-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (z-rudder) not found\n");
-		JoyInfo.Rz = FALSE;
-	}
-	else JoyInfo.Rz = TRUE;
-	diprg.diph.dwObj = DIJOFS_SLIDER(0);   // set the x-misc range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (x-misc) not found\n");
-		JoyInfo.U = FALSE;
-	}
-	else JoyInfo.U = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_SLIDER(1);   // set the y-misc range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (y-misc) not found\n");
-		JoyInfo.V = FALSE;
-	}
-	else JoyInfo.V = TRUE;
-
-	// set X axis dead zone to 25% (to avoid accidental turning)
-	if (!Joystick.bGamepadStyle)
-	{
-		if (JoyInfo.X)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_X,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for X DEAD ZONE");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.Y)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_Y,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for Y DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.Z)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_Z,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for Z DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.Rx)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RX,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for RX DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.Ry)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RY,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for RY DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.Rz)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RZ,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for RZ DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.U)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0),
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for U DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo.V)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1),
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks(): couldn't SetProperty for V DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-	}
-
-	// query for IDirectInputDevice2 - we need this to poll the joystick
-	if (bDX0300)
-	{
-		FFType i = EvilForce;
-		// we won't use the poll
-		lpDIJA = NULL;
-		for (i = 0; i > NumberofForces; i++)
-			lpDIE[i] = NULL;
-	}
-	else
-	{
-		LPDIRECTINPUTDEVICE2 *rp = &lpDIJA;
-		LPVOID *tp  = (LPVOID *)rp;
-		if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp)))
-		{
-			CONS_Printf("DIEnumJoysticks(): QueryInterface FAILED\n");
-			IDirectInputDevice_Release (pdev);
-			return DIENUM_CONTINUE;
-		}
-
-		if (lpDIJA && JoyInfo.ForceAxises != -1)
-		{
-			// Since we will be playing force feedback effects, we should disable the
-			// auto-centering spring.
-			if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE)))
-			{
-				//NOP
-			}
-
-			// Enumerate and count the axes of the joystick
-			if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback,
-				(VOID*)&JoyInfo.ForceAxises, DIDFT_AXIS)))
-			{
-				JoyInfo.ForceAxises = -1;
-			}
-			else
-			{
-				SetupAllForces(lpDIJA,lpDIE,JoyInfo.ForceAxises);
-			}
-		}
-	}
-
-	// we successfully created an IDirectInputDevice.  So stop looking
-	// for another one.
-	lpDIJ = pdev;
-	return DIENUM_STOP;
-}
-
-// --------------
-// I_InitJoystick
-// This is called everytime the 'use_joystick' variable changes
-// It is normally called at least once at startup when the config is loaded
-// --------------
-void I_InitJoystick(void)
-{
-	HRESULT hr;
-
-	// cleanup
-	I_ShutdownJoystick();
-
-	//joystick detection can be skipped by setting use_joystick to 0
-	if (M_CheckParm("-nojoy"))
-	{
-		CONS_Printf("Joystick disabled\n");
-		return;
-	}
-	else
-		// don't do anything at the registration of the joystick cvar,
-		// until config is loaded
-		 if (!lstrcmpA(cv_usejoystick.string, "0"))
-		return;
-
-	// acquire the joystick only once
-	if (!lpDIJ)
-	{
-		joystick_detected = false;
-
-		CONS_Printf("Looking for joystick devices:\n");
-		iJoyNum = 0;
-		hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, DIEnumJoysticks,
-			(void *)&cv_usejoystick, // our user parameter is joystick number
-			DIEDFL_ATTACHEDONLY);
-		if (FAILED(hr))
-		{
-			CONS_Printf("\nI_InitJoystick(): EnumDevices FAILED\n");
-			cv_usejoystick.value = 0;
-			return;
-		}
-
-		if (!lpDIJ)
-		{
-			if (!iJoyNum)
-				CONS_Printf("none found\n");
-			else
-			{
-				CONS_Printf("none used\n");
-				if (cv_usejoystick.value > 0 && cv_usejoystick.value > iJoyNum)
-				{
-					CONS_Printf("\2Set the use_joystick variable to one of the"
-						" enumerated joystick numbers\n");
-				}
-			}
-			cv_usejoystick.value = 0;
-			return;
-		}
-
-		I_AddExitFunc(I_ShutdownJoystick);
-
-		// set coop level
-		if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIJ, hWndMain,
-		          DISCL_NONEXCLUSIVE|DISCL_FOREGROUND)))
-		{
-			I_Error("I_InitJoystick: SetCooperativeLevel FAILED");
-		}
-	}
-	else
-		CONS_Printf("Joystick already initialized\n");
-
-	// we don't unacquire joystick, so let's just pretend we re-acquired it
-	joystick_detected = true;
-}
-//Joystick 2
-
-// ---------------
-// DIEnumJoysticks2
-// There is no such thing as a 'system' joystick, contrary to mouse,
-// we must enumerate and choose one joystick device to use
-// ---------------
-static BOOL CALLBACK DIEnumJoysticks2 (LPCDIDEVICEINSTANCE lpddi,
-                                        LPVOID pvRef)   //cv_usejoystick
-{
-	LPDIRECTINPUTDEVICE pdev;
-	DIPROPRANGE         diprg;
-	DIDEVCAPS           caps;
-	BOOL                bUseThisOne = FALSE;
-
-	iJoy2Num++;
-
-	//faB: if cv holds a string description of joystick, the value from atoi() is 0
-	//     else, the value was probably set by user at console to one of the previsouly
-	//     enumerated joysticks
-	if (((consvar_t *)pvRef)->value == iJoy2Num
-#ifndef _UNICODE
-		|| !lstrcmpA(((consvar_t *)pvRef)->string, lpddi->tszProductName)
-#endif
-		)
-		bUseThisOne = TRUE;
-
-	//CONS_Printf(" cv joy2 is %s\n", ((consvar_t *)pvRef)->string);
-
-	// print out device name
-	CONS_Printf("%c%d: %s\n",
-	             (bUseThisOne) ? '\2' : ' ',   // show name in white if this is the one we will use
-	             iJoy2Num,
-	             //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick",
-	             lpddi->tszProductName); //, lpddi->tszInstanceName);
-
-	// use specified joystick (cv_usejoystick.value in pvRef)
-	if (!bUseThisOne)
-		return DIENUM_CONTINUE;
-
-	((consvar_t *)pvRef)->value = iJoy2Num;
-	if (IDirectInput_CreateDevice (lpDI, &lpddi->guidInstance,
-	                                &pdev, NULL) != DI_OK)
-	{
-		// if it failed, then we can't use this joystick for some
-		// bizarre reason.  (Maybe the user unplugged it while we
-		// were in the middle of enumerating it.)  So continue enumerating
-		CONS_Printf("DIEnumJoysticks2(): CreateDevice FAILED\n");
-		return DIENUM_CONTINUE;
-	}
-
-
-	// get the Device capabilities
-	//
-	caps.dwSize = sizeof (DIDEVCAPS_DX3);
-	if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps)))
-	{
-		CONS_Printf("DIEnumJoysticks2(): GetCapabilities FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-	if (!(caps.dwFlags & DIDC_ATTACHED))   // should be, since we enumerate only attached devices
-		return DIENUM_CONTINUE;
-
-	Joystick2.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0);
-
-	if (caps.dwFlags & DIDC_FORCEFEEDBACK)
-		JoyInfo2.ForceAxises = 0;
-	else
-		JoyInfo2.ForceAxises = -1;
-
-	Joystick2.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD);
-	//DEBUG CONS_Printf("Gamepad: %d\n", Joystick2.bGamepadStyle);
-
-
-	CONS_Printf("Capabilities: %d axes, %d buttons, %d POVs, poll %d, Gamepad %d\n",
-	             caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick2.bJoyNeedPoll, Joystick2.bGamepadStyle);
-
-
-	// Set the data format to "simple joystick" - a predefined data format
-	//
-	// A data format specifies which controls on a device we
-	// are interested in, and how they should be reported.
-	//
-	// This tells DirectInput that we will be passing a
-	// DIJOYSTATE structure to IDirectInputDevice::GetDeviceState.
-	if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK)
-	{
-		CONS_Printf("DIEnumJoysticks2(): SetDataFormat FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-
-	// Set the cooperativity level to let DirectInput know how
-	// this device should interact with the system and with other
-	// DirectInput applications.
-	if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain,
-	         DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK)
-	{
-		CONS_Printf("DIEnumJoysticks2(): SetCooperativeLevel FAILED\n");
-		IDirectInputDevice_Release (pdev);
-		return DIENUM_CONTINUE;
-	}
-
-	// set the range of the joystick axis
-	diprg.diph.dwSize       = sizeof (DIPROPRANGE);
-	diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER);
-	diprg.diph.dwHow        = DIPH_BYOFFSET;
-	diprg.lMin              = -JOYAXISRANGE;    // value for extreme left
-	diprg.lMax              = +JOYAXISRANGE;    // value for extreme right
-
-	diprg.diph.dwObj = DIJOFS_X;    // set the x-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//goto SetPropFail;
-		JoyInfo2.X = FALSE;
-	}
-	else JoyInfo2.X = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_Y;    // set the y-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-//SetPropFail:
-//		CONS_Printf("DIEnumJoysticks(): SetProperty FAILED\n");
-//		IDirectInputDevice_Release (pdev);
-//		return DIENUM_CONTINUE;
-		JoyInfo2.Y = FALSE;
-	}
-	else JoyInfo2.Y = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_Z;    // set the z-axis range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_Z not found\n");
-		JoyInfo2.Z = FALSE;
-	}
-	else JoyInfo2.Z = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RX;   // set the x-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RX (x-rudder) not found\n");
-		JoyInfo2.Rx = FALSE;
-	}
-	else JoyInfo2.Rx = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RY;   // set the y-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RY (y-rudder) not found\n");
-		JoyInfo2.Ry = FALSE;
-	}
-	else JoyInfo2.Ry = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_RZ;   // set the z-rudder range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (z-rudder) not found\n");
-		JoyInfo2.Rz = FALSE;
-	}
-	else JoyInfo2.Rz = TRUE;
-	diprg.diph.dwObj = DIJOFS_SLIDER(0);   // set the x-misc range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (x-misc) not found\n");
-		JoyInfo2.U = FALSE;
-	}
-	else JoyInfo2.U = TRUE;
-
-	diprg.diph.dwObj = DIJOFS_SLIDER(1);   // set the y-misc range
-	if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph)))
-	{
-		//CONS_Printf("DIJOFS_RZ (y-misc) not found\n");
-		JoyInfo2.V = FALSE;
-	}
-	else JoyInfo2.V = TRUE;
-
-	// set X axis dead zone to 25% (to avoid accidental turning)
-	if (!Joystick2.bGamepadStyle)
-	{
-		if (JoyInfo2.X)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_X,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for X DEAD ZONE");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.Y)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_Y,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for Y DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.Z)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_Z,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for Z DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.Rx)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RX,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for RX DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.Ry)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RY,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for RY DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.Rz)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_RZ,
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for RZ DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.U)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0),
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for U DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-		if (JoyInfo2.V)
-			if (FAILED(SetDIDwordProperty (pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1),
-			                                 DIPH_BYOFFSET, 2500)))
-			{
-				CONS_Printf("DIEnumJoysticks2(): couldn't SetProperty for V DEAD ZONE\n");
-				//IDirectInputDevice_Release (pdev);
-				//return DIENUM_CONTINUE;
-			}
-	}
-
-	// query for IDirectInputDevice2 - we need this to poll the joystick
-	if (bDX0300)
-	{
-		FFType i = EvilForce;
-		// we won't use the poll
-		lpDIJA = NULL;
-		for (i = 0; i > NumberofForces; i++)
-			lpDIE[i] = NULL;
-	}
-	else
-	{
-		LPDIRECTINPUTDEVICE2 *rp = &lpDIJ2A;
-		LPVOID *tp  = (LPVOID *)rp;
-		if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp)))
-		{
-			CONS_Printf("DIEnumJoysticks2(): QueryInterface FAILED\n");
-			IDirectInputDevice_Release (pdev);
-			return DIENUM_CONTINUE;
-		}
-
-		if (lpDIJ2A && JoyInfo2.ForceAxises != -1)
-		{
-			// Since we will be playing force feedback effects, we should disable the
-			// auto-centering spring.
-			if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE)))
-			{
-				//NOP
-			}
-
-			// Enumerate and count the axes of the joystick
-			if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback,
-				(VOID*)&JoyInfo2.ForceAxises, DIDFT_AXIS)))
-			{
-				JoyInfo2.ForceAxises = -1;
-			}
-			else
-			{
-				SetupAllForces(lpDIJ2A,lpDIE2,JoyInfo2.ForceAxises);
-			}
-		}
-	}
-
-	// we successfully created an IDirectInputDevice.  So stop looking
-	// for another one.
-	lpDIJ2 = pdev;
-	return DIENUM_STOP;
-}
-
-
-// --------------
-// I_InitJoystick2
-// This is called everytime the 'use_joystick2' variable changes
-// It is normally called at least once at startup when the config is loaded
-// --------------
-void I_InitJoystick2 (void)
-{
-	HRESULT hr;
-
-	// cleanup
-	I_ShutdownJoystick2 ();
-
-	joystick2_detected = false;
-
-	// joystick detection can be skipped by setting use_joystick to 0
-	if (M_CheckParm("-nojoy"))
-	{
-		CONS_Printf("Joystick2 disabled\n");
-		return;
-	}
-	else
-		// don't do anything at the registration of the joystick cvar,
-		// until config is loaded
-		if (!lstrcmpA(cv_usejoystick2.string, "0"))
-			return;
-
-	// acquire the joystick only once
-	if (!lpDIJ2)
-	{
-		joystick2_detected = false;
-
-		CONS_Printf("Looking for joystick devices:\n");
-		iJoy2Num = 0;
-		hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK,
-		                                DIEnumJoysticks2,
-		                                (void *)&cv_usejoystick2,    // our user parameter is joystick number
-		                                DIEDFL_ATTACHEDONLY);
-		if (FAILED(hr))
-		{
-			CONS_Printf("\nI_InitJoystick2(): EnumDevices FAILED\n");
-			cv_usejoystick2.value = 0;
-			return;
-		}
-
-		if (!lpDIJ2)
-		{
-			if (iJoy2Num == 0)
-				CONS_Printf("none found\n");
-			else
-			{
-				CONS_Printf("none used\n");
-				if (cv_usejoystick2.value > 0 &&
-				    cv_usejoystick2.value > iJoy2Num)
-				{
-					CONS_Printf("\2Set the use_joystick2 variable to one of the"
-					              " enumerated joysticks number\n");
-				}
-			}
-			cv_usejoystick2.value = 0;
-			return;
-		}
-
-		I_AddExitFunc (I_ShutdownJoystick2);
-
-		// set coop level
-		if (FAILED(IDirectInputDevice_SetCooperativeLevel (lpDIJ2, hWndMain, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND)))
-			I_Error("I_InitJoystick2: SetCooperativeLevel FAILED");
-
-		// later
-		//if (FAILED(IDirectInputDevice_Acquire (lpDIJ2)))
-		//    I_Error("Couldn't acquire Joystick2");
-
-		joystick2_detected = true;
-	}
-	else
-		CONS_Printf("Joystick2 already initialized\n");
-
-	//faB: we don't unacquire joystick, so let's just pretend we re-acquired it
-	joystick2_detected = true;
-}
-
-/**	\brief Joystick 1 buttons states
-*/
-static INT64 lastjoybuttons = 0;
-
-/**	\brief Joystick 1 hats state
-*/
-static INT64 lastjoyhats = 0;
-
-static void I_ShutdownJoystick(void)
-{
-	int i;
-	event_t event;
-
-	lastjoybuttons = lastjoyhats = 0;
-
-	event.type = ev_keyup;
-
-	// emulate the up of all joystick buttons
-	for (i = 0;i < JOYBUTTONS;i++)
-	{
-		event.data1 = KEY_JOY1+i;
-		D_PostEvent(&event);
-	}
-
-	// emulate the up of all joystick hats
-	for (i = 0;i < JOYHATS*4;i++)
-	{
-		event.data1 = KEY_HAT1+i;
-		D_PostEvent(&event);
-	}
-
-	// reset joystick position
-	event.type = ev_joystick;
-	for (i = 0;i < JOYAXISSET; i++)
-	{
-		event.data1 = i;
-		D_PostEvent(&event);
-	}
-
-	if (joystick_detected)
-		CONS_Printf("I_ShutdownJoystick()\n");
-
-	for (i = 0; i > NumberofForces; i++)
-	{
-		if (lpDIE[i])
-		{
-			IDirectInputEffect_Release(lpDIE[i]);
-			lpDIE[i] = NULL;
-
-		}
-	}
-	if (lpDIJ)
-	{
-		IDirectInputDevice_Unacquire(lpDIJ);
-		IDirectInputDevice_Release(lpDIJ);
-		lpDIJ = NULL;
-	}
-	if (lpDIJA)
-	{
-		IDirectInputDevice2_Release(lpDIJA);
-		lpDIJA = NULL;
-	}
-	joystick_detected = false;
-}
-
-/**	\brief Joystick 2 buttons states
-*/
-static INT64 lastjoy2buttons = 0;
-
-/**	\brief Joystick 2 hats state
-*/
-static INT64 lastjoy2hats = 0;
-
-static void I_ShutdownJoystick2(void)
-{
-	int i;
-	event_t event;
-
-	lastjoy2buttons = lastjoy2hats = 0;
-
-	event.type = ev_keyup;
-
-	// emulate the up of all joystick buttons
-	for (i = 0;i < JOYBUTTONS;i++)
-	{
-		event.data1 = KEY_2JOY1+i;
-		D_PostEvent(&event);
-	}
-
-	// emulate the up of all joystick hats
-	for (i = 0;i < JOYHATS*4;i++)
-	{
-		event.data1 = KEY_2HAT1+i;
-		D_PostEvent(&event);
-	}
-
-	// reset joystick position
-	event.type = ev_joystick2;
-	for (i = 0;i < JOYAXISSET; i++)
-	{
-		event.data1 = i;
-		D_PostEvent(&event);
-	}
-
-	if (joystick2_detected)
-		CONS_Printf("I_ShutdownJoystick2()\n");
-
-	for (i = 0; i > NumberofForces; i++)
-	{
-		if (lpDIE2[i])
-		{
-			IDirectInputEffect_Release(lpDIE2[i]);
-			lpDIE2[i] = NULL;
-		}
-	}
-	if (lpDIJ2)
-	{
-		IDirectInputDevice_Unacquire(lpDIJ2);
-		IDirectInputDevice_Release(lpDIJ2);
-		lpDIJ2 = NULL;
-	}
-	if (lpDIJ2A)
-	{
-		IDirectInputDevice2_Release(lpDIJ2A);
-		lpDIJ2A = NULL;
-	}
-	joystick2_detected = false;
-}
-
-// -------------------
-// I_GetJoystickEvents
-// Get current joystick axis and button states
-// -------------------
-void I_GetJoystickEvents(void)
-{
-	HRESULT hr;
-	DIJOYSTATE js; // DirectInput joystick state
-	int i;
-	INT64 joybuttons = 0;
-	INT64 joyhats = 0;
-	event_t event;
-
-	if (!lpDIJ)
-		return;
-
-	// if input is lost then acquire and keep trying
-	for (;;)
-	{
-		// poll the joystick to read the current state
-		// if the device doesn't require polling, this function returns almost instantly
-		if (lpDIJA)
-		{
-			hr = IDirectInputDevice2_Poll(lpDIJA);
-			if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-				goto acquire;
-			else if (FAILED(hr))
-			{
-				CONS_Printf("I_GetJoystickEvents(): Poll FAILED\n");
-				return;
-			}
-		}
-
-		// get the input's device state, and put the state in dims
-		hr = IDirectInputDevice_GetDeviceState(lpDIJ, sizeof (DIJOYSTATE), &js);
-
-		if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-		{
-			// DirectInput is telling us that the input stream has
-			// been interrupted.  We aren't tracking any state
-			// between polls, so we don't have any special reset
-			// that needs to be done.  We just re-acquire and
-			// try again.
-			goto acquire;
-		}
-		else if (FAILED(hr))
-		{
-			CONS_Printf("I_GetJoystickEvents(): GetDeviceState FAILED\n");
-			return;
-		}
-
-		break;
-acquire:
-		if (FAILED(IDirectInputDevice_Acquire(lpDIJ)))
-			return;
-	}
-
-	// look for as many buttons as g_input code supports, we don't use the others
-	for (i = JOYBUTTONS_MIN - 1; i >= 0; i--)
-	{
-		joybuttons <<= 1;
-		if (js.rgbButtons[i])
-			joybuttons |= 1;
-	}
-
-	for (i = JOYHATS_MIN -1; i >=0; i--)
-	{
-		if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff)
-		{
-			if     (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] <  90 * DI_DEGREES)
-				joyhats |= 1<<(0 + 4*i); // UP
-			else if (js.rgdwPOV[i] >  90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES)
-				joyhats |= 1<<(1 + 4*i); // DOWN
-			if     (js.rgdwPOV[i] >   0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES)
-				joyhats |= 1<<(3 + 4*i); // LEFT
-			else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES)
-				joyhats |= 1<<(2 + 4*i); // RIGHT
-		}
-	}
-
-	if (joybuttons != lastjoybuttons)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newbuttons = joybuttons ^ lastjoybuttons;
-		lastjoybuttons = joybuttons;
-
-		for (i = 0; i < JOYBUTTONS && i < JOYBUTTONS_MAX; i++, j <<= 1)
-		{
-			if (newbuttons & j) // button changed state?
-			{
-				if (joybuttons & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_JOY1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-
-	if (joyhats != lastjoyhats)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newhats = joyhats ^ lastjoyhats;
-		lastjoyhats = joyhats;
-
-		for (i = 0; i < JOYHATS*4 && i < JOYHATS_MAX*4; i++, j <<= 1)
-		{
-			if (newhats & j) // button changed state?
-			{
-				if (joyhats & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_HAT1 + i;
-				D_PostEvent(&event);
-			}
-		}
-
-	}
-
-	// send joystick axis positions
-	event.type = ev_joystick;
-	event.data1 = event.data2 = event.data3 = 0;
-
-	if (Joystick.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo.X)
-		{
-			if (js.lX < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lX > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo.Y)
-		{
-			if (js.lY < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lY > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo.X)  event.data2 = js.lX; // x axis
-		if (JoyInfo.Y)  event.data3 = js.lY; // y axis
-	}
-
-	D_PostEvent(&event);
-#if JOYAXISSET > 1
-	event.data1 = 1;
-	event.data2 = event.data3 = 0;
-
-	if (Joystick.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo.Z)
-		{
-			if (js.lZ < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lZ > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo.Rx)
-		{
-			if (js.lRx < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lRx > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo.Z)  event.data2 = js.lZ;  // z axis
-		if (JoyInfo.Rx) event.data3 = js.lRx; // rx axis
-	}
-
-	D_PostEvent(&event);
-#endif
-#if JOYAXISSET > 2
-	event.data1 = 2;
-	event.data2 = event.data3 = 0;
-
-	if (Joystick.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo.Rx)
-		{
-			if (js.lRy < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lRy > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo.Rz)
-		{
-			if (js.lRz < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lRz > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo.Ry) event.data2 = js.lRy; // ry axis
-		if (JoyInfo.Rz) event.data3 = js.lRz; // rz axis
-	}
-
-	D_PostEvent(&event);
-#endif
-#if JOYAXISSET > 3
-	event.data1 = 3;
-	event.data2 = event.data3 = 0;
-	if (Joystick.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo.U)
-		{
-			if (js.rglSlider[0] < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.rglSlider[0] > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo.V)
-		{
-			if (js.rglSlider[1] < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.rglSlider[1] > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo.U)  event.data2 = js.rglSlider[0]; // U axis
-		if (JoyInfo.V)  event.data3 = js.rglSlider[1]; // V axis
-	}
-	D_PostEvent(&event);
-#endif
-}
-
-// -------------------
-// I_GetJoystickEvents
-// Get current joystick axis and button states
-// -------------------
-void I_GetJoystick2Events(void)
-{
-	HRESULT hr;
-	DIJOYSTATE js; // DirectInput joystick state
-	int i;
-	INT64 joybuttons = 0;
-	INT64 joyhats = 0;
-	event_t event;
-
-	if (!lpDIJ2)
-		return;
-
-	// if input is lost then acquire and keep trying
-	for (;;)
-	{
-		// poll the joystick to read the current state
-		// if the device doesn't require polling, this function returns almost instantly
-		if (lpDIJ2A)
-		{
-			hr = IDirectInputDevice2_Poll(lpDIJ2A);
-			if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-				goto acquire;
-			else if (FAILED(hr))
-			{
-				CONS_Printf("I_GetJoystick2Events(): Poll FAILED\n");
-				return;
-			}
-		}
-
-		// get the input's device state, and put the state in dims
-		hr = IDirectInputDevice_GetDeviceState(lpDIJ2, sizeof (DIJOYSTATE), &js);
-
-		if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-		{
-			// DirectInput is telling us that the input stream has
-			// been interrupted.  We aren't tracking any state
-			// between polls, so we don't have any special reset
-			// that needs to be done.  We just re-acquire and
-			// try again.
-			goto acquire;
-		}
-		else if (FAILED(hr))
-		{
-			CONS_Printf("I_GetJoystickEvents2(): GetDeviceState FAILED\n");
-			return;
-		}
-
-		break;
-acquire:
-		if (FAILED(IDirectInputDevice_Acquire(lpDIJ2)))
-			return;
-	}
-
-	// look for as many buttons as g_input code supports, we don't use the others
-	for (i = JOYBUTTONS_MIN - 1; i >= 0; i--)
-	{
-		joybuttons <<= 1;
-		if (js.rgbButtons[i])
-			joybuttons |= 1;
-	}
-
-	for (i = JOYHATS_MIN -1; i >=0; i--)
-	{
-		if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff)
-		{
-			if     (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] <  90 * DI_DEGREES)
-				joyhats |= 1<<(0 + 4*i); // UP
-			else if (js.rgdwPOV[i] >  90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES)
-				joyhats |= 1<<(1 + 4*i); // DOWN
-			if     (js.rgdwPOV[i] >   0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES)
-				joyhats |= 1<<(3 + 4*i); // LEFT
-			else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES)
-				joyhats |= 1<<(2 + 4*i); // RIGHT
-		}
-	}
-
-	if (joybuttons != lastjoy2buttons)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newbuttons = joybuttons ^ lastjoy2buttons;
-		lastjoy2buttons = joybuttons;
-
-		for (i = 0; i < JOYBUTTONS && i < JOYBUTTONS_MAX; i++, j <<= 1)
-		{
-			if (newbuttons & j) // button changed state?
-			{
-				if (joybuttons & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_2JOY1 + i;
-				D_PostEvent(&event);
-			}
-		}
-	}
-
-	if (joyhats != lastjoy2hats)
-	{
-		INT64 j = 1; // keep only bits that changed since last time
-		INT64 newhats = joyhats ^ lastjoy2hats;
-		lastjoy2hats = joyhats;
-
-		for (i = 0; i < JOYHATS*4 && i < JOYHATS_MAX*4; i++, j <<= 1)
-		{
-			if (newhats & j) // button changed state?
-			{
-				if (joyhats & j)
-					event.type = ev_keydown;
-				else
-					event.type = ev_keyup;
-				event.data1 = KEY_2HAT1 + i;
-				D_PostEvent(&event);
-			}
-		}
-
-	}
-
-	// send joystick axis positions
-	event.type = ev_joystick2;
-	event.data1 = event.data2 = event.data3 = 0;
-
-	if (Joystick2.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo2.X)
-		{
-			if (js.lX < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lX > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo2.Y)
-		{
-			if (js.lY < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lY > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo2.X)  event.data2 = js.lX; // x axis
-		if (JoyInfo2.Y)  event.data3 = js.lY; // y axis
-	}
-
-	D_PostEvent(&event);
-#if JOYAXISSET > 1
-	event.data1 = 1;
-	event.data2 = event.data3 = 0;
-
-	if (Joystick2.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo2.Z)
-		{
-			if (js.lZ < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lZ > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo2.Rx)
-		{
-			if (js.lRx < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lRx > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo2.Z)  event.data2 = js.lZ;  // z axis
-		if (JoyInfo2.Rx) event.data3 = js.lRx; // rx axis
-	}
-
-	D_PostEvent(&event);
-#endif
-#if JOYAXISSET > 2
-	event.data1 = 2;
-	event.data2 = event.data3 = 0;
-
-	if (Joystick2.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo2.Rx)
-		{
-			if (js.lRy < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.lRy > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo2.Rz)
-		{
-			if (js.lRz < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.lRz > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo2.Ry) event.data2 = js.lRy; // ry axis
-		if (JoyInfo2.Rz) event.data3 = js.lRz; // rz axis
-	}
-
-	D_PostEvent(&event);
-#endif
-#if JOYAXISSET > 3
-	event.data1 = 3;
-	event.data2 = event.data3 = 0;
-	if (Joystick2.bGamepadStyle)
-	{
-		// gamepad control type, on or off, live or die
-		if (JoyInfo2.U)
-		{
-			if (js.rglSlider[0] < -(JOYAXISRANGE/2))
-				event.data2 = -1;
-			else if (js.rglSlider[0] > JOYAXISRANGE/2)
-				event.data2 = 1;
-		}
-		if (JoyInfo2.V)
-		{
-			if (js.rglSlider[1] < -(JOYAXISRANGE/2))
-				event.data3 = -1;
-			else if (js.rglSlider[1] > JOYAXISRANGE/2)
-				event.data3 = 1;
-		}
-	}
-	else
-	{
-		// analog control style, just send the raw data
-		if (JoyInfo2.U)  event.data2 = js.rglSlider[0]; // U axis
-		if (JoyInfo2.V)  event.data3 = js.rglSlider[1]; // V axis
-	}
-	D_PostEvent(&event);
-#endif
-}
-
-static int numofjoy = 0;
-static char joyname[MAX_PATH];
-static int needjoy = -1;
-
-static BOOL CALLBACK DIEnumJoysticksCount (LPCDIDEVICEINSTANCE lpddi,
-                                            LPVOID pvRef)   //joyname
-{
-	numofjoy++;
-	if (needjoy == numofjoy && pvRef && pvRef == (void *)joyname && lpddi
-		&& lpddi->tszProductName)
-	{
-		sprintf(joyname,"%s",lpddi->tszProductName);
-		return DIENUM_STOP;
-	}
-	//else if (devparm) CONS_Printf("DIEnumJoysticksCount need help!");
-	return DIENUM_CONTINUE;
-}
-
-INT32 I_NumJoys(void)
-{
-	HRESULT hr;
-	needjoy = -1;
-	numofjoy = 0;
-	hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK,
-		DIEnumJoysticksCount, (void *)&numofjoy, DIEDFL_ATTACHEDONLY);
-	if (FAILED(hr))
-			CONS_Printf("\nI_NumJoys(): EnumDevices FAILED\n");
-	return numofjoy;
-
-}
-
-const char *I_GetJoyName(INT32 joyindex)
-{
-	HRESULT hr;
-	needjoy = joyindex;
-	numofjoy = 0;
-	ZeroMemory(joyname,sizeof (joyname));
-	hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK,
-		DIEnumJoysticksCount, (void *)joyname, DIEDFL_ATTACHEDONLY);
-	if (FAILED(hr))
-			CONS_Printf("\nI_GetJoyName(): EnumDevices FAILED\n");
-	if (joyname[0] == 0) return NULL;
-	return joyname;
-}
-
-// ===========================================================================================
-//                                                                       DIRECT INPUT KEYBOARD
-// ===========================================================================================
-
-static UINT8 ASCIINames[256] =
-{
-	//  0       1       2       3       4       5       6       7
-	//  8       9       A       B       C       D       E       F
-	0,      27,     '1',    '2',    '3',    '4',    '5',    '6',
-	'7',    '8',    '9',    '0', KEY_MINUS,KEY_EQUALS,KEY_BACKSPACE, KEY_TAB,
-	'q',    'w',    'e',    'r',    't',    'y',    'u',    'i',
-	'o',    'p',    '[',    ']', KEY_ENTER,KEY_CTRL,'a',    's',
-	'd',    'f',    'g',    'h',    'j',    'k',    'l',    ';',
-	'\'',   '`', KEY_SHIFT, '\\',   'z',    'x',    'c',    'v',
-	'b',    'n',    'm',    ',',    '.',    '/', KEY_SHIFT, '*',
-	KEY_ALT,KEY_SPACE,KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
-	KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10,KEY_NUMLOCK,KEY_SCROLLLOCK,KEY_KEYPAD7,
-	KEY_KEYPAD8,KEY_KEYPAD9,KEY_MINUSPAD,KEY_KEYPAD4,KEY_KEYPAD5,KEY_KEYPAD6,KEY_PLUSPAD,KEY_KEYPAD1,
-	KEY_KEYPAD2,KEY_KEYPAD3,KEY_KEYPAD0,KEY_KPADDEL,0,0,0,      KEY_F11,
-	KEY_F12,0,          0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-
-	//  0       1       2       3       4       5       6       7
-	//  8       9       A       B       C       D       E       F
-
-	0,          0,      0,      0,      0,      0,      0,      0, // 0x80
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,  KEY_ENTER,KEY_CTRL, 0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0, // 0xa0
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0, KEY_KPADDEL, 0,KEY_KPADSLASH,0,      0,
-	KEY_ALT,0,          0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,  KEY_HOME, // 0xc0
-	KEY_UPARROW,KEY_PGUP,0,KEY_LEFTARROW,0,KEY_RIGHTARROW,0,KEY_END,
-	KEY_DOWNARROW,KEY_PGDN, KEY_INS,KEY_DEL,0,0,0,0,
-	0,          0,      0,KEY_LEFTWIN,KEY_RIGHTWIN,KEY_MENU, 0, 0,
-	0,          0,      0,      0,      0,      0,      0,      0, // 0xe0
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0,
-	0,          0,      0,      0,      0,      0,      0,      0
-};
-
-// Return a key that has been pushed, or 0 (replace getchar() at game startup)
-//
-INT32 I_GetKey(void)
-{
-	event_t *ev;
-
-	if (eventtail != eventhead)
-	{
-		ev = &events[eventtail];
-		eventtail = (eventtail+1) & (MAXEVENTS-1);
-		if (ev->type == ev_keydown || ev->type == ev_console)
-			return ev->data1;
-		else
-			return 0;
-	}
-	return 0;
-}
-
-// -----------------
-// I_StartupKeyboard
-// Installs DirectInput keyboard
-// -----------------
-#define DI_KEYBOARD_BUFFERSIZE 32 // number of data elements in keyboard buffer
-
-void I_StartupKeyboard(void)
-{
-	DIPROPDWORD dip;
-
-	if (dedicated)
-		return;
-
-	// make sure the app window has the focus or DirectInput acquire keyboard won't work
-	if (hWndMain)
-	{
-		SetFocus(hWndMain);
-		ShowWindow(hWndMain, SW_SHOW);
-		UpdateWindow(hWndMain);
-	}
-
-	// detect error
-	if (lpDIK)
-	{
-		CONS_Printf("\2I_StartupKeyboard(): called twice\n");
-		return;
-	}
-
-	CreateDevice2(lpDI, &GUID_SysKeyboard, &lpDIK, NULL);
-
-	if (lpDIK)
-	{
-		if (FAILED(IDirectInputDevice_SetDataFormat(lpDIK, &c_dfDIKeyboard)))
-			I_Error("Couldn't set keyboard data format");
-
-		// create buffer for buffered data
-		dip.diph.dwSize = sizeof (dip);
-		dip.diph.dwHeaderSize = sizeof (dip.diph);
-		dip.diph.dwObj = 0;
-		dip.diph.dwHow = DIPH_DEVICE;
-		dip.dwData = DI_KEYBOARD_BUFFERSIZE;
-		if (FAILED(IDirectInputDevice_SetProperty(lpDIK, DIPROP_BUFFERSIZE, &dip.diph)))
-			I_Error("Couldn't set keyboard buffer size");
-
-		if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIK, hWndMain,
-			DISCL_NONEXCLUSIVE|DISCL_FOREGROUND)))
-		{
-			I_Error("Couldn't set keyboard coop level");
-		}
-	}
-	else
-		I_Error("Couldn't create keyboard input");
-
-	I_AddExitFunc(I_ShutdownKeyboard);
-	hacktics = 0; // see definition
-	keyboard_started = true;
-}
-
-// ------------------
-// I_ShutdownKeyboard
-// Release DirectInput keyboard.
-// ------------------
-static void I_ShutdownKeyboard(void)
-{
-	if (!keyboard_started)
-		return;
-
-	CONS_Printf("I_ShutdownKeyboard()\n");
-
-	if (lpDIK)
-	{
-		IDirectInputDevice_Unacquire(lpDIK);
-		IDirectInputDevice_Release(lpDIK);
-		lpDIK = NULL;
-	}
-
-	keyboard_started = false;
-}
-
-// -------------------
-// I_GetKeyboardEvents
-// Get buffered data from the keyboard
-// -------------------
-static void I_GetKeyboardEvents(void)
-{
-	static  boolean KeyboardLost = false;
-
-	// simply repeat the last pushed key every xx tics,
-	// make more user friendly input for Console and game Menus
-#define KEY_REPEAT_DELAY (TICRATE/17) // TICRATE tics, repeat every 1/3 second
-	static long RepeatKeyTics = 0;
-	static int RepeatKeyCode;
-
-	DIDEVICEOBJECTDATA rgdod[DI_KEYBOARD_BUFFERSIZE];
-	DWORD dwItems, d;
-	HRESULT hr;
-	int ch;
-
-	event_t event;
-	ZeroMemory(&event,sizeof (event));
-
-	if (!keyboard_started)
-		return;
-
-	if (!appActive && RepeatKeyCode) // Stop when lost focus
-	{
-		event.type = ev_keyup;
-		event.data1 = RepeatKeyCode;
-		D_PostEvent(&event);
-		RepeatKeyCode = 0;
-	}
-getBufferedData:
-	dwItems = DI_KEYBOARD_BUFFERSIZE;
-	hr = IDirectInputDevice_GetDeviceData(lpDIK, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0);
-
-	// If data stream was interrupted, reacquire the device and try again.
-	if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED)
-	{
-		// why it succeeds to acquire just after I don't understand.. so I set the flag BEFORE
-		KeyboardLost = true;
-
-		hr = IDirectInputDevice_Acquire(lpDIK);
-		if (SUCCEEDED(hr))
-			goto getBufferedData;
-		return;
-	}
-
-	// we lost data, get device actual state to recover lost information
-	if (hr == DI_BUFFEROVERFLOW)
-	{
-		/// \note either uncomment or delete block
-		//I_Error("DI buffer overflow (keyboard)");
-		//I_RecoverKeyboardState ();
-
-		//hr = IDirectInputDevice_GetDeviceState (lpDIM, sizeof (keys), &diMouseState);
-	}
-
-	// We got buffered input, act on it
-	if (SUCCEEDED(hr))
-	{
-		// if we previously lost keyboard data, recover its current state
-		if (KeyboardLost)
-		{
-			/// \bug hack simply clears the keys so we don't have the last pressed keys
-			/// still active.. to have to re-trigger it is not much trouble for the user.
-			ZeroMemory(gamekeydown, NUMKEYS);
-			KeyboardLost = false;
-		}
-
-		// dwItems contains number of elements read (could be 0)
-		for (d = 0; d < dwItems; d++)
-		{
-			// dwOfs member is DIK_* value
-			// dwData member 0x80 bit set press down, clear is release
-
-			if (rgdod[d].dwData & 0x80)
-				event.type = ev_keydown;
-			else
-				event.type = ev_keyup;
-
-			ch = rgdod[d].dwOfs & UINT8_MAX;
-			if (ASCIINames[ch])
-				event.data1 = ASCIINames[ch];
-			else
-				event.data1 = 0x80;
-
-			D_PostEvent(&event);
-		}
-
-		// Key Repeat
-		if (dwItems)
-		{
-			// new key events, so stop repeating key
-			RepeatKeyCode = 0;
-			// delay is tripled for first repeating key
-			RepeatKeyTics = hacktics + (KEY_REPEAT_DELAY*2);
-			if (event.type == ev_keydown) // use the last event!
-				RepeatKeyCode = event.data1;
-		}
-		else
-		{
-			// no new keys, repeat last pushed key after some time
-			if (RepeatKeyCode && hacktics - RepeatKeyTics > KEY_REPEAT_DELAY)
-			{
-				event.type = ev_keydown;
-				event.data1 = RepeatKeyCode;
-				D_PostEvent(&event);
-
-				RepeatKeyTics = hacktics;
-			}
-		}
-	}
-}
-
-//
-// Closes DirectInput
-//
-static void I_ShutdownDirectInput(void)
-{
-	if (lpDI)
-		IDirectInput_Release(lpDI);
-	lpDI = NULL;
-}
-
-// This stuff should get rid of the exception and page faults when
-// SRB2 bugs out with an error. Now it should exit cleanly.
-//
-INT32 I_StartupSystem(void)
-{
-	HRESULT hr;
-
-	// some 'more global than globals' things to initialize here ?
-	graphics_started = keyboard_started = sound_started = cdaudio_started = false;
-
-	I_DetectWin9x();
-
-	// check for OS type and version here?
-#ifdef NDEBUG
-	signal(SIGABRT, signal_handler);
-	signal(SIGFPE, signal_handler);
-	signal(SIGILL, signal_handler);
-	signal(SIGSEGV, signal_handler);
-	signal(SIGTERM, signal_handler);
-	signal(SIGINT, signal_handler);
-#endif
-
-	// create DirectInput - so that I_StartupKeyboard/Mouse can be called later on
-	// from D_SRB2Main just like DOS version
-	hr = DirectInputCreate(myInstance, DIRECTINPUT_VERSION, &lpDI, NULL);
-
-	if (SUCCEEDED(hr))
-		bDX0300 = FALSE;
-	else
-	{
-		// try opening DirectX3 interface for NT compatibility
-		hr = DirectInputCreate(myInstance, DXVERSION_NTCOMPATIBLE, &lpDI, NULL);
-
-		if (FAILED(hr))
-		{
-			const char *sErr;
-			switch (hr)
-			{
-				case DIERR_BETADIRECTINPUTVERSION:
-					sErr = "DIERR_BETADIRECTINPUTVERSION";
-					break;
-				case DIERR_INVALIDPARAM:
-					sErr = "DIERR_INVALIDPARAM";
-					break;
-				case DIERR_OLDDIRECTINPUTVERSION :
-					sErr = "DIERR_OLDDIRECTINPUTVERSION";
-					break;
-				case DIERR_OUTOFMEMORY:
-					sErr = "DIERR_OUTOFMEMORY";
-					break;
-				default:
-					sErr = "UNKNOWN";
-					break;
-			}
-			I_Error("Couldn't create DirectInput (reason: %s)", sErr);
-		}
-		else
-			CONS_Printf("\2Using DirectX3 interface\n");
-
-		// only use DirectInput3 compatible structures and calls
-		bDX0300 = TRUE;
-	}
-	I_AddExitFunc(I_ShutdownDirectInput);
-	return 0;
-}
-
-// Closes down everything. This includes restoring the initial
-// palette and video mode, and removing whatever mouse, keyboard, and
-// timer routines have been installed.
-//
-/// \bug doesn't restore wave/midi device volume
-//
-// Shutdown user funcs are effectively called in reverse order.
-//
-void I_ShutdownSystem(void)
-{
-	int c;
-
-	for (c = MAX_QUIT_FUNCS - 1; c >= 0; c--)
-		if (quit_funcs[c])
-			(*quit_funcs[c])();
-}
-
-// ---------------
-// I_SaveMemToFile
-// Save as much as iLength bytes starting at pData, to
-// a new file of given name. The file is overwritten if it is present.
-// ---------------
-BOOL I_SaveMemToFile(const void *pData, size_t iLength, const char *sFileName)
-{
-	HANDLE fileHandle;
-	DWORD bytesWritten;
-
-	fileHandle = CreateFileA(sFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
-		FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH, NULL);
-	if (fileHandle == (HANDLE)-1)
-	{
-		CONS_Printf("SaveMemToFile: Error opening file %s",sFileName);
-		return FALSE;
-	}
-	WriteFile(fileHandle, pData, (DWORD)iLength, &bytesWritten, NULL);
-	CloseHandle(fileHandle);
-	return TRUE;
-}
-
-// my god how win32 suck
-typedef BOOL (WINAPI *MyFunc)(LPCSTR RootName, PULARGE_INTEGER pulA, PULARGE_INTEGER pulB, PULARGE_INTEGER pulFreeBytes);
-
-void I_GetDiskFreeSpace(INT64* freespace)
-{
-	static MyFunc pfnGetDiskFreeSpaceEx = NULL;
-	static boolean testwin95 = false;
-	ULARGE_INTEGER usedbytes, lfrespace;
-
-	if (!testwin95)
-	{
-		HMODULE h = GetModuleHandleA("kernel32.dll");
-
-		if (h)
-			pfnGetDiskFreeSpaceEx = (MyFunc)GetProcAddress(h, "GetDiskFreeSpaceExA");
-		testwin95 = true;
-	}
-	if (pfnGetDiskFreeSpaceEx)
-	{
-		if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
-			*freespace = lfreespace.QuadPart;
-		else
-			*freespace = INT32_MAX;
-	}
-	else
-	{
-		DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters;
-		GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector,
-			&NumberOfFreeClusters, &TotalNumberOfClusters);
-		*freespace = BytesPerSector * SectorsPerCluster * NumberOfFreeClusters;
-	}
-}
-
-char *I_GetUserName(void)
-{
-	static char username[MAXPLAYERNAME+1];
-	char *p;
-	DWORD i = MAXPLAYERNAME;
-
-	if (!GetUserNameA(username, &i))
-	{
-		p = getenv("USER");
-		if (!p)
-		{
-			p = getenv("user");
-			if (!p)
-			{
-				p = getenv("USERNAME");
-				if (!p)
-				{
-					p = getenv("username");
-					if (!p)
-					{
-						return NULL;
-					}
-				}
-			}
-		}
-		strncpy(username, p, MAXPLAYERNAME);
-	}
-
-	if (!strlen(username))
-		return NULL;
-	return username;
-}
-
-INT32 I_mkdir(const char *dirname, INT32 unixright)
-{
-	(void)unixright; /// \todo should implement ntright under nt...
-	return CreateDirectoryA(dirname, NULL);
-}
-
-char * I_GetEnv(const char *name)
-{
-	return getenv(name);
-}
-
-INT32 I_PutEnv(char *variable)
-{
-	return putenv(variable);
-}
-
-INT32 I_ClipboardCopy(const char *data, size_t size)
-{
-	(void)data;
-	(void)size;
-	return -1;
-}
-
-char *I_ClipboardPaste(void)
-{
-	return NULL;
-}
-
-typedef BOOL (WINAPI *MyFunc3) (DWORD);
-
-const CPUInfoFlags *I_CPUInfo(void)
-{
-	static CPUInfoFlags WIN_CPUInfo;
-	static MyFunc3 pfnCPUID = NULL;
-	SYSTEM_INFO SI;
-	HMODULE h = GetModuleHandleA("kernel32.dll");
-
-	if (h)
-		pfnCPUID = (MyFunc3)GetProcAddress(h, "IsProcessorFeaturePresent");
-	ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo));
-	if(pfnCPUID)
-	{
-		WIN_CPUInfo.FPPE       = pfnCPUID( 0); //PF_FLOATING_POINT_PRECISION_ERRATA
-		WIN_CPUInfo.FPE        = pfnCPUID( 1); //PF_FLOATING_POINT_EMULATED
-		WIN_CPUInfo.cmpxchg    = pfnCPUID( 2); //PF_COMPARE_EXCHANGE_DOUBLE
-		WIN_CPUInfo.MMX        = pfnCPUID( 3); //PF_MMX_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.PPCMM64    = pfnCPUID( 4); //PF_PPC_MOVEMEM_64BIT_OK
-		WIN_CPUInfo.ALPHAbyte  = pfnCPUID( 5); //PF_ALPHA_BYTE_INSTRUCTIONS
-		WIN_CPUInfo.SSE        = pfnCPUID( 6); //PF_XMMI_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.AMD3DNow   = pfnCPUID( 7); //PF_3DNOW_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.RDTSC      = pfnCPUID( 8); //PF_RDTSC_INSTRUCTION_AVAILABLE
-		WIN_CPUInfo.PAE        = pfnCPUID( 9); //PF_PAE_ENABLED
-		WIN_CPUInfo.SSE2       = pfnCPUID(10); //PF_XMMI64_INSTRUCTIONS_AVAILABLE
-		//WIN_CPUInfo.blank    = pfnCPUID(11); //PF_SSE_DAZ_MODE_AVAILABLE
-		WIN_CPUInfo.DEP        = pfnCPUID(12); //PF_NX_ENABLED
-		WIN_CPUInfo.SSE3       = pfnCPUID(13); //PF_SSE3_INSTRUCTIONS_AVAILABLE
-		WIN_CPUInfo.cmpxchg16b = pfnCPUID(14); //PF_COMPARE_EXCHANGE128
-		WIN_CPUInfo.cmp8xchg16 = pfnCPUID(15); //PF_COMPARE64_EXCHANGE128
-		WIN_CPUInfo.PFC        = pfnCPUID(15); //PF_CHANNELS_ENABLED
-	}
-	GetSystemInfo(&SI);
-	WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
-	WIN_CPUInfo.IA64 = (SI.dwProcessorType == 2200); // PROCESSOR_INTEL_IA64
-	WIN_CPUInfo.AMD64 = (SI.dwProcessorType == 8664); // PROCESSOR_AMD_X8664
-	return &WIN_CPUInfo;
-}
-
-UINT64 I_FileSize(const char *filename)
-{
-	HANDLE fileHandle;
-	DWORD dwSizeHigh, dwSizeLow;
-	UINT64 fileSize = (UINT64)-1;
-
-	fileHandle = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
-		0, NULL);
-	if (fileHandle == (HANDLE)-1)
-		goto erroropening;
-	dwSizeLow = GetFileSize(fileHandle,&dwSizeHigh);
-	if (dwSizeLow == 0xFFFFFFFF && GetLastError() != NO_ERROR)
-		goto errorsizing;
-	fileSize = ((UINT64)(dwSizeHigh)<<32) + dwSizeLow;
-errorsizing:
-	CloseHandle(fileHandle);
-erroropening:
-	return fileSize;
-}
diff --git a/src/win32ce/win_vid.c b/src/win32ce/win_vid.c
deleted file mode 100644
index 4724ca40db595d2d64bcce36694d6a1e2c5c0f4b..0000000000000000000000000000000000000000
--- a/src/win32ce/win_vid.c
+++ /dev/null
@@ -1,865 +0,0 @@
-// Emacs style mode select   -*- C++ -*-
-//-----------------------------------------------------------------------------
-//
-// Copyright (C) 1998-2000 by DooM Legacy Team.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//-----------------------------------------------------------------------------
-/// \file
-/// \brief win32 video driver for Doom Legacy
-
-#include "../doomdef.h"
-
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "../d_clisrv.h"
-#include "../i_system.h"
-#include "../m_argv.h"
-#include "../v_video.h"
-#include "../st_stuff.h"
-#include "../i_video.h"
-#include "../z_zone.h"
-#include "fabdxlib.h"
-
-#include "win_main.h"
-#include "../command.h"
-#include "../screen.h"
-
-#ifdef HWRENDER
-#include "win_dll.h" // loading the render DLL
-#include "../hardware/hw_drv.h" // calling driver init & shutdown
-#include "../hardware/hw_main.h" // calling HWR module init & shutdown
-#endif
-
-// -------
-// Globals
-// -------
-
-// this is the CURRENT rendermode!! very important: used by w_wad, and much other code
-rendermode_t rendermode = render_soft;
-
-// synchronize page flipping with screen refresh
-consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-static consvar_t cv_stretch = {"stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
-
-boolean highcolor;
-
-static BOOL bDIBMode; // means we are using DIB instead of DirectDraw surfaces
-static BITMAPINFO* bmiMain = NULL;
-static HDC hDCMain = NULL;
-
-// -----------------
-// Video modes stuff
-// -----------------
-
-#define MAX_EXTRA_MODES 36
-static vmode_t extra_modes[MAX_EXTRA_MODES] = {{NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, 0}};
-static char names[MAX_EXTRA_MODES][10];
-
-static int numvidmodes; // total number of DirectDraw display modes
-static vmode_t *pvidmodes; // start of videomodes list.
-static vmode_t *pcurrentmode; // the current active videomode.
-static BOOL bWinParm;
-static int WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *pcurrentmode);
-
-// this holds description of the startup video mode,
-// the resolution is 320x200, windowed on the desktop
-#define NUMSPECIALMODES  1
-static char winmode1[] ="320x200W"; // W to make sure it's the windowed mode
-static vmode_t specialmodes[NUMSPECIALMODES] =
-{
-	{
-		NULL,
-		winmode1, // hehe
-		320, 200, //(200.0/320.0)*(320.0/240.0),
-		320, 1, // rowbytes, bytes per pixel
-		1, 2, // windowed (TRUE), numpages
-		NULL,
-		VID_SetWindowedDisplayMode, 0
-	}
-};
-
-// ------
-// Protos
-// ------
-static void VID_Command_NumModes_f(void);
-static void VID_Command_ModeInfo_f(void);
-static void VID_Command_ModeList_f(void);
-static void VID_Command_Mode_f(void);
-static int WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *pcurrentmode);
-static vmode_t *VID_GetModePtr(int modenum);
-static void VID_Init(void);
-static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid);
-
-// -----------------
-// I_StartupGraphics
-// Initialize video mode, setup dynamic screen size variables,
-// and allocate screens.
-// -----------------
-void I_StartupGraphics(void)
-{
-	if (graphics_started)
-		return;
-
-#ifdef HWRENDER
-	if (M_CheckParm("-opengl"))
-		rendermode = render_opengl;
-	else
-		rendermode = render_soft;
-#endif
-
-	if (dedicated)
-		rendermode = render_none;
-	else
-		VID_Init();
-
-	// register exit code for graphics
-	I_AddExitFunc(I_ShutdownGraphics);
-	if (!dedicated) graphics_started = true;
-}
-
-// ------------------
-// I_ShutdownGraphics
-// Close the screen, restore previous video mode.
-// ------------------
-void I_ShutdownGraphics(void)
-{
-	if (!graphics_started)
-		return;
-
-	CONS_Printf("I_ShutdownGraphics()\n");
-
-	//FreeConsole();
-
-	// release windowed startup stuff
-	if (hDCMain)
-	{
-		ReleaseDC(hWndMain, hDCMain);
-		hDCMain = NULL;
-	}
-	if (bmiMain)
-	{
-		GlobalFree(bmiMain);
-		bmiMain = NULL;
-	}
-
-#ifdef HWRENDER
-	if (rendermode != render_soft)
-	{
-		HWR_Shutdown(); // free stuff from the hardware renderer
-		HWD.pfnShutdown(); // close 3d card display
-		Shutdown3DDriver(); // free the driver DLL
-	}
-#endif
-
-	// free the last video mode screen buffers
-	if (vid.buffer)
-	{
-		GlobalFree(vid.buffer);
-		vid.buffer = NULL;
-	}
-
-#ifdef HWRENDER
-	if (rendermode == render_soft)
-#endif
-		CloseDirectDraw();
-
-	graphics_started = false;
-}
-
-// --------------
-// I_UpdateNoBlit
-// --------------
-void I_UpdateNoBlit(void)
-{
-	// what is this?
-}
-
-// --------------
-// I_FinishUpdate
-// --------------
-void I_FinishUpdate(void)
-{
-	int i;
-
-	if (rendermode == render_none)
-		return;
-
-	// draw captions if enabled
-	if (cv_closedcaptioning.value)
-		SCR_ClosedCaptions();
-
-	// display a graph of ticrate
-	if (cv_ticrate.value)
-		SCR_DisplayTicRate();
-
-	//
-	if (bDIBMode)
-	{
-		// paranoia
-		if (!hDCMain || !bmiMain || !vid.buffer)
-			return;
-		// main game loop, still in a window (-win parm)
-		SetDIBitsToDevice(hDCMain, 0, 0, 320, 200, 0, 0, 0, 200, vid.buffer, bmiMain,
-			DIB_RGB_COLORS);
-	}
-	else
-#ifdef HWRENDER
-	if (rendermode != render_soft)
-		HWD.pfnFinishUpdate(cv_vidwait.value);
-	else
-#endif
-	{
-		// DIRECT DRAW
-		// copy virtual screen to real screen
-		// can fail when not active (alt-tab)
-		if (LockScreen())
-		{
-			/// \todo use directX blit here!!? a blit might use hardware with access
-			/// to main memory on recent hardware, and software blit of directX may be
-			/// optimized for p2 or mmx??
-			VID_BlitLinearScreen(screens[0], ScreenPtr, vid.width*vid.bpp, vid.height,
-				vid.width*vid.bpp, ScreenPitch);
-
-			UnlockScreen();
-
-			// swap screens
-			ScreenFlip(cv_vidwait.value);
-		}
-	}
-}
-
-//
-// This is meant to be called only by CONS_Printf() while game startup
-//
-void I_LoadingScreen(LPCSTR msg)
-{
-	RECT rect;
-
-	// paranoia
-	if (!hDCMain || !bmiMain || !vid.buffer)
-		return;
-
-	GetClientRect(vid.WndParent, &rect);
-
-	SetDIBitsToDevice(hDCMain, 0, 0, 320, 200, 0, 0, 0, 200, vid.buffer, bmiMain, DIB_RGB_COLORS);
-
-	if (msg)
-	{
-		if (rect.bottom - rect.top > 32)
-			rect.top = rect.bottom - 32; // put msg on bottom of window
-		SetBkMode(hDCMain, TRANSPARENT);
-		SetTextColor(hDCMain, RGB(0x00, 0x00, 0x00));
-		DrawTextA(hDCMain, msg, -1, &rect, DT_WORDBREAK|DT_CENTER);
-	}
-}
-
-// ------------
-// I_ReadScreen
-// ------------
-void I_ReadScreen(UINT8 *scr)
-{
-	// DEBUGGING
-	if (rendermode != render_soft)
-		I_Error("I_ReadScreen: called while in non-software mode");
-	VID_BlitLinearScreen(screens[0], scr, vid.width*vid.bpp, vid.height, vid.width*vid.bpp,
-		vid.rowbytes);
-}
-
-// ------------
-// I_SetPalette
-// ------------
-void I_SetPalette(RGBA_t *palette)
-{
-	int i;
-
-	if (bDIBMode)
-	{
-		// set palette in RGBQUAD format, NOT THE SAME ORDER as PALETTEENTRY, grmpf!
-		RGBQUAD *pColors;
-		pColors = (RGBQUAD *)((char *)bmiMain + bmiMain->bmiHeader.biSize);
-		ZeroMemory(pColors, sizeof (RGBQUAD)*256);
-		for (i = 0; i < 256; i++, pColors++, palette++)
-		{
-			pColors->rgbRed = palette->s.red;
-			pColors->rgbGreen = palette->s.green;
-			pColors->rgbBlue = palette->s.blue;
-		}
-	}
-	else
-#ifdef HWRENDER
-	 if (rendermode == render_soft)
-#endif
-	{
-		PALETTEENTRY mainpal[256];
-
-		// this clears the 'flag' for each color in palette
-		ZeroMemory(mainpal, sizeof mainpal);
-
-		// set palette in PALETTEENTRY format
-		for (i = 0; i < 256; i++, palette++)
-		{
-			mainpal[i].peRed = palette->s.red;
-			mainpal[i].peGreen = palette->s.green;
-			mainpal[i].peBlue = palette->s.blue;
-		}
-		SetDDPalette(mainpal);         // set DirectDraw palette
-	}
-}
-
-//
-// return number of video modes in pvidmodes list
-//
-INT32 VID_NumModes(void)
-{
-	return numvidmodes - NUMSPECIALMODES; //faB: dont accept the windowed mode 0
-}
-
-// return a video mode number from the dimensions
-// returns any available video mode if the mode was not found
-INT32 VID_GetModeForSize(INT32 w, INT32 h)
-{
-	vmode_t *pv = pvidmodes;
-	int modenum = 0;
-
-	// skip the special modes so that it finds only fullscreen modes
-	for (; pv && modenum < NUMSPECIALMODES; pv = pv->pnext, ++modenum);
-	for (; pv; pv = pv->pnext, ++modenum)
-		if (pv->width == (unsigned)w && pv->height == (unsigned)h)
-			return modenum;
-
-	// if not found, return the first mode available,
-	// preferably a full screen mode (all modes after the 'specialmodes')
-	if (numvidmodes > NUMSPECIALMODES)
-		return NUMSPECIALMODES; // use first full screen mode
-
-	return 0; // no fullscreen mode, use windowed mode
-}
-
-//
-// Enumerate DirectDraw modes available
-//
-static int nummodes = 0;
-static BOOL GetExtraModesCallback(int width, int height, int bpp)
-{
-	CONS_Printf("mode %d x %d x %d bpp\n", width, height, bpp);
-
-	// skip all unwanted modes
-	if (highcolor && bpp != 15)
-		goto skip;
-	if (!highcolor && bpp != 8)
-		goto skip;
-
-	if (bpp > 16 || width > MAXVIDWIDTH || height > MAXVIDHEIGHT)
-		goto skip;
-
-	// check if we have space for this mode
-	if (nummodes >= MAX_EXTRA_MODES)
-	{
-		CONS_Printf("mode skipped (too many)\n");
-		return FALSE;
-	}
-
-	// store mode info
-	extra_modes[nummodes].pnext = &extra_modes[nummodes+1];
-	memset(names[nummodes], 0, 10);
-	snprintf(names[nummodes], 9, "%dx%d", width, height);
-
-	extra_modes[nummodes].name = names[nummodes];
-	extra_modes[nummodes].width = width;
-	extra_modes[nummodes].height = height;
-
-	// exactly, the current FinishUdpate() gets the rowbytes itself after locking the video buffer
-	// so for now we put anything here
-	extra_modes[nummodes].rowbytes = width;
-	extra_modes[nummodes].windowed = false;
-	extra_modes[nummodes].misc = 0; // unused
-	extra_modes[nummodes].pextradata = NULL;
-	extra_modes[nummodes].setmode = VID_SetDirectDrawMode;
-
-	extra_modes[nummodes].numpages = 2; // double-buffer (but this value is unused)
-
-	extra_modes[nummodes].bytesperpixel = (bpp+1)>>3;
-
-	nummodes++;
-skip:
-	return TRUE;
-}
-
-//
-// Collect info about DirectDraw display modes we use
-//
-static inline void VID_GetExtraModes(void)
-{
-	nummodes = 0;
-	EnumDirectDrawDisplayModes(GetExtraModesCallback);
-
-	// add the extra modes (not 320x200) at the start of the mode list (if there are any)
-	if (nummodes)
-	{
-		extra_modes[nummodes-1].pnext = NULL;
-		pvidmodes = &extra_modes[0];
-		numvidmodes += nummodes;
-	}
-}
-
-// ---------------
-// WindowMode_Init
-// Add windowed modes to the start of the list,
-// mode 0 is used for windowed console startup (works on all computers with no DirectX)
-// ---------------
-static void WindowMode_Init(void)
-{
-	specialmodes[NUMSPECIALMODES-1].pnext = pvidmodes;
-	pvidmodes = &specialmodes[0];
-	numvidmodes += NUMSPECIALMODES;
-}
-
-// *************************************************************************************
-// VID_Init
-// Initialize Video modes subsystem
-// *************************************************************************************
-static void VID_Init(void)
-{
-	vmode_t *pv;
-	int iMode;
-
-	// if '-win' is specified on the command line, do not add DirectDraw modes
-	bWinParm = M_CheckParm("-win");
-
-	COM_AddCommand("vid_nummodes", VID_Command_NumModes_f);
-	COM_AddCommand("vid_modeinfo", VID_Command_ModeInfo_f);
-	COM_AddCommand("vid_modelist", VID_Command_ModeList_f);
-	COM_AddCommand("vid_mode", VID_Command_Mode_f);
-
-	CV_RegisterVar(&cv_vidwait);
-	CV_RegisterVar(&cv_stretch);
-
-	// setup the videmodes list,
-	// note that mode 0 must always be VGA mode 0x13
-	pvidmodes = pcurrentmode = NULL;
-	numvidmodes = 0;
-
-	// store the main window handle in viddef struct
-	SetWindowPos(hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOSIZE|SWP_NOMOVE);
-	vid.WndParent = hWndMain;
-	vid.buffer = NULL;
-
-	// we startup in windowed mode using DIB bitmap
-	// we will use DirectDraw when switching fullScreen and entering main game loop
-	bDIBMode = TRUE;
-	bAppFullScreen = FALSE;
-
-#ifdef HWRENDER
-	// initialize the appropriate display device
-	if (rendermode != render_soft)
-	{
-		const char *drvname = NULL;
-
-		switch (rendermode)
-		{
-			case render_opengl:
-				drvname = "r_opengl.dll";
-				break;
-			default:
-				I_Error("Unknown hardware render mode");
-		}
-
-		// load the DLL
-		if (drvname && Init3DDriver(drvname))
-		{
-			int hwdversion = HWD.pfnGetRenderVersion();
-			if (hwdversion != VERSION)
-				CONS_Printf("WARNING: This r_opengl version is not supported, use it at your own risk.\n");
-
-			// perform initialisations
-			HWD.pfnInit(I_Error);
-			// get available display modes for the device
-			HWD.pfnGetModeList(&pvidmodes, &numvidmodes);
-		}
-		else
-		{
-			switch (rendermode)
-			{
-				case render_opengl:
-					I_Error("Error initializing OpenGL");
-				default:
-					break;
-			}
-			rendermode = render_soft;
-		}
-	}
-
-	if (rendermode == render_soft)
-#endif
-		if (!bWinParm)
-		{
-			if (!CreateDirectDrawInstance())
-				I_Error("Error initializing DirectDraw");
-			// get available display modes for the device
-			VID_GetExtraModes();
-		}
-
-	// the game boots in 320x200 standard VGA, but
-	// we need a highcolor mode to run the game in highcolor
-	if (highcolor && !numvidmodes)
-		I_Error("Cannot run in highcolor - No 15bit highcolor DirectX video mode found.");
-
-	// add windowed mode at the start of the list, very important!
-	WindowMode_Init();
-
-	if (!numvidmodes)
-		I_Error("No display modes available.");
-
-	// DEBUG
-	for (iMode = 0, pv = pvidmodes; pv; pv = pv->pnext, iMode++)
-		CONS_Printf("#%02d: %dx%dx%dbpp (desc: '%s')\n", iMode, pv->width, pv->height,
-			pv->bytesperpixel, pv->name);
-
-	// set the startup screen in a window
-	VID_SetMode(0);
-}
-
-// --------------------------
-// VID_SetWindowedDisplayMode
-// Display the startup 320x200 console screen into a window on the desktop,
-// switching to fullscreen display only when we will enter the main game loop.
-// - we can display error message boxes for startup errors
-// - we can set the last used resolution only once, when entering the main game loop
-// --------------------------
-static int WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *pcurrentmode)
-{
-	int iScrWidth, iScrHeight, iWinWidth, iWinHeight;
-
-	pcurrentmode = NULL;
-#ifdef DEBUG
-	CONS_Printf("VID_SetWindowedDisplayMode()\n");
-#endif
-
-	lvid->u.numpages = 1; // not used
-	lvid->direct = NULL; // DOS remains
-	lvid->buffer = NULL;
-
-	// allocate screens
-	if (!VID_FreeAndAllocVidbuffer(lvid))
-		return -1;
-
-	// lvid->buffer should be NULL here!
-
-	bmiMain = (void *)GlobalAlloc(GPTR, sizeof (BITMAPINFO) + (sizeof (RGBQUAD)*256));
-	if (!bmiMain)
-		I_Error("VID_SWDM(): No mem");
-
-	// setup a BITMAPINFO to allow copying our video buffer to the desktop,
-	// with color conversion as needed
-	bmiMain->bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
-	bmiMain->bmiHeader.biWidth = lvid->width;
-	bmiMain->bmiHeader.biHeight= -(lvid->height);
-	bmiMain->bmiHeader.biPlanes = 1;
-	bmiMain->bmiHeader.biBitCount = 8;
-	bmiMain->bmiHeader.biCompression = BI_RGB;
-
-	// center window on the desktop
-	iScrWidth = GetSystemMetrics(SM_CXFULLSCREEN);
-	iScrHeight = GetSystemMetrics(SM_CYFULLSCREEN);
-
-	iWinWidth = lvid->width;
-	iWinWidth += GetSystemMetrics(SM_CXFIXEDFRAME) * 2;
-
-	iWinHeight = lvid->height;
-	iWinHeight += GetSystemMetrics(SM_CYCAPTION);
-	iWinHeight += GetSystemMetrics(SM_CYFIXEDFRAME) * 2;
-
-	if (devparm)
-		MoveWindow(hWndMain, (iScrWidth - iWinWidth), (iScrHeight - iWinHeight), iWinWidth, iWinHeight, TRUE);
-	else
-		MoveWindow(hWndMain, (iScrWidth - iWinWidth)>>1, (iScrHeight - iWinHeight)>>1, iWinWidth, iWinHeight, TRUE);
-
-	SetFocus(hWndMain);
-	ShowWindow(hWndMain, SW_SHOW);
-
-	hDCMain = GetDC(hWndMain);
-	if (!hDCMain)
-		I_Error("VID_SWDM(): GetDC FAILED");
-
-	return 1;
-}
-
-// ========================================================================
-// Returns a vmode_t from the video modes list, given a video mode number.
-// ========================================================================
-vmode_t *VID_GetModePtr(int modenum)
-{
-	vmode_t *pv;
-
-	pv = pvidmodes;
-	if (!pv)
-		I_Error("VID_error: No video mode found\n");
-
-	while (modenum--)
-	{
-		pv = pv->pnext;
-		if (!pv)
-			I_Error("VID_error: Mode not available\n");
-	}
-	return pv;
-}
-
-//
-// return the name of a video mode
-//
-const char *VID_GetModeName(INT32 modenum)
-{
-	return (VID_GetModePtr(modenum))->name;
-}
-
-// ========================================================================
-// Sets a video mode
-// ========================================================================
-INT32 VID_SetMode(INT32 modenum)
-{
-	int stat;
-	vmode_t *pnewmode;
-	vmode_t *poldmode;
-
-	if (dedicated)
-		return 0;
-
-	CONS_Printf("VID_SetMode(%d)\n", modenum);
-
-	// if mode 0 (windowed) we must not be fullscreen already,
-	// if other mode, check it is not mode 0 and existing
-	if (modenum >= numvidmodes)
-	{
-		if (!pcurrentmode)
-			modenum = 0; // revert to the default base vid mode
-		else
-			I_Error("Unknown video mode: %d\n", modenum);
-	}
-	else if (bAppFullScreen && modenum < NUMSPECIALMODES)
-		I_Error("Tried to switch from fullscreen back to windowed mode %d\n", modenum);
-
-	pnewmode = VID_GetModePtr(modenum);
-
-	// dont switch to the same display mode
-	if (pnewmode == pcurrentmode)
-		return 1;
-
-	// initialize the new mode
-	poldmode = pcurrentmode;
-	pcurrentmode = pnewmode;
-
-	// initialize vidbuffer size for setmode
-	vid.width = pcurrentmode->width;
-	vid.height = pcurrentmode->height;
-	vid.rowbytes = pcurrentmode->rowbytes;
-	vid.bpp = pcurrentmode->bytesperpixel;
-	if (modenum) // if not 320x200 windowed mode, it's actually a hack
-	{
-		if (rendermode == render_opengl)
-		{
-			// don't accept depth < 16 for OpenGL mode (too much ugly)
-			if (cv_scr_depth.value < 16)
-				CV_SetValue(&cv_scr_depth,  16);
-			vid.bpp = cv_scr_depth.value/8;
-			vid.u.windowed = (bWinParm || !cv_fullscreen.value);
-			pcurrentmode->bytesperpixel = vid.bpp;
-			pcurrentmode->windowed = vid.u.windowed;
-		}
-	}
-
-	stat = (*pcurrentmode->setmode)(&vid, pcurrentmode);
-
-	if (stat == -1)
-		I_Error("Not enough mem for VID_SetMode\n");
-	else if (stat == -2)
-		I_Error("Couldn't set video mode because it failed the test\n");
-	else if (stat == -3)
-		I_Error("Couldn't set video mode because it failed the change?\n");
-	else if (!stat)
-		I_Error("Couldn't set video mode %d (%dx%d %d bits)\n", modenum, vid.width, vid.height, (vid.bpp*8));// hardware could not setup mode
-	else
-		CONS_Printf(M_GetText("Mode changed to %d (%s)\n"), modenum, pcurrentmode->name);
-
-	vid.modenum = modenum;
-
-	// tell game engine to recalc all tables and realloc buffers based on new values
-	vid.recalc = 1;
-
-	if (modenum < NUMSPECIALMODES)
-	{
-		// we are in startup windowed mode
-		bAppFullScreen = FALSE;
-		bDIBMode = TRUE;
-	}
-	else
-	{
-		// we switch to fullscreen
-		bAppFullScreen = TRUE;
-		bDIBMode = FALSE;
-#ifdef HWRENDER
-		if (rendermode != render_soft)
-		{
-			// purge all patch graphics stored in software format
-			//Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100);
-			HWR_Startup();
-		}
-#endif
-	}
-
-	I_RestartSysMouse();
-	return 1;
-}
-
-// ========================================================================
-// Free the video buffer of the last video mode,
-// allocate a new buffer for the video mode to set.
-// ========================================================================
-static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid)
-{
-	const DWORD vidbuffersize = (lvid->width * lvid->height * lvid->bpp * NUMSCREENS);
-
-	// free allocated buffer for previous video mode
-	if (lvid->buffer)
-		GlobalFree(lvid->buffer);
-
-	// allocate & clear the new screen buffer
-	lvid->buffer = GlobalAlloc(GPTR, vidbuffersize);
-	if (!lvid->buffer)
-		return FALSE;
-
-	ZeroMemory(lvid->buffer, vidbuffersize);
-#ifdef DEBUG
-	CONS_Printf("VID_FreeAndAllocVidbuffer done, vidbuffersize: %x\n",vidbuffersize);
-#endif
-	return TRUE;
-}
-
-// ========================================================================
-// Set video mode routine for DirectDraw display modes
-// Out: 1 ok,
-//              0 hardware could not set mode,
-//     -1 no mem
-// ========================================================================
-static int WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *pcurrentmode)
-{
-	pcurrentmode = NULL;
-#ifdef DEBUG
-	CONS_Printf("VID_SetDirectDrawMode...\n");
-#endif
-
-	// DD modes do double-buffer page flipping, but the game engine doesn't need this..
-	lvid->u.numpages = 2;
-
-	// release ddraw surfaces etc..
-	ReleaseChtuff();
-
-	// clean up any old vid buffer lying around, alloc new if needed
-	if (!VID_FreeAndAllocVidbuffer(lvid))
-		return -1; // no mem
-
-	// should clear video mem here
-
-	// note use lvid->bpp instead of 8...will this be needed? will we support other than 256color
-	// in software ?
-	if (!InitDirectDrawe(hWndMain, lvid->width, lvid->height, 8, TRUE)) // TRUE currently always full screen
-		return 0;               // could not set mode
-
-	// this is NOT used with DirectDraw modes, game engine should never use this directly
-	// but rather render to memory bitmap buffer
-	lvid->direct = NULL;
-
-	if (!cv_stretch.value && (float)vid.width/vid.height != ((float)BASEVIDWIDTH/BASEVIDHEIGHT))
-		vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match
-
-	return 1;
-}
-
-// ========================================================================
-//                     VIDEO MODE CONSOLE COMMANDS
-// ========================================================================
-
-// vid_nummodes
-//
-static void VID_Command_NumModes_f(void)
-{
-	CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes());
-}
-
-// vid_modeinfo <modenum>
-//
-static void VID_Command_ModeInfo_f(void)
-{
-	vmode_t *pv;
-	int modenum;
-
-	if (COM_Argc() != 2)
-		modenum = vid.modenum; // describe the current mode
-	else
-		modenum = atoi(COM_Argv(1)); // the given mode number
-
-	if (modenum >= VID_NumModes() || modenum < NUMSPECIALMODES) // don't accept the windowed mode 0
-	{
-		CONS_Printf(M_GetText("Video mode not present\n"));
-		return;
-	}
-
-	pv = VID_GetModePtr(modenum);
-
-	CONS_Printf("%s\n", VID_GetModeName(modenum));
-	CONS_Printf(M_GetText("width: %d\nheight: %d\n"),
-		pv->width, pv->height);
-	if (rendermode == render_soft)
-		CONS_Printf(M_GetText("bytes per scanline: %d\nbytes per pixel: %d\nnumpages: %d\n"),
-			pv->rowbytes, pv->bytesperpixel, pv->numpages);
-}
-
-// vid_modelist
-//
-static void VID_Command_ModeList_f(void)
-{
-	int i, nummodes;
-	const char *pinfo;
-	vmode_t *pv;
-
-	nummodes = VID_NumModes();
-	for (i = NUMSPECIALMODES; i <= nummodes; i++)
-	{
-		pv = VID_GetModePtr(i);
-		pinfo = VID_GetModeName(i);
-
-		if (pv->bytesperpixel == 1)
-			CONS_Printf("%d: %s\n", i, pinfo);
-		else
-			CONS_Printf("%d: %s (hicolor)\n", i, pinfo);
-	}
-}
-
-// vid_mode <modenum>
-//
-static void VID_Command_Mode_f(void)
-{
-	int modenum;
-
-	if (COM_Argc() != 2)
-	{
-		CONS_Printf(M_GetText("vid_mode <modenum> : set video mode, current video mode %i\n"), vid.modenum);
-		return;
-	}
-
-	modenum = atoi(COM_Argv(1));
-
-	if (modenum >= VID_NumModes() || modenum < NUMSPECIALMODES) // don't accept the windowed mode 0
-		CONS_Printf(M_GetText("Video mode not present\n"));
-	else
-		setmodeneeded = modenum + 1; // request vid mode change
-}
diff --git a/src/win32ce/wince_stuff.c b/src/win32ce/wince_stuff.c
deleted file mode 100644
index eb02e8ae281d32f98c133104b0a2db9f2e9cf74a..0000000000000000000000000000000000000000
--- a/src/win32ce/wince_stuff.c
+++ /dev/null
@@ -1,135 +0,0 @@
-//It's 4am and im writing replacement string functions....
-
-#include <stdlib.h>
-#include <Windows.h>
-#include "wince_stuff.h"
-
-char* _strlwr( char *string )
-{
-	int i;
-
-	if(!string)
-		return NULL;
-
-	for(i=0 ; i < strlen(string); i++)
-	{
-		if((*(string + i) >= 65) && (*(string + i) <= 90))
-			*(string+i) = *(string+i) + 32;
-	}
-
-	return string;
-}
-
-int _strnicmp(const char *first,const char *last, size_t count )
-{
-	int f, l;
-
-	do
-	{
-		if ( ((f = (unsigned char)(*(first++))) >= 'A') && (f <= 'Z') )
-			f -= 'A' - 'a';
-
-		if ( ((l = (unsigned char)(*(last++))) >= 'A') && (l <= 'Z') )
-			l -= 'A' - 'a';
-
-	} while ( --count && f && (f == l) );
-
-	return ( f - l );
-}
-
-
-int _stricmp( const char *dst, const char *src )
-{
-	int f, l;
-
-	do
-	{
-		if ( ((f = (unsigned char)(*(dst++))) >= 'A') && (f <= 'Z') )
-			f -= 'A' - 'a';
-
-		if ( ((l = (unsigned char)(*(src++))) >= 'A') && (l <= 'Z') )
-			l -= 'A' - 'a';
-
-	} while ( f && (f == l) );
-
-	return(f - l);
-}
-
-
-char* _strupr( char *string )
-{
-	int i;
-
-	if(!string)
-		return NULL;
-
-	for(i=0 ; i < strlen(string); i++)
-	{
-		if((*(string + i) >= 97) && (*(string + i) <= 122))
-			*(string + i) = *(string + i) - 32;
-	}
-
-	return string;
-}
-
-
-
-
-int isprint( int c )
-{
-	if(c <= 31)
-		return FALSE;
-
-	return TRUE;
-}
-
-
-
-char* _strdup (const char * string)
-{
-	char *memory = NULL;
-
-	if (!string)
-		return(NULL);
-
-	if (memory = malloc(strlen(string) + 1))
-		return(strcpy(memory,string));
-
-	return(NULL);
-}
-
-
-
-char* strrchr (const char * string,int ch)
-{
-	char *start = (char *)string;
-
-	while (*string++)                       /* find end of string */
-		;
-	/* search towards front */
-	while (--string != start && *string != (char)ch)
-		;
-
-	if (*string == (char)ch)                /* char found ? */
-		return( (char *)string );
-
-	return(NULL);
-}
-
-char* GetMyCWD(void)
-{
-	TCHAR fn[MAX_PATH];
-	char* my_cwd,*p;
-
-	GetModuleFileName(NULL,fn,MAX_PATH);
-
-	my_cwd = (char*)malloc(MAX_PATH*sizeof(char));
-
-	WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR | WC_SEPCHARS, fn, -1, my_cwd, MAX_PATH, NULL, NULL);
-	p = strrchr(my_cwd,'\\');
-
-	if(p)
-		*(p+1) = '\0';
-
-	return my_cwd;
-}
diff --git a/src/win32ce/wince_stuff.h b/src/win32ce/wince_stuff.h
deleted file mode 100644
index 5eab748482c9e09ce7ce6b1e56a7314a3dd68b4e..0000000000000000000000000000000000000000
--- a/src/win32ce/wince_stuff.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef WINCE_STUFF_H
-#define WINCE_STUFF_H
-
-/*
-char* _strlwr(char *string);
-int _strnicmp(const char *string1,const char *string2, size_t count );
-int _stricmp( const char *string1, const char *string2 );
-char* _strupr( char *string );
-
-char *_strdup( const char *strSource );
-char *strrchr( const char *string, int c );
-
-int isprint( int c );
-*/
-char* GetMyCWD(void);
-
-#endif
\ No newline at end of file
diff --git a/src/y_inter.c b/src/y_inter.c
index 55ceea03471ed4098a5f32030aafd4eba232dab7..185a6c1fe28bb0185bc7cc2569e6d095e7ffcbe9 100644
--- a/src/y_inter.c
+++ b/src/y_inter.c
@@ -57,7 +57,7 @@ typedef union
 {
 	struct
 	{
-		char passed1[14]; // KNUCKLES GOT    / CRAWLA HONCHO
+		char passed1[21]; // KNUCKLES GOT    / CRAWLA HONCHO
 		char passed2[16]; // THROUGH THE ACT / PASSED THE ACT
 		INT32 passedx1;
 		INT32 passedx2;
@@ -77,7 +77,7 @@ typedef union
 
 	struct
 	{
-		char passed1[SKINNAMESIZE+1]; // KNUCKLES GOT    / CRAWLA HONCHO
+		char passed1[29]; // KNUCKLES GOT    / CRAWLA HONCHO
 		char passed2[17];             // A CHAOS EMERALD / GOT THEM ALL!
 		char passed3[15];             //                   CAN NOW BECOME
 		char passed4[SKINNAMESIZE+7]; //                   SUPER CRAWLA HONCHO
@@ -974,7 +974,7 @@ void Y_StartIntermission(void)
 {
 	INT32 i;
 	UINT8 completionEmblems = M_CompletionEmblems();
-	
+
 	intertic = -1;
 
 #ifdef PARANOIA
@@ -1049,6 +1049,7 @@ void Y_StartIntermission(void)
 
 			// fall back into the coop intermission for now
 			intertype = int_coop;
+			/* FALLTHRU */
 		case int_coop: // coop or single player, normal level
 		{
 			// award time and ring bonuses
@@ -1070,7 +1071,7 @@ void Y_StartIntermission(void)
 
 				if (modeattacking == ATTACKING_RECORD)
 					Y_UpdateRecordReplays();
-				
+
 				if (completionEmblems)
 					CONS_Printf(M_GetText("\x82" "Earned %hu emblem%s for level completion.\n"), (UINT16)completionEmblems, completionEmblems > 1 ? "s" : "");
 			}
@@ -1165,6 +1166,7 @@ void Y_StartIntermission(void)
 
 			// fall back into the special stage intermission for now
 			intertype = int_spec;
+			/* FALLTHRU */
 		case int_spec: // coop or single player, special stage
 		{
 			// Update visitation flags?
@@ -1172,7 +1174,7 @@ void Y_StartIntermission(void)
 			{
 				if (!stagefailed)
 					mapvisited[gamemap-1] |= MV_BEATEN;
-				
+
 				// all emeralds/ultimate/perfect emblems won't be possible in ss, oh well?
 				if (completionEmblems)
 					CONS_Printf(M_GetText("\x82" "Earned %hu emblem%s for level completion.\n"), (UINT16)completionEmblems, completionEmblems > 1 ? "s" : "");
diff --git a/src/z_zone.c b/src/z_zone.c
index eecb6e808d33d58085d98cd42a199f6af49d9671..a28ea87b035d3e0e7e5c7ca3ae7005aea541524e 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -220,10 +220,6 @@ static void *xm(size_t size)
 
 		if (p == NULL)
 		{
-#if defined (_NDS) | defined (_PSP)
-			// Temporary-ish debugging measure
-			Command_Memfree_f();
-#endif
 			I_Error("Out of memory allocating %s bytes", sizeu1(size));
 		}
 	}
diff --git a/src/z_zone.h b/src/z_zone.h
index cd5fb2f7cd3a82a3b6fd70adfea06a22b55ec986..552fd87baeb8556611cf38e8c2eec4b24f44a188 100644
--- a/src/z_zone.h
+++ b/src/z_zone.h
@@ -116,10 +116,6 @@ char *Z_StrDup(const char *in);
 #define Z_SetUser(p,u) Z_SetUser2(p, u)
 #endif
 
-#ifdef _NDS ///TODO: need a lock reference system
-#define Z_Unlock(p) Z_ChangeTag(p, PU_CACHE_UNLOCKED)
-#else
 #define Z_Unlock(p) (void)p
-#endif
 
 #endif