diff --git a/SRB2.cbp b/SRB2.cbp
index 628e7da30a48f8e93ce047e767850fe05bad2b0c..4834563ec842f1d4386a0a0f745f080bef189381 100644
--- a/SRB2.cbp
+++ b/SRB2.cbp
@@ -33,7 +33,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-g" />
 					<Add option="`sdl-config --cflags`" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DPARANOIA" />
 					<Add option="-DRANGECHECK" />
 					<Add option="-D_DEBUG" />
@@ -56,7 +56,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-g" />
 					<Add option="`sdl-config --cflags`" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DNDEBUG" />
 					<Add option="-DCOMPVERSION" />
 					<Add option="-DHAVE_BLUA" />
@@ -77,7 +77,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="`sdl-config --cflags`" />
 					<Add option="`libpng-config --cflags`" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHWRENDER" />
 					<Add option="-DHW3SOUND" />
@@ -107,7 +107,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="`sdl-config --cflags`" />
 					<Add option="`libpng-config --cflags`" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHWRENDER" />
 					<Add option="-DHW3SOUND" />
@@ -138,7 +138,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
 					<Add option="-DUSE_WGL_SWAP" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHWRENDER" />
 					<Add option="-DHW3SOUND" />
@@ -185,7 +185,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-D__USE_MINGW_ANSI_STDIO=0" />
 					<Add option="-DUSE_WGL_SWAP" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHAVE_FMOD" />
 					<Add option="-DHWRENDER" />
@@ -551,7 +551,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-DSTDC_HEADERS" />
 					<Add option="-DUSE_WGL_SWAP" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHWRENDER" />
 					<Add option="-DHW3SOUND" />
@@ -592,7 +592,7 @@ HW3SOUND for 3D hardware sound  support
 					<Add option="-DSTDC_HEADERS" />
 					<Add option="-DUSE_WGL_SWAP" />
 					<Add option="-DDIRECTFULLSCREEN" />
-					<Add option="-DSDL" />
+					<Add option="-DHAVE_SDL" />
 					<Add option="-DHAVE_MIXER" />
 					<Add option="-DHWRENDER" />
 					<Add option="-DHW3SOUND" />
diff --git a/Srb2.dev b/Srb2.dev
index 00b7811e1d53f952ec2620c542bd4f83fa160a53..21683e7c3c5e055393d91778fba3405bfae240de 100644
--- a/Srb2.dev
+++ b/Srb2.dev
@@ -2228,7 +2228,7 @@ Includes=libs/libpng-src;libs/zlib;libs
 Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
 ResourceIncludes=src/win32
 MakeIncludes=comptime.mk;cpdebug.mk
-Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
+Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
 CppCompiler=-Os_@@_-g_@@_-gdwarf-2_@@_
 Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
 PreprocDefines=NORMALSRB2_@@_
@@ -2305,7 +2305,7 @@ Includes=libs/libpng-src;libs/zlib;libs
 Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw32
 ResourceIncludes=src/win32
 MakeIncludes=comptime.mk;cpdebug.mk
-Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
+Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-gdwarf-2_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
 CppCompiler=-O0_@@_-g_@@_-gdwarf-2_@@_
 Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng32_@@_-lz32_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
 PreprocDefines=NORMALSRB2_@@_
@@ -2386,7 +2386,7 @@ Includes=libs/libpng-src;libs/zlib;libs
 Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
 ResourceIncludes=src/win32
 MakeIncludes=comptime.mk;cpdebug.mk
-Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
+Compiler=-DNDEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-Os_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
 CppCompiler=-Os_@@_-g_@@_
 Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
 PreprocDefines=NORMALSRB2_@@_
@@ -2413,7 +2413,7 @@ Includes=libs/libpng-src;libs/zlib;libs
 Libs=libs/libpng-src/projects;libs/zlib/win32;libs/miniupnpc/mingw64
 ResourceIncludes=src/win32
 MakeIncludes=comptime.mk;cpdebug.mk
-Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DSDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
+Compiler=-D_DEBUG_@@_-fno-exceptions_@@_-DSTDC_HEADERS_@@_-Wall_@@_-O0_@@_-g_@@_-DUSE_WGL_SWAP_@@_-DDIRECTFULLSCREEN_@@_-DHAVE_SDL_@@_-DHWRENDER_@@_-DHW3SOUND_@@_-DHAVE_MIXER_@@_-DHAVE_PNG_@@_-D__USE_MINGW_ANSI_STDIO=0_@@_-DHAVE_MINIUPNPC_@@_-DSTATIC_MINIUPNPC_@@_-DHAVE_BLUA_@@_
 CppCompiler=-O0_@@_-g_@@_
 Linker=-lSDL_@@_-lSDL_Mixer_@@_-lpng64_@@_-lz64_@@_-lminiupnpc_@@_-lws2_32_@@_-liphlpapi_@@_-mconsole_@@_
 PreprocDefines=NORMALSRB2_@@_
diff --git a/libs/fmodex/lib/libfmodex64_vc.a b/libs/fmodex/lib/libfmodex64_vc.a
deleted file mode 100644
index 77a761d3482057cfe3fae1c8ed8296e3d9273edf..0000000000000000000000000000000000000000
Binary files a/libs/fmodex/lib/libfmodex64_vc.a and /dev/null differ
diff --git a/libs/fmodex/lib/libfmodexL64_vc.a b/libs/fmodex/lib/libfmodexL64_vc.a
deleted file mode 100644
index 6c008895c2ad15b95d9e71b75e6e34958082b923..0000000000000000000000000000000000000000
Binary files a/libs/fmodex/lib/libfmodexL64_vc.a and /dev/null differ
diff --git a/libs/fmodex/lib/libfmodexL_vc.a b/libs/fmodex/lib/libfmodexL_vc.a
deleted file mode 100644
index 63b6ee4fa082a5416da945ca52424cd425ea2fba..0000000000000000000000000000000000000000
Binary files a/libs/fmodex/lib/libfmodexL_vc.a and /dev/null differ
diff --git a/libs/fmodex/lib/libfmodex_vc.a b/libs/fmodex/lib/libfmodex_vc.a
deleted file mode 100644
index ec169885fc2b43c3f24d5190205c4413e1ab8282..0000000000000000000000000000000000000000
Binary files a/libs/fmodex/lib/libfmodex_vc.a and /dev/null differ
diff --git a/src/Makefile b/src/Makefile
index 9aa96efe279533d98600093059de3747a7373bdc..f5d58af3a1aa6c6ed082cf2f3aca581c105108a0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -10,7 +10,7 @@
 #     -DPC_DOS    -> use DOS specific code (eg:textmode stuff)...
 #     -DLINUX     -> use for the GNU/Linux specific
 #     -D_WINDOWS  -> use for the Win32/DirectX specific
-#     -DSDL       -> use for the SDL interface
+#     -DHAVE_SDL  -> use for the SDL interface
 #
 # Sets:
 #     Compile the DGJPP/DOS version with 'make WATTCP=1'
diff --git a/src/Makefile.cfg b/src/Makefile.cfg
index ccf84165f2db242b227c01b0773a834e5c47f040..1ea96df925c1d8594bd026698e1e8d253f209000 100644
--- a/src/Makefile.cfg
+++ b/src/Makefile.cfg
@@ -230,7 +230,6 @@ ifdef DUMMY
 	BIN:=$(BIN)/dummy
 else
 ifdef LINUX
-	INTERFACE=sdl
 	NASMFORMAT=elf -DLINUX
 	SDL=1
 ifndef NOGETTEXT
diff --git a/src/console.c b/src/console.c
index f8d31a6988cea95fee18d4123e82b55bab346ad7..5f8dd2bb2b4f0a2f551f43838f4e2728aeede42e 100644
--- a/src/console.c
+++ b/src/console.c
@@ -1139,7 +1139,7 @@ void CONS_Printf(const char *fmt, ...)
 	// if not in display loop, force screen update
 	if (con_startup)
 	{
-#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (SDL))
+#if (defined (_WINDOWS)) || (defined (__OS2__) && !defined (HAVE_SDL))
 		static lumpnum_t con_backpic_lumpnum = UINT32_MAX;
 		patch_t *con_backpic;
 
diff --git a/src/d_main.c b/src/d_main.c
index 2f3dd8b619da9e0bb78533029e6557169171255d..b0d248ef23e41e4bd73984cad0e391868c2012a6 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -731,7 +731,7 @@ static void IdentifyVersion(void)
 	char *srb2wad1, *srb2wad2;
 	const char *srb2waddir = NULL;
 
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	// change to the directory where 'srb2.srb' is found
 	srb2waddir = I_LocateWad();
 #endif
@@ -757,7 +757,7 @@ static void IdentifyVersion(void)
 		}
 	}
 
-#if defined (macintosh) && !defined (SDL)
+#if defined (macintosh) && !defined (HAVE_SDL)
 	// cwd is always "/" when app is dbl-clicked
 	if (!stricmp(srb2waddir, "/"))
 		srb2waddir = I_GetWadDir();
@@ -804,7 +804,7 @@ static void IdentifyVersion(void)
 	// Add our crappy patches to fix our bugs
 	D_AddFile(va(pandf,srb2waddir,"patch.dta"));
 
-#if !defined (SDL) || defined (HAVE_MIXER)
+#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
 	{
 #if defined (DC) && 0
 		const char *musicfile = "music_dc.dta";
@@ -929,7 +929,7 @@ void D_SRB2Main(void)
 	D_Titlebar(srb2, title);
 #endif
 
-#if defined (__OS2__) && !defined (SDL)
+#if defined (__OS2__) && !defined (HAVE_SDL)
 	// set PM window title
 	snprintf(pmData->title, sizeof (pmData->title),
 		"Sonic Robo Blast 2" VERSIONSTRING ": %s",
@@ -1136,7 +1136,7 @@ void D_SRB2Main(void)
 
 	G_LoadGameData();
 
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen
 #endif
 
diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 1a1777a4d3e0e352d42b8aa24ef7e990b2970bbf..62531598addcfc3a0615fbf4d8cdfe400e13fba9 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -258,7 +258,7 @@ consvar_t cv_usejoystick = {"use_joystick", "0", CV_SAVE|CV_CALL, usejoystick_co
 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 (SDL))
+#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};
 consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
diff --git a/src/doomdef.h b/src/doomdef.h
index 3ce330af19f00245638ec5062e7d735d3501793e..df61c49996a0071f0b4cbe40f13a9a507f50db1d 100644
--- a/src/doomdef.h
+++ b/src/doomdef.h
@@ -24,7 +24,7 @@
 #define SOUND_FMOD    3
 
 #ifndef SOUND
-#ifdef SDL
+#ifdef HAVE_SDL
 
 // Use Mixer interface?
 #ifdef HAVE_MIXER
diff --git a/src/hardware/hw3dsdrv.h b/src/hardware/hw3dsdrv.h
index 4938f87638e3cdf621da44b356cf244bd21ec640..8811d4546df376aa72a2524ad184a66e16db706c 100644
--- a/src/hardware/hw3dsdrv.h
+++ b/src/hardware/hw3dsdrv.h
@@ -24,7 +24,7 @@
 #include "hw_dll.h"
 #include "hws_data.h"
 
-#if defined (SDL) || !defined (HWD)
+#if defined (HAVE_SDL) || !defined (HWD)
 EXPORT void HWRAPI(Shutdown) (void);
 #endif
 
diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h
index 77db10805a9f3ef971a3f5eeff093fe2226d02f2..a6525a2f5ce029e430e3ff9adba2211594191dc1 100644
--- a/src/hardware/hw_data.h
+++ b/src/hardware/hw_data.h
@@ -26,7 +26,7 @@
 #include <windows.h>
 #endif
 
-#if defined (VID_X11) && !defined (SDL)
+#if defined (VID_X11) && !defined (HAVE_SDL)
 #include <GL/glx.h>
 #endif
 
diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h
index 854e7aaaf15373ade9df7b85d0d2b395e8ee6fff..76fce5e475172bdf3fe39577ff83f696434f5aee 100644
--- a/src/hardware/hw_drv.h
+++ b/src/hardware/hw_drv.h
@@ -32,12 +32,12 @@
 //                                                       STANDARD DLL EXPORTS
 // ==========================================================================
 
-#ifdef SDL
+#ifdef HAVE_SDL
 #undef VID_X11
 #endif
 
 EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
-#ifndef SDL
+#ifndef HAVE_SDL
 EXPORT void HWRAPI(Shutdown) (void);
 #endif
 #ifdef _WINDOWS
@@ -116,7 +116,7 @@ struct hwdriver_s
 	HookXwin            pfnHookXwin;
 	GetRenderer         pfnGetRenderer;
 #endif
-#ifndef SDL
+#ifndef HAVE_SDL
 	Shutdown            pfnShutdown;
 #endif
 #ifdef SHUFFLE
diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c
index 2e57ae6e37c8c8aa67af704a842b2170702f712b..b853f084e00166dd6f91a37bef2bbdabe8498baa 100644
--- a/src/hardware/r_opengl/r_opengl.c
+++ b/src/hardware/r_opengl/r_opengl.c
@@ -163,7 +163,7 @@ static I_Error_t I_Error_GL = NULL;
 //                  : else do nothing
 // Returns          :
 // -----------------+
-#if !(defined (SDL) && defined (STATIC3DS))
+#if !(defined (HAVE_SDL) && defined (STATIC3DS))
 FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
 {
 #ifdef DEBUG_TO_FILE
diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h
index 875ac6fba51ace7a8c4840dbc4b78339fd71a5f8..fd018f4b13c1b73b92761b88ed137ef6389cff7f 100644
--- a/src/hardware/r_opengl/r_opengl.h
+++ b/src/hardware/r_opengl/r_opengl.h
@@ -20,7 +20,7 @@
 #ifndef _R_OPENGL_H_
 #define _R_OPENGL_H_
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #ifdef _MSC_VER
 #pragma warning(disable : 4214 4244)
@@ -50,7 +50,7 @@
 
 #undef DEBUG_TO_FILE            // maybe defined in previous *.h
 #define DEBUG_TO_FILE           // output debugging msgs to ogllog.txt
-#if defined ( SDL ) && !defined ( LOGMESSAGES )
+#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
 #undef DEBUG_TO_FILE
 #endif
 
@@ -109,7 +109,7 @@ extern PFNglGetString pglGetString;
 
 extern const GLubyte    *gl_extensions;
 extern RGBA_t           myPaletteData[];
-#ifndef SDL
+#ifndef HAVE_SDL
 extern FILE             *logstream;
 #endif
 extern GLint            screen_width;
diff --git a/src/hardware/s_ds3d/s_ds3d.c b/src/hardware/s_ds3d/s_ds3d.c
index 2cbf95599c124c066ccce658f6e3f362b827fe56..5299c1795b2567ee73ba4e73677f2d634358b33e 100644
--- a/src/hardware/s_ds3d/s_ds3d.c
+++ b/src/hardware/s_ds3d/s_ds3d.c
@@ -48,7 +48,7 @@
 #undef DEBUG_TO_FILE
 #define DEBUG_TO_FILE
 
-#if defined ( SDL ) && !defined ( LOGMESSAGES )
+#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
 #undef DEBUG_TO_FILE
 #endif
 
diff --git a/src/hardware/s_fmod/s_fmod.c b/src/hardware/s_fmod/s_fmod.c
index 849fd44fa4bd595154862979fdf095c0931c2e21..120d6354049be2ac58dd3d6addbb37b1d952a1cb 100644
--- a/src/hardware/s_fmod/s_fmod.c
+++ b/src/hardware/s_fmod/s_fmod.c
@@ -55,7 +55,7 @@ FILE *logstream = NULL;
 #define MAXCHANNEL 1024
 
 #undef DEBUG_TO_FILE
-#if defined ( SDL ) && !defined ( LOGMESSAGES )
+#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
 #define DEBUG_TO_FILE
 #endif
 
@@ -1187,7 +1187,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module
 	}
 	return TRUE; // Successful DLL_PROCESS_ATTACH.
 }
-#elif !defined (SDL)
+#elif !defined (HAVE_SDL)
 
 // **************************************************************************
 //                                                                  FUNCTIONS
diff --git a/src/hardware/s_openal/s_openal.c b/src/hardware/s_openal/s_openal.c
index ad842bde31d9a6638a3cb40a404169e2f259b29f..7f91ccf2c3de400608e6e16cf04da81ebb99adb3 100644
--- a/src/hardware/s_openal/s_openal.c
+++ b/src/hardware/s_openal/s_openal.c
@@ -31,7 +31,7 @@ FILE* logstream = NULL;
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
-#ifndef SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
+#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
 FILE* logstream = NULL;
 #endif
 #endif
@@ -49,7 +49,7 @@ FILE* logstream = NULL;
 #include "../hw3dsdrv.h"
 
 //#undef DEBUG_TO_FILE
-//#if defined ( SDL ) && !defined ( LOGMESSAGES )
+//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
 #define DEBUG_TO_FILE
 //#endif
 
diff --git a/src/m_menu.c b/src/m_menu.c
index 887ac5fcb3588480ca26bb6ecefdc16ef0f931d9..653576f4e25ed160da4248bc941bcb8ea2c3943d 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1110,7 +1110,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
 	{IT_SUBMENU|IT_STRING, NULL,   "3D Card Options...",  &OP_OpenGLOptionsDef,    20},
 #endif
 
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	{IT_STRING|IT_CVAR,      NULL, "Fullscreen",          &cv_fullscreen,    30},
 #endif
 
@@ -6827,7 +6827,7 @@ static void M_VideoModeMenu(INT32 choice)
 
 	memset(modedescs, 0, sizeof(modedescs));
 
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	VID_PrepareModeList(); // FIXME: hack
 #endif
 	vidm_nummodes = 0;
diff --git a/src/m_misc.c b/src/m_misc.c
index bb0bb046007370a064c692d923e249bf43bd9492..73d17c00d8e43e95b01802f314b9b757ecf6efed 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -47,8 +47,11 @@
 #include "hardware/hw_main.h"
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 #include "sdl/hwsym_sdl.h"
+#ifdef __linux__
+typedef off_t off64_t;
+#endif
 #endif
 
 #if defined (_WIN32)
@@ -651,7 +654,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
 	char Movietxt[] = "SRB2 Movie";
 	size_t i;
 	char interfacetxt[] =
-#ifdef SDL
+#ifdef HAVE_SDL
 	 "SDL";
 #elif defined (_WINDOWS)
 	 "DirectX";
@@ -806,7 +809,7 @@ static inline boolean M_PNGLib(void)
 		pnglib = GetModuleHandleA("libpng12.dll");
 	if (!pnglib)
 		pnglib = GetModuleHandleA("libpng13.dll");
-#elif defined (SDL)
+#elif defined (HAVE_SDL)
 #ifdef __APPLE__
 	pnglib = hwOpen("libpng.dylib");
 #else
@@ -815,7 +818,7 @@ static inline boolean M_PNGLib(void)
 #endif
 	if (!pnglib)
 		return false;
-#ifdef SDL
+#ifdef HAVE_SDL
 	apng_set_acTL = hwSym("png_set_acTL", pnglib);
 	apng_write_frame_head = hwSym("png_write_frame_head", pnglib);
 	apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib);
diff --git a/src/s_sound.c b/src/s_sound.c
index 6e6c492a38d7453ecb3e9569a5215cde54ddbc42..b48b60a059bcbfae169c406e03203aefcbc67f1e 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -253,7 +253,7 @@ void S_RegisterSoundStuff(void)
 	CV_RegisterVar(&surround);
 	CV_RegisterVar(&cv_samplerate);
 
-#if defined (macintosh) && !defined (SDL) // mp3 playlist stuff
+#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
 	{
 		INT32 i;
 		for (i = 0; i < PLAYLIST_LENGTH; i++)
@@ -761,7 +761,7 @@ void S_PauseSound(void)
 	}
 
 	// pause cd music
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	I_PauseCD();
 #else
 	I_StopCD();
@@ -1050,7 +1050,7 @@ static boolean S_MIDIMusic(musicinfo_t *music, boolean looping)
 
 	// load & register it
 	music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC);
-#if defined (macintosh) && !defined (SDL)
+#if defined (macintosh) && !defined (HAVE_SDL)
 	music->handle = I_RegisterSong(music_num);
 #else
 	music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
@@ -1154,7 +1154,7 @@ void S_StopMusic(void)
 	I_StopSong(mus_playing->handle);
 	I_UnRegisterSong(mus_playing->handle);
 
-#ifndef SDL //SDL uses RWOPS
+#ifndef HAVE_SDL //SDL uses RWOPS
 	Z_ChangeTag(mus_playing->data, PU_CACHE);
 #endif
 
diff --git a/src/s_sound.h b/src/s_sound.h
index 200b5bb3fb17229b327d6314539a5a901e3b681c..6589ca598657c7e63222297e641f10f5e76b9b1b 100644
--- a/src/s_sound.h
+++ b/src/s_sound.h
@@ -37,7 +37,7 @@ extern CV_PossibleValue_t soundvolume_cons_t[];
 //part of i_cdmus.c
 extern consvar_t cd_volume, cdUpdate;
 
-#if defined (macintosh) && !defined (SDL)
+#if defined (macintosh) && !defined (HAVE_SDL)
 typedef enum
 {
 	music_normal,
diff --git a/src/sdl/MakeNIX.cfg b/src/sdl/MakeNIX.cfg
index 457f52301f69d458486abb6320f55dec40d0e3c2..f5c9b20750ec560ea144ee797eab492e5b6c9ec8 100644
--- a/src/sdl/MakeNIX.cfg
+++ b/src/sdl/MakeNIX.cfg
@@ -30,6 +30,10 @@ ifdef NOTERMIOS
 endif
 endif
 
+ifdef LINUX64
+	OPTS+=-DLINUX64
+endif
+
 #
 #here is Solaris
 #
@@ -89,4 +93,4 @@ ifndef NOHW
 endif
 
 	# name of the exefile
-	EXENAME?=lsdlsrb2
+	EXENAME?=lsdl2srb2
diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg
index 1f9c7204ffa45d200c2ab9c08b64db19e88abc31..3b92a9fb8f03301d6bfbb381c76a47ea7a6cd743 100644
--- a/src/sdl/Makefile.cfg
+++ b/src/sdl/Makefile.cfg
@@ -43,9 +43,9 @@ SDL_CFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --cflags)
 SDL_LDFLAGS?=$(shell $(PKG_CONFIG) $(SDL_PKGCONFIG) --libs)
 else
 ifdef PREFIX
-	SDL_CONFIG?=$(PREFIX)-sdl-config
+	SDL_CONFIG?=$(PREFIX)-sdl2-config
 else
-	SDL_CONFIG?=sdl-config
+	SDL_CONFIG?=sdl2-config
 endif
 
 ifdef STATIC
@@ -67,7 +67,7 @@ endif
 
 	OBJS+=$(OBJDIR)/i_video.o $(OBJDIR)/dosstr.o $(OBJDIR)/endtxt.o $(OBJDIR)/hwsym_sdl.o
 
-	OPTS+=-DDIRECTFULLSCREEN -DSDL
+	OPTS+=-DDIRECTFULLSCREEN -DHAVE_SDL
 
 ifndef NOHW
 	OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
@@ -95,33 +95,28 @@ 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
+	SDL_LDFLAGS+=-lSDL2_mixer
 endif
 
 ifdef SDL_TTF
 	OPTS+=-DHAVE_TTF
-	SDL_LDFLAGS+=-lSDL_ttf -lfreetype -lz
+	SDL_LDFLAGS+=-lSDL2_ttf -lfreetype -lz
 	OBJS+=$(OBJDIR)/i_ttf.o
 endif
 
-#ifdef SDL_IMAGE
-#	OPTS+=-DHAVE_IMAGE
-#	SDL_LDFLAGS+=-lSDL_image
-#endif
+ifdef SDL_IMAGE
+	OPTS+=-DHAVE_IMAGE
+	SDL_LDFLAGS+=-lSDL2_image
+endif
 
 ifdef SDL_NET
 	OPTS+=-DHAVE_SDLNET
-	SDL_LDFLAGS+=-lSDL_net
+	SDL_LDFLAGS+=-lSDL2_net
 endif
 
 ifdef SDLMAIN
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index 192f191561fdb2441a1bb8ce6c630ab565039da4..958cd7d02877eac200c0baee40ec625a093f60a5 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -96,7 +96,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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>
@@ -145,7 +145,7 @@
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <AdditionalIncludeDirectories>$(ProjectDir)..\..\libs\libpng-src;$(ProjectDir)..\..\libs\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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>
@@ -202,7 +202,7 @@
       <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;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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>
@@ -258,7 +258,7 @@
       <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;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;COMPVERSION;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <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>
@@ -1461,4 +1461,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/sdl/Srb2SDL-vc9.vcproj b/src/sdl/Srb2SDL-vc9.vcproj
index 620202bdfe240232db540e282739d2217f2bd39b..d2a268f8d44f501b141ffa4de48eea5fed1e5f32 100644
--- a/src/sdl/Srb2SDL-vc9.vcproj
+++ b/src/sdl/Srb2SDL-vc9.vcproj
@@ -50,7 +50,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+				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"
@@ -145,7 +145,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
-				PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+				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"
@@ -248,7 +248,7 @@
 				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;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+				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"
@@ -350,7 +350,7 @@
 				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;SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+				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"
diff --git a/src/sdl/Srb2SDL.dsp b/src/sdl/Srb2SDL.dsp
index 02c3b270109e383127375df4b1dfaa860b728f4b..879113ca2f0d7c6f8a71e7e709303224046cb91f 100644
--- a/src/sdl/Srb2SDL.dsp
+++ b/src/sdl/Srb2SDL.dsp
@@ -45,7 +45,7 @@ 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 "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /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
@@ -72,7 +72,7 @@ LINK32=link.exe
 # 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 "SDL" /D "HWRENDER" /D "HW3SOUND" /D "HAVE_FILTER" /D "HAVE_MIXER" /D "USEASM" /D "HAVE_PNG" /FR /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"
diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c
index 43c71f7bf2274980ae56e2c354a7aa8212fa1f73..44ddf830ca43f4eafc8049c31089b7ecb2a6d1cd 100644
--- a/src/sdl/hwsym_sdl.c
+++ b/src/sdl/hwsym_sdl.c
@@ -29,7 +29,7 @@
 #pragma warning(disable : 4214 4244)
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #include "SDL.h"
 
diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c
index adab39c902ce9ed215f630a7daaf76c2477f050f..fc35eb9cf0bec5ac8532c6ae6ec4f685592b51ab 100644
--- a/src/sdl/i_cdmus.c
+++ b/src/sdl/i_cdmus.c
@@ -1,588 +1,38 @@
-// 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 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"
+#include "../i_sound.h"
 
-#define MAX_CD_TRACKS 256
-
-#ifdef _XBOX
-INT32  SDL_SYS_CDInit(void)
-{
-	return(0);
-}
-
-void SDL_SYS_CDQuit(void)
-{
-	return;
-}
-#endif
+//
+// CD MUSIC I/O
+//
 
-UINT8 cdaudio_started = 0;   // for system startup/shutdown
+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};
 
-#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"));
+void I_InitCD(void){}
 
-	// Initialize SDL first
-	if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
-	{
-		CONS_Printf(M_GetText("Couldn't initialize SDL CDROM: %s\n"), SDL_GetError());
-		return;
-	}
+void I_StopCD(void){}
 
-	// Open drive
-	cdrom = SDL_CDOpen(0);
+void I_PauseCD(void){}
 
-	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;
-	}
+void I_ResumeCD(void){}
 
-	for (i = 0; i < MAX_CD_TRACKS; i++)
-		cdRemap[i] = (Uint8)i;
+void I_ShutdownCD(void){}
 
-	cdaudio_started = true;
-	if (cdrom) cdEnabled = SDL_TRUE;
+void I_UpdateCD(void){}
 
-	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)
+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)
+boolean I_SetVolumeCD(int 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/sdl/i_main.c b/src/sdl/i_main.c
index 85abb704144a650f70d0308879f945361d28c1d0..1c438e0834f97aed1c15d962c9e982c246892921 100644
--- a/src/sdl/i_main.c
+++ b/src/sdl/i_main.c
@@ -48,7 +48,7 @@ PSP_MAIN_THREAD_NAME("SRB2");
 PSP_MAIN_THREAD_STACK_SIZE_KB(256);
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #ifdef HAVE_TTF
 #include "SDL.h"
diff --git a/src/sdl/i_net.c b/src/sdl/i_net.c
index c31935acf237edbeba60b25d65ae416f4af11eae..ee4a34c13dd8d4d10950d53d972d0cf873068943 100644
--- a/src/sdl/i_net.c
+++ b/src/sdl/i_net.c
@@ -32,7 +32,7 @@
 
 #include "../i_tcp.h"
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #ifdef HAVE_SDLNET
 
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 1e03edd88382245dea28ea95ea4ecad8b27df1f4..cfc2e210da91fd07267deb58fd58a0a2062628ae 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -73,7 +73,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s?
 #pragma warning(disable : 4214 4244)
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #include "SDL.h"
 
@@ -996,8 +996,8 @@ void I_GetJoystickEvents(void)
 	UINT64 joyhats = 0;
 #if 0
 	UINT64 joybuttons = 0;
-	Sint16 axisx, axisy;
 #endif
+	Sint16 axisx, axisy;
 
 	if (!joystick_started) return;
 
@@ -1070,7 +1070,6 @@ void I_GetJoystickEvents(void)
 		}
 	}
 
-#if 0
 	// send joystick axis positions
 	event.type = ev_joystick;
 
@@ -1123,7 +1122,6 @@ void I_GetJoystickEvents(void)
 		}
 		D_PostEvent(&event);
 	}
-#endif
 }
 
 /**	\brief	Open joystick handle
@@ -1156,7 +1154,7 @@ static int joy_open(const char *fname)
 		{
 			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));
+				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
 			I_ShutdownJoystick();
 			return -1;
 		}
@@ -1177,7 +1175,7 @@ static int joy_open(const char *fname)
 		{
 			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));
+				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
 		}
 		else
 			CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
@@ -1185,7 +1183,6 @@ static int joy_open(const char *fname)
 	}
 
 	JoyInfo.dev = SDL_JoystickOpen(joyindex-1);
-	CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(joyindex-1));
 
 	if (JoyInfo.dev == NULL)
 	{
@@ -1195,6 +1192,7 @@ static int joy_open(const char *fname)
 	}
 	else
 	{
+		CONS_Printf(M_GetText("Joystick: %s\n"), SDL_JoystickName(JoyInfo.dev));
 		JoyInfo.axises = SDL_JoystickNumAxes(JoyInfo.dev);
 		if (JoyInfo.axises > JOYAXISSET*2)
 			JoyInfo.axises = JOYAXISSET*2;
@@ -1219,7 +1217,7 @@ static int joy_open(const char *fname)
 		JoyInfo.balls = SDL_JoystickNumBalls(JoyInfo.dev);
 #endif
 
-		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo.dev)), "pad");
+		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo.dev), "pad");
 
 		return JoyInfo.axises;
 	}
@@ -1290,8 +1288,8 @@ void I_GetJoystick2Events(void)
 	UINT64 joyhats = 0;
 #if 0
 	INT64 joybuttons = 0;
-	INT32 axisx, axisy;
 #endif
+	INT32 axisx, axisy;
 
 	if (!joystick2_started)
 		return;
@@ -1361,7 +1359,6 @@ void I_GetJoystick2Events(void)
 		}
 	}
 
-#if 0
 	// send joystick axis positions
 	event.type = ev_joystick2;
 
@@ -1416,7 +1413,6 @@ void I_GetJoystick2Events(void)
 		}
 		D_PostEvent(&event);
 	}
-#endif
 
 }
 
@@ -1448,7 +1444,7 @@ static int joy_open2(const char *fname)
 		{
 			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));
+				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
 			I_ShutdownJoystick2();
 			return -1;
 		}
@@ -1469,7 +1465,7 @@ static int joy_open2(const char *fname)
 		{
 			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));
+				CONS_Printf("#%d/(%s)\n", i+1, SDL_JoystickNameForIndex(i));
 		}
 		else
 			CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
@@ -1477,7 +1473,6 @@ static int joy_open2(const char *fname)
 	}
 
 	JoyInfo2.dev = SDL_JoystickOpen(joyindex-1);
-	CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(joyindex-1));
 
 	if (!JoyInfo2.dev)
 	{
@@ -1487,6 +1482,7 @@ static int joy_open2(const char *fname)
 	}
 	else
 	{
+		CONS_Printf(M_GetText("Joystick2: %s\n"), SDL_JoystickName(JoyInfo2.dev));
 		JoyInfo2.axises = SDL_JoystickNumAxes(JoyInfo2.dev);
 		if (JoyInfo2.axises > JOYAXISSET*2)
 			JoyInfo2.axises = JOYAXISSET*2;
@@ -1511,7 +1507,7 @@ static int joy_open2(const char *fname)
 		JoyInfo2.balls = SDL_JoystickNumBalls(JoyInfo2.dev);
 #endif
 
-		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(SDL_JoystickIndex(JoyInfo2.dev)), "pad");
+		//Joystick.bGamepadStyle = !stricmp(SDL_JoystickName(JoyInfo2.dev), "pad");
 
 		return JoyInfo2.axises;
 	}
@@ -1582,11 +1578,11 @@ const char *I_GetJoyName(INT32 joyindex)
 	if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
 	{
 		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) != -1)
-			joyname = SDL_JoystickName(joyindex);
+			joyname = SDL_JoystickNameForIndex(joyindex);
 		SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
 	}
 	else
-		joyname = SDL_JoystickName(joyindex);
+		joyname = SDL_JoystickNameForIndex(joyindex);
 	return joyname;
 }
 
@@ -2219,7 +2215,7 @@ void I_Sleep(void)
 INT32 I_StartupSystem(void)
 {
 	SDL_version SDLcompiled;
-	const SDL_version *SDLlinked;
+	SDL_version SDLlinked;
 #ifdef _XBOX
 #ifdef __GNUC__
 	char DP[] ="      Sonic Robo Blast 2!\n";
@@ -2240,12 +2236,12 @@ INT32 I_StartupSystem(void)
 #endif
 #endif
 	SDL_VERSION(&SDLcompiled)
-	SDLlinked = SDL_Linked_Version();
+	SDL_GetVersion(&SDLlinked);
 	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);
+	 SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
 #if 0 //#ifdef GP2X //start up everything
 	if (SDL_Init(SDL_INIT_NOPARACHUTE|SDL_INIT_EVERYTHING) < 0)
 #else
@@ -2875,7 +2871,7 @@ const char *I_LocateWad(void)
 	return waddir;
 }
 
-#ifdef LINUX
+#if defined(LINUX) || defined(LINUX64)
 #define MEMINFO_FILE "/proc/meminfo"
 #define MEMTOTAL "MemTotal:"
 #define MEMFREE "MemFree:"
@@ -2931,7 +2927,25 @@ UINT32 I_GetFreeMem(UINT32 *total)
 	if (total)
 		*total = 32 << 20;
 	return 32 << 20;
-#elif defined (LINUX)
+#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;
+#elif defined (LINUX) || defined (LINUX64)
 	/* Linux */
 	char buf[1024];
 	char *memTag;
@@ -2975,24 +2989,6 @@ UINT32 I_GetFreeMem(UINT32 *total)
 	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)
@@ -3039,8 +3035,8 @@ const CPUInfoFlags *I_CPUInfo(void)
 		WIN_CPUInfo.SSE2        = SDL_HasSSE2();
 		WIN_CPUInfo.AltiVec     = SDL_HasAltiVec();
 	}
-	WIN_CPUInfo.MMXExt      = SDL_HasMMXExt();
-	WIN_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
+	WIN_CPUInfo.MMXExt      = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
+	WIN_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
 #endif
 	GetSystemInfo(&SI);
 	WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors;
@@ -3052,9 +3048,9 @@ const CPUInfoFlags *I_CPUInfo(void)
 	memset(&SDL_CPUInfo,0,sizeof (CPUInfoFlags));
 	SDL_CPUInfo.RDTSC       = SDL_HasRDTSC();
 	SDL_CPUInfo.MMX         = SDL_HasMMX();
-	SDL_CPUInfo.MMXExt      = SDL_HasMMXExt();
+	SDL_CPUInfo.MMXExt      = SDL_FALSE; //SDL_HasMMXExt(); No longer in SDL2
 	SDL_CPUInfo.AMD3DNow    = SDL_Has3DNow();
-	SDL_CPUInfo.AMD3DNowExt = SDL_Has3DNowExt();
+	SDL_CPUInfo.AMD3DNowExt = SDL_FALSE; //SDL_Has3DNowExt(); No longer in SDL2
 	SDL_CPUInfo.SSE         = SDL_HasSSE();
 	SDL_CPUInfo.SSE2        = SDL_HasSSE2();
 	SDL_CPUInfo.AltiVec     = SDL_HasAltiVec();
diff --git a/src/sdl/i_ttf.c b/src/sdl/i_ttf.c
index 770a81d98596d463248e5b7e032e1bbb835df699..4a41f120e81d88d4234b840afb8eeec35970ee2b 100644
--- a/src/sdl/i_ttf.c
+++ b/src/sdl/i_ttf.c
@@ -16,7 +16,7 @@
 /// \file
 /// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
 
-#if defined(SDL) && defined(HAVE_TTF)
+#if defined(HAVE_SDL) && defined(HAVE_TTF)
 #include "SDL.h"
 #include "SDL_ttf.h"
 #include "../doomdef.h"
diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c
index 1a2305fefcb6f577ed1312e1fb7bb679440c455d..fd029832a667f5a9399a8b3f8769109beea7d0d9 100644
--- a/src/sdl/i_video.c
+++ b/src/sdl/i_video.c
@@ -19,15 +19,13 @@
 
 #include <stdlib.h>
 
-#ifndef _WIN32_WCE
 #include <signal.h>
-#endif
 
 #ifdef _MSC_VER
 #pragma warning(disable : 4214 4244)
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #include "SDL.h"
 
@@ -35,16 +33,6 @@
 #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
@@ -59,10 +47,6 @@
 
 #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
@@ -71,24 +55,10 @@
 
 #include "../doomdef.h"
 
-#if defined (_WIN32) && !defined (_XBOX)
+#if defined (_WIN32)
 #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"
@@ -112,27 +82,8 @@
 #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
+#define MAXWINMODES (17)
 
 /**	\brief
 */
@@ -147,11 +98,7 @@ 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
@@ -161,7 +108,7 @@ 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 USE_MOUSEINPUT (!disable_mouse && cv_usemouse.value && havefocus)
 #define MOUSE_MENU false //(!disable_mouse && cv_usemouse.value && menuactive && !USE_FULLSCREEN)
 #define MOUSEBUTTONS_MAX MOUSEBUTTONS
 
@@ -169,155 +116,175 @@ static SDL_bool disable_mouse = SDL_FALSE;
 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];
+#if 0
 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 const Uint32      surfaceFlagsW = 0/*|SDL_RESIZABLE*/;
+static const Uint32      surfaceFlagsF = 0;
 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
+#define HalfWarpMouse(x,y) SDL_WarpMouseInWindow(window, (Uint16)(x/2),(Uint16)(y/2))
 static       SDL_bool    videoblitok = SDL_FALSE;
-#endif
 static       SDL_bool    exposevideo = SDL_FALSE;
+static       SDL_bool    usesdl2soft = SDL_FALSE;
+static       SDL_bool    borderlesswindow = SDL_FALSE;
+
+// SDL2 vars
+SDL_Window   *window;
+SDL_Renderer *renderer;
+static SDL_Texture  *texture;
+static SDL_bool      havefocus = SDL_TRUE;
+static const char *fallback_resolution_name = "Fallback";
 
 // 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
+	{1920,1080}, // 1.66
 	{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
+	{1600, 900}, // 1.66
+	{1366, 768}, // 1.66
 	{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,1024}, // 1.33?
 	{1280, 960}, // 1.33,4.00
 	{1280, 800}, // 1.60,4.00
+	{1280, 720}, // 1.66
 	{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)
+static void Impl_VideoSetupSDLBuffer(void);
+static void Impl_VideoSetupBuffer(void);
+static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
+static void Impl_SetWindowName(const char *title);
+static void Impl_SetWindowIcon(void);
+
+static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen)
 {
-	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)
+	static SDL_bool wasfullscreen = SDL_FALSE;
+	static SDL_bool glfallbackresolution = SDL_FALSE;
+	Uint32 rmask;
+	Uint32 gmask;
+	Uint32 bmask;
+	Uint32 amask;
+	int bpp = 16;
+	int sw_texture_format = SDL_PIXELFORMAT_ABGR8888;
+
+	realwidth = vid.width;
+	realheight = vid.height;
+
+	if (window)
 	{
-		vid.width = width/2;
-		vid.height = height/2;
+		if (fullscreen)
+		{
+			wasfullscreen = SDL_TRUE;
+			SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+		}
+		else if (!fullscreen && wasfullscreen)
+		{
+			wasfullscreen = SDL_FALSE;
+			glfallbackresolution = SDL_FALSE;
+			SDL_SetWindowFullscreen(window, 0);
+			SDL_SetWindowSize(window, width, height);
+			SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+		}
+		else if (!wasfullscreen)
+		{
+			// Reposition window only in windowed mode
+			SDL_SetWindowSize(window, width, height);
+			SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+		}
+	}
+	else
+	{
+		Impl_CreateWindow(fullscreen);
+		Impl_SetWindowIcon();
+		wasfullscreen = fullscreen;
+		SDL_SetWindowSize(window, width, height);
+		if (fullscreen)
+		{
+			SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
+		}
+	}
+
+	if (rendermode == render_opengl)
+	{
+		int sdlw, sdlh;
+		SDL_GetWindowSize(window, &sdlw, &sdlh);
+		// Logical fullscreen is not implemented yet for OpenGL, so...
+		// Special case handling
+		if (glfallbackresolution == SDL_FALSE && fullscreen && width != sdlw && height != sdlh)
+		{
+			if (VID_GetModeForSize(sdlw, sdlh) != -1)
+			{
+				wasfullscreen = SDL_TRUE;
+				VID_SetMode(VID_GetModeForSize(sdlw, sdlh));
+				return;
+			}
+			else
+			{
+				wasfullscreen = SDL_TRUE;
+				glfallbackresolution = SDL_TRUE;
+				VID_SetMode(-1);
+				return;
+			}
+		}
+		OglSdlSurface(vid.width, vid.height);
+	}
+
+	if (rendermode == render_soft)
+	{
+		SDL_RenderClear(renderer);
+		SDL_RenderSetLogicalSize(renderer, width, height);
+		// Set up Texture
+		realwidth = width;
+		realheight = height;
+		if (texture != NULL)
+		{
+			SDL_DestroyTexture(texture);
+		}
+
+		if (!usesdl2soft)
+		{
+			sw_texture_format = SDL_PIXELFORMAT_RGB565;
+		}
+		else
+		{
+			bpp = 32;
+			sw_texture_format = SDL_PIXELFORMAT_RGBA8888;
+		}
+
+		texture = SDL_CreateTexture(renderer, sw_texture_format, SDL_TEXTUREACCESS_STREAMING, width, height);
+
+		// Set up SW surface
+		if (vidSurface != NULL)
+		{
+			SDL_FreeSurface(vidSurface);
+		}
+		SDL_PixelFormatEnumToMasks(sw_texture_format, &bpp, &rmask, &gmask, &bmask, &amask);
+		vidSurface = SDL_CreateRGBSurface(0, width, height, bpp, rmask, gmask, bmask, amask);
 	}
-#endif
 }
 
 //
 //  Translates the SDL key into SRB2 key
 //
 
-static INT32 SDLatekey(SDLKey sym)
+static INT32 SDLatekey(SDL_Keycode 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:
@@ -430,10 +397,10 @@ static INT32 SDLatekey(SDLKey sym)
 			rc = KEY_RALT;
 			break;
 
-		case SDLK_NUMLOCK:
+		case SDLK_NUMLOCKCLEAR:
 			rc = KEY_NUMLOCK;
 			break;
-		case SDLK_SCROLLOCK:
+		case SDLK_SCROLLLOCK:
 			rc = KEY_SCROLLLOCK;
 			break;
 
@@ -453,34 +420,34 @@ static INT32 SDLatekey(SDLKey sym)
 			rc = KEY_INS;
 			break;
 
-		case SDLK_KP0:
+		case SDLK_KP_0:
 			rc = KEY_KEYPAD0;
 			break;
-		case SDLK_KP1:
+		case SDLK_KP_1:
 			rc = KEY_KEYPAD1;
 			break;
-		case SDLK_KP2:
+		case SDLK_KP_2:
 			rc = KEY_KEYPAD2;
 			break;
-		case SDLK_KP3:
+		case SDLK_KP_3:
 			rc = KEY_KEYPAD3;
 			break;
-		case SDLK_KP4:
+		case SDLK_KP_4:
 			rc = KEY_KEYPAD4;
 			break;
-		case SDLK_KP5:
+		case SDLK_KP_5:
 			rc = KEY_KEYPAD5;
 			break;
-		case SDLK_KP6:
+		case SDLK_KP_6:
 			rc = KEY_KEYPAD6;
 			break;
-		case SDLK_KP7:
+		case SDLK_KP_7:
 			rc = KEY_KEYPAD7;
 			break;
-		case SDLK_KP8:
+		case SDLK_KP_8:
 			rc = KEY_KEYPAD8;
 			break;
-		case SDLK_KP9:
+		case SDLK_KP_9:
 			rc = KEY_KEYPAD9;
 			break;
 
@@ -500,24 +467,16 @@ static INT32 SDLatekey(SDLKey sym)
 			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)
@@ -537,16 +496,15 @@ static INT32 SDLatekey(SDLKey sym)
 
 static void SDLdoUngrabMouse(void)
 {
-	if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY))
-	{
-		SDL_WM_GrabInput(SDL_GRAB_OFF);
-	}
+	SDL_SetWindowGrab(window, SDL_FALSE);
 }
 
 void SDLforceUngrabMouse(void)
 {
-	if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO)
-		SDL_WM_GrabInput(SDL_GRAB_OFF);
+	if (SDL_WasInit(SDL_INIT_VIDEO)==SDL_INIT_VIDEO && window != NULL)
+	{
+		SDL_SetWindowGrab(window, SDL_FALSE);
+	}
 }
 
 static void VID_Command_NumModes_f (void)
@@ -556,6 +514,11 @@ static void VID_Command_NumModes_f (void)
 
 static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText)
 {
+#if 1
+	(void)infoSurface;
+	(void)SurfaceText;
+	SDL2STUB();
+#else
 	INT32 vfBPP;
 	const SDL_Surface *VidSur = SDL_GetVideoSurface();
 
@@ -612,11 +575,15 @@ static void SurfaceInfo(const SDL_Surface *infoSurface, const char *SurfaceText)
 		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"));
-
+#endif
 }
 
 static void VID_Command_Info_f (void)
 {
+#if 0
+	SDL2STUB();
+#else
+#if 0
 	const SDL_VideoInfo *videoInfo;
 	videoInfo = SDL_GetVideoInfo(); //Alam: Double-Check
 	if (videoInfo)
@@ -652,16 +619,18 @@ static void VID_Command_Info_f (void)
 			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"));
+#else
+	if (!M_CheckParm("-noblit")) videoblitok = SDL_TRUE;
 #endif
+	SurfaceInfo(bufSurface, M_GetText("Current Engine Mode"));
 	SurfaceInfo(vidSurface, M_GetText("Current Video Mode"));
+#endif
 }
 
 static void VID_Command_ModeList_f(void)
 {
+	SDL2STUB();
+#if 0
 #if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) &&  !defined(GP2X)
 	INT32 i;
 #ifdef HWRENDER
@@ -697,10 +666,13 @@ static void VID_Command_ModeList_f(void)
 	}
 	CONS_Printf("%s", M_GetText("None\n"));
 #endif
+#endif
 }
 
 static void VID_Command_Mode_f (void)
 {
+	SDL2STUB();
+#if 0
 	INT32 modenum;
 
 	if (COM_Argc()!= 2)
@@ -715,9 +687,11 @@ static void VID_Command_Mode_f (void)
 		CONS_Printf(M_GetText("Video mode not present\n"));
 	else
 		setmodeneeded = modenum+1; // request vid mode change
+#endif
 }
 
-#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE)
+#if 0
+#if defined(RPC_NO_WINDOWS_H)
 static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
 	UNREFERENCED_PARAMETER(hWnd);
@@ -731,237 +705,17 @@ static VOID MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 	}
 }
 #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
+	// -32768 to 32767
 	INT32 raxis = axis/32;
-#endif
 	if (which == ev_joystick)
 	{
 		if (Joystick.bGamepadStyle)
@@ -1008,8 +762,304 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
 	return raxis;
 }
 
+static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
+{
+	static SDL_bool firsttimeonmouse = SDL_TRUE;
+	static SDL_bool mousefocus = SDL_TRUE;
+	static SDL_bool kbfocus = SDL_TRUE;
+
+	switch (evt.event)
+	{
+		case SDL_WINDOWEVENT_ENTER:
+			mousefocus = SDL_TRUE;
+			break;
+		case SDL_WINDOWEVENT_LEAVE:
+			mousefocus = SDL_FALSE;
+			break;
+		case SDL_WINDOWEVENT_FOCUS_GAINED:
+			kbfocus = SDL_TRUE;
+			mousefocus = SDL_TRUE;
+			break;
+		case SDL_WINDOWEVENT_FOCUS_LOST:
+			kbfocus = SDL_FALSE;
+			mousefocus = SDL_FALSE;
+			break;
+		case SDL_WINDOWEVENT_MAXIMIZED:
+			break;
+	}
+
+	if (mousefocus && kbfocus)
+	{
+		if (!firsttimeonmouse)
+		{
+			if (cv_usemouse.value) I_StartupMouse();
+		}
+		//else firsttimeonmouse = SDL_FALSE;
+		if (gamestate == GS_LEVEL)
+		{
+			if (!paused) I_ResumeSong(0); //resume it
+		}
+	}
+	else if (!mousefocus && !kbfocus)
+	{
+		if (!disable_mouse)
+		{
+			SDLforceUngrabMouse();
+		}
+		if (!netgame && gamestate == GS_LEVEL && !demoplayback && !demorecording && !modeattacking)
+		{
+			paused = true;
+		}
+		memset(gamekeydown, 0, NUMKEYS); // TODO this is a scary memset
+		if (gamestate == GS_LEVEL)
+		{
+			I_PauseSong(0);
+		}
+
+		if (MOUSE_MENU)
+		{
+			SDLdoUngrabMouse();
+		}
+	}
+
+}
+
+static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
+{
+	event_t event;
+	if (type == SDL_KEYUP)
+	{
+		event.type = ev_keyup;
+	}
+	else if (type == SDL_KEYDOWN)
+	{
+		event.type = ev_keydown;
+	}
+	else
+	{
+		return;
+	}
+	event.data1 = SDLatekey(evt.keysym.sym);
+	if (event.data1) D_PostEvent(&event);
+}
+
+static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
+{
+	event_t event;
+	int wwidth, wheight;
+
+	SDL_GetWindowSize(window, &wwidth, &wheight);
+
+	if ((SDL_GetMouseFocus() != window && SDL_GetKeyboardFocus() != window))
+	{
+		SDLdoUngrabMouse();
+		return;
+	}
+
+	if ((evt.x == realwidth/2) && (evt.y == realheight/2))
+	{
+		return;
+	}
+	else
+	{
+		event.data2 = (evt.xrel) * (wwidth / realwidth);
+		event.data3 = -evt.yrel * (wheight / realheight);
+	}
+	
+	event.type = ev_mouse;
+
+	if (SDL_GetMouseFocus() == window && SDL_GetKeyboardFocus() == window)
+	{
+		D_PostEvent(&event);
+		HalfWarpMouse(wwidth, wheight);
+	}
+}
+
+static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
+{
+	event_t event;
+
+	SDL_memset(&event, 0, sizeof(event_t));
+
+	/// \todo inputEvent.button.which
+	if (USE_MOUSEINPUT)
+	{
+		if (type == SDL_MOUSEBUTTONUP)
+		{
+			event.type = ev_keyup;
+		}
+		else if (type == SDL_MOUSEBUTTONDOWN)
+		{
+			event.type = ev_keydown;
+		}
+		else return;
+		if (evt.button == SDL_BUTTON_MIDDLE)
+			event.data1 = KEY_MOUSE1+2;
+		else if (evt.button == SDL_BUTTON_RIGHT)
+			event.data1 = KEY_MOUSE1+1;
+		else if (evt.button == SDL_BUTTON_LEFT)
+			event.data1= KEY_MOUSE1;
+		else if (evt.button <= MOUSEBUTTONS)
+			event.data1 = KEY_MOUSE1 + evt.which - SDL_BUTTON_LEFT;
+		if (event.type == ev_keyup || event.type == ev_keydown)
+		{
+			D_PostEvent(&event);
+		}
+	}
+}
+
+static void Impl_HandleMouseWheelEvent(SDL_MouseWheelEvent evt)
+{
+	event_t event;
+
+	SDL_memset(&event, 0, sizeof(event_t));
+
+	if (evt.y > 0)
+	{
+		event.data1 = KEY_MOUSEWHEELUP;
+		event.type = ev_keydown;
+	}
+	if (evt.y < 0)
+	{
+		event.data1 = KEY_MOUSEWHEELDOWN;
+		event.type = ev_keydown;
+	}
+	if (evt.y == 0)
+	{
+		event.data1 = 0;
+		event.type = ev_keyup;
+	}
+	if (event.type == ev_keyup || event.type == ev_keydown)
+	{
+		D_PostEvent(&event);
+	}
+}
+
+static void Impl_HandleJoystickAxisEvent(SDL_JoyAxisEvent evt)
+{
+	event_t event;
+	SDL_JoystickID joyid[2];
+
+	// Determine the Joystick IDs for each current open joystick
+	joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev);
+	joyid[1] = SDL_JoystickInstanceID(JoyInfo.dev);
+
+	evt.axis++;
+	event.data1 = event.data2 = event.data3 = INT32_MAX;
+
+	if (evt.which == joyid[0])
+	{
+		event.type = ev_joystick;
+	}
+	else if (evt.which == joyid[1])
+	{
+		event.type = ev_joystick2;
+	}
+	else return;
+	//axis
+	if (evt.axis > JOYAXISSET*2)
+		return;
+	//vaule
+	if (evt.axis%2)
+	{
+		event.data1 = evt.axis / 2;
+		event.data2 = SDLJoyAxis(evt.value, event.type);
+	}
+	else
+	{
+		evt.axis--;
+		event.data1 = evt.axis / 2;
+		event.data3 = SDLJoyAxis(evt.value, event.type);
+	}
+	D_PostEvent(&event);
+}
+
+static void Impl_HandleJoystickButtonEvent(SDL_JoyButtonEvent evt, Uint32 type)
+{
+	event_t event;
+	SDL_JoystickID joyid[2];
+
+	// Determine the Joystick IDs for each current open joystick
+	joyid[0] = SDL_JoystickInstanceID(JoyInfo.dev);
+	joyid[1] = SDL_JoystickInstanceID(JoyInfo.dev);
+
+	if (evt.which == joyid[0])
+	{
+		event.data1 = KEY_JOY1;
+	}
+	else if (evt.which == joyid[1])
+	{
+		event.data1 = KEY_2JOY1;
+	}
+	else return;
+	if (type == SDL_JOYBUTTONUP)
+	{
+		event.type = ev_keyup;
+	}
+	else if (type == SDL_JOYBUTTONDOWN)
+	{
+		event.type = ev_keydown;
+	}
+	else return;
+	if (evt.button < JOYBUTTONS)
+	{
+		event.data1 += evt.button;
+	}
+	else return;
+
+	SDLJoyRemap(&event);
+	if (event.type != ev_console) D_PostEvent(&event);
+}
+
 void I_GetEvent(void)
 {
+	SDL_Event evt;
+
+	if (!graphics_started)
+	{
+		return;
+	}
+
+	while (SDL_PollEvent(&evt))
+	{
+		switch (evt.type)
+		{
+			case SDL_WINDOWEVENT:
+				Impl_HandleWindowEvent(evt.window);
+				break;
+			case SDL_KEYUP:
+			case SDL_KEYDOWN:
+				Impl_HandleKeyboardEvent(evt.key, evt.type);
+				break;
+			case SDL_MOUSEMOTION:
+				Impl_HandleMouseMotionEvent(evt.motion);
+				break;
+			case SDL_MOUSEBUTTONUP:
+			case SDL_MOUSEBUTTONDOWN:
+				Impl_HandleMouseButtonEvent(evt.button, evt.type);
+				break;
+			case SDL_MOUSEWHEEL:
+				Impl_HandleMouseWheelEvent(evt.wheel);
+				break;
+			case SDL_JOYAXISMOTION:
+				Impl_HandleJoystickAxisEvent(evt.jaxis);
+				break;
+			case SDL_JOYBUTTONUP:
+			case SDL_JOYBUTTONDOWN:
+				Impl_HandleJoystickButtonEvent(evt.jbutton, evt.type);
+				break;
+			case SDL_QUIT:
+				I_Quit();
+				M_QuitResponse('y');
+				break;
+		}
+	}
+
+	// In order to make wheels act like buttons, we have to set their state to Up.
+	// This is because wheel messages don't have an up/down state.
+	gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0;
+
+#if 0
 	SDL_Event inputEvent;
 	static SDL_bool sdlquit = SDL_FALSE; //Alam: once, just once
 	event_t event;
@@ -1076,7 +1126,7 @@ void I_GetEvent(void)
 					SDLdoUngrabMouse();
 					break;
 				}
-				if (USE_MOUSEINPUT)
+				//if (USE_MOUSEINPUT) TODO SDL2 stub
 				{
 					// If the event is from warping the pointer back to middle
 					// of the screen then ignore it.
@@ -1183,7 +1233,6 @@ void I_GetEvent(void)
 				SDLJoyRemap(&event);
 				if (event.type != ev_console) D_PostEvent(&event);
 				break;
-#ifndef  _WIN32_WCE
 			case SDL_QUIT:
 				if (!sdlquit)
 				{
@@ -1191,8 +1240,7 @@ void I_GetEvent(void)
 					M_QuitResponse('y');
 				}
 				break;
-#endif
-#if defined(RPC_NO_WINDOWS_H) && !defined(_WIN32_WCE)
+#if defined(RPC_NO_WINDOWS_H)
 			case SDL_SYSWMEVENT:
 				MainWndproc(inputEvent.syswm.msg->hwnd,
 					inputEvent.syswm.msg->msg,
@@ -1205,15 +1253,8 @@ void I_GetEvent(void)
 				    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);
@@ -1228,7 +1269,7 @@ void I_GetEvent(void)
 		}
 	}
 	//reset wheel like in win32, I don't understand it but works
-	gamekeydown[KEY_MOUSEWHEELDOWN] = gamekeydown[KEY_MOUSEWHEELUP] = 0;
+#endif
 }
 
 void I_StartupMouse(void)
@@ -1261,9 +1302,6 @@ void I_OsPolling(void)
 		I_GetJoystickEvents();
 		I_GetJoystick2Events();
 	}
-#ifdef _arch_dreamcast
-	//vmu_set_icon(VMU_bits);
-#endif
 
 	I_GetMouseEvents();
 
@@ -1275,17 +1313,23 @@ void I_OsPolling(void)
 //
 void I_UpdateNoBlit(void)
 {
-	if (!vidSurface)
+	if (rendermode == render_none)
 		return;
+	if (exposevideo)
+	{
 #ifdef HWRENDER
-	if (rendermode != render_soft)
-		OglSdlFinishUpdate(cv_vidwait.value);
-	else
+		if (rendermode == render_opengl)
+		{
+			OglSdlFinishUpdate(cv_vidwait.value);
+		}
+		else
 #endif
-	if (vidSurface->flags&SDL_DOUBLEBUF)
-		SDL_Flip(vidSurface);
-	else if (exposevideo)
-		SDL_UpdateRect(vidSurface, 0, 0, 0, 0);
+		if (rendermode == render_soft)
+		{
+			SDL_RenderCopy(renderer, texture, NULL, NULL);
+			SDL_RenderPresent(renderer);
+		}
+	}
 	exposevideo = SDL_FALSE;
 }
 
@@ -1302,10 +1346,6 @@ static inline boolean I_SkipFrame(void)
 
 	skip = !skip;
 
-#if 0 //(defined (GP2X) || defined (PSP) || defined (_arch_dreamcast))
-	return skip;
-#endif
-
 	switch (gamestate)
 	{
 		case GS_LEVEL:
@@ -1335,7 +1375,7 @@ static inline SDL_bool SDLmatchVideoformat(void)
 //
 void I_FinishUpdate(void)
 {
-	if (!vidSurface)
+	if (rendermode == render_none)
 		return; //Alam: No software or OpenGl surface
 
 	if (I_SkipFrame())
@@ -1346,152 +1386,30 @@ void I_FinishUpdate(void)
 
 	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;
-
+		SDL_Rect 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");
-		}
+		rect.x = 0;
+		rect.y = 0;
+		rect.w = vid.width;
+		rect.h = vid.height;
 
-#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
+		if (!bufSurface) //Double-Check
 		{
-			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);
+			Impl_VideoSetupSDLBuffer();
 		}
-		else /// \todo 15t15,15tN, others?
+		if (bufSurface)
 		{
-			;//NOP
+			SDL_BlitSurface(bufSurface, NULL, vidSurface, &rect);
+			// Fury -- there's no way around UpdateTexture, the GL backend uses it anyway
+			SDL_LockSurface(vidSurface);
+			SDL_UpdateTexture(texture, &rect, vidSurface->pixels, vidSurface->pitch);
+			SDL_UnlockSurface(vidSurface);
 		}
-
-#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());
+		SDL_RenderClear(renderer);
+		SDL_RenderCopy(renderer, texture, NULL, NULL);
+		SDL_RenderPresent(renderer);
 	}
+
 #ifdef HWRENDER
 	else
 	{
@@ -1537,8 +1455,9 @@ void I_SetPalette(RGBA_t *palette)
 		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);
+	//if (vidSurface) SDL_SetPaletteColors(vidSurface->format->palette, localPalette, 0, 256);
+	// Fury -- SDL2 vidSurface is a 32-bit surface buffer copied to the texture. It's not palletized, like bufSurface.
+	if (bufSurface) SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256);
 }
 
 // return number of fullscreen + X11 modes
@@ -1552,6 +1471,7 @@ INT32 VID_NumModes(void)
 
 const char *VID_GetModeName(INT32 modeNum)
 {
+#if 0
 	if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
 	{
 		modeNum += firstEntry;
@@ -1564,18 +1484,33 @@ const char *VID_GetModeName(INT32 modeNum)
 	}
 	else // windowed modes
 	{
+#endif
+	if (modeNum == -1)
+	{
+		return fallback_resolution_name;
+	}
 		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)
 {
+	int i;
+	for (i = 0; i < MAXWINMODES; i++)
+	{
+		if (windowedModes[i][0] == w && windowedModes[i][1] == h)
+		{
+			return i;
+		}
+	}
+	return -1;
+#if 0
 	INT32 matchMode = -1, i;
 	VID_PrepareModeList();
 	if (USE_FULLSCREEN && numVidModes != -1)
@@ -1636,10 +1571,14 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
 		}
 	}
 	return matchMode;
+#endif
 }
 
 void VID_PrepareModeList(void)
 {
+	// Under SDL2, we just use the windowed modes list, and scale in windowed fullscreen.
+	allow_fullscreen = true;
+#if 0
 	INT32 i;
 
 	firstEntry = 0;
@@ -1667,42 +1606,18 @@ void VID_PrepareModeList(void)
 		}
 	}
 	allow_fullscreen = true;
+#endif
 }
 
 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
+	SDL2STUB();
 }
 
 static void SDLWMSet(void)
 {
+	SDL2STUB();
+#if 0
 #ifdef RPC_NO_WINDOWS_H
 	SDL_SysWMinfo SDLWM;
 	memset(&SDLWM,0,sizeof (SDL_SysWMinfo));
@@ -1716,142 +1631,195 @@ static void SDLWMSet(void)
 		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);
+#endif
 }
 
+#if 0
 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
+	// you can not use the video memory in pixels member in fullscreen mode
 	return NULL;
 }
+#endif
 
 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)
+	vid.recalc = 1;
+	vid.bpp = 1;
+
+	if (modeNum >= 0 && modeNum < MAXWINMODES-1)
 	{
-		//Alam: SDL_Video system free vidSurface for me
-		if (vid.buffer) free(vid.buffer);
-		vid.buffer = NULL;
-		if (bufSurface) SDL_FreeSurface(bufSurface);
-		bufSurface = NULL;
+		vid.width = windowedModes[modeNum][0];
+		vid.height = windowedModes[modeNum][1];
+		vid.modenum = modeNum;
 	}
-
-	if (USE_FULLSCREEN)
+	else
 	{
-		if (numVidModes != -1)
+		// just set the desktop resolution as a fallback
+		SDL_DisplayMode mode;
+		SDL_GetWindowDisplayMode(window, &mode);
+		if (mode.w >= 2048)
 		{
-			modeNum += firstEntry;
-			vid.width = modeList[modeNum]->w;
-			vid.height = modeList[modeNum]->h;
+			vid.width = 1920;
+			vid.height = 1200;
 		}
 		else
 		{
-			vid.width = windowedModes[modeNum][0];
-			vid.height = windowedModes[modeNum][1];
+			vid.width = mode.w;
+			vid.height = mode.h;
 		}
-		if (render_soft == rendermode)
-		{
-			SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsF);
+		vid.modenum = -1;
+	}
+	Impl_SetWindowName("SRB2 "VERSIONSTRING);
 
-			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());
-			}
+	SDLSetMode(windowedModes[modeNum][0], windowedModes[modeNum][1], USE_FULLSCREEN);
+
+	if (render_soft == rendermode)
+	{
+		if (bufSurface)
+		{
+			SDL_FreeSurface(bufSurface);
+			bufSurface = NULL;
 		}
+
+		Impl_VideoSetupBuffer();
+	}
+
+	return SDL_TRUE;
+}
+
+static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
+{
+	int flags = 0;
+	if (window != NULL)
+	{
+		return SDL_FALSE;
+	}
+
+	if (fullscreen)
+	{
+		flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+	}
+
+	if (borderlesswindow)
+	{
+		flags |= SDL_WINDOW_BORDERLESS;
+	}
+
 #ifdef HWRENDER
-		else // (render_soft != rendermode)
+	if (rendermode == render_opengl)
+	{
+		window = SDL_CreateWindow("SRB2", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
+				realwidth, realheight, flags | SDL_WINDOW_OPENGL);
+		if (window != NULL)
 		{
-			if (!OglSdlSurface(vid.width, vid.height, true))
+			sdlglcontext = SDL_GL_CreateContext(window);
+			if (sdlglcontext == NULL)
 			{
-				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());
+				SDL_DestroyWindow(window);
+				I_Error("Failed to create a GL context: %s\n", SDL_GetError());
+			}
+			else
+			{
+				SDL_GL_MakeCurrent(window, sdlglcontext);
 			}
-
-			realwidth = (Uint16)vid.width;
-			realheight = (Uint16)vid.height;
 		}
-#endif
+		else return SDL_FALSE;
 	}
-	else //(cv_fullscreen.value)
+#endif
+	if (rendermode == render_soft)
 	{
-		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)
+		window = SDL_CreateWindow("SRB2", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
+				realwidth, realheight, flags);
+		if (window != NULL)
 		{
-			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;
+			renderer = SDL_CreateRenderer(window, -1, (usesdl2soft ? SDL_RENDERER_SOFTWARE : 0) | (cv_vidwait.value && !usesdl2soft ? SDL_RENDERER_PRESENTVSYNC : 0));
+			if (renderer != NULL)
+			{
+				SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
+			}
+			else return SDL_FALSE;
 		}
-#endif
+		else return SDL_FALSE;
 	}
 
-	vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h);
+	return SDL_TRUE;
+}
 
-	if (render_soft == rendermode)
+static void Impl_SetWindowName(const char *title)
+{
+	if (window != NULL)
 	{
-		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");
+		return;
 	}
+	SDL2STUB();
+	SDL_SetWindowTitle(window, title);
+}
 
-#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();
+static void Impl_SetWindowIcon(void)
+{
+	if (window == NULL || icoSurface == NULL)
+	{
+		return;
+	}
+	SDL2STUB();
+	SDL_SetWindowIcon(window, icoSurface);
+}
 
-	SDLWMSet();
+static void Impl_VideoSetupSDLBuffer(void)
+{
+	if (bufSurface != NULL)
+	{
+		SDL_FreeSurface(bufSurface);
+		bufSurface = NULL;
+	}
+	// Set up the SDL palletized buffer (copied to vidbuffer before being rendered to texture)
+	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) // Fury -- don't think this is used at all anymore
+	{
+		bufSurface = SDL_CreateRGBSurfaceFrom(screens[0],vid.width,vid.height,15,
+			(int)vid.rowbytes,0x00007C00,0x000003E0,0x0000001F,0x00000000); // 555 mode
+	}
+	if (bufSurface)
+	{
+		SDL_SetPaletteColors(bufSurface->format->palette, localPalette, 0, 256);
+	}
+	else
+	{
+		I_Error("%s", M_GetText("No system memory for SDL buffer surface\n"));
+	}
+}
 
-	return true;
+static void Impl_VideoSetupBuffer(void)
+{
+	// Set up game's software render buffer
+	if (rendermode == render_soft)
+	{
+		vid.rowbytes = vid.width * vid.bpp;
+		vid.direct = NULL;
+		vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
+		if (vid.buffer)
+		{
+			memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
+		}
+		else
+		{
+			I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
+		}
+	}
 }
 
 void I_StartupGraphics(void)
 {
-	static char SDLNOMOUSE[] = "SDL_NOMOUSE=1";
-	static char SDLVIDEOMID[] = "SDL_VIDEO_CENTERED=center";
-
 	if (dedicated)
 	{
 		rendermode = render_none;
@@ -1866,24 +1834,10 @@ void I_StartupGraphics(void)
 	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");
+	disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
 
 	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
@@ -1902,52 +1856,24 @@ void I_StartupGraphics(void)
 			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));
+		//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
+	usesdl2soft = M_CheckParm("-softblit");
+	borderlesswindow = M_CheckParm("-borderless");
 
+	//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
+	SDLESSet();
+	VID_Command_ModeList_f();
 #ifdef HWRENDER
 	if (M_CheckParm("-opengl") || rendermode == render_opengl)
 	{
@@ -1980,68 +1906,49 @@ void I_StartupGraphics(void)
 		// 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
+		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;
+
+	// Fury: we do window initialization after GL setup to allow
+	// SDL_GL_LoadLibrary to work well on Windows
+	
+	// Create window
+	//Impl_CreateWindow(USE_FULLSCREEN);
+	//Impl_SetWindowName("SRB2");
+	VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT));
+	
+	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
-		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"));
-	}
+	// Window icon
+#ifdef HAVE_IMAGE
+	icoSurface = IMG_ReadXPMFromArray(SDL_icon_xpm);
+#endif
+	Impl_SetWindowIcon();
+
+	VID_SetMode(VID_GetModeForSize(BASEVIDWIDTH, BASEVIDHEIGHT));
+
 	if (M_CheckParm("-nomousegrab"))
 		mousegrabok = SDL_FALSE;
-#ifdef _DEBUG
+#if 0 // defined (_DEBUG)
 	else
 	{
 		char videodriver[4] = {'S','D','L',0};
 		if (!M_CheckParm("-mousegrab") &&
-		    SDL_VideoDriverName(videodriver,4) &&
-		    strncasecmp("X11",videodriver,4) == 0)
+		    *strncpy(videodriver, SDL_GetCurrentVideoDriver(), 4) != '\0' &&
+		    strncasecmp("x11",videodriver,4) == 0)
 			mousegrabok = SDL_FALSE; //X11's XGrabPointer not good
 	}
 #endif
@@ -2071,30 +1978,23 @@ void I_ShutdownGraphics(void)
 		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);
+	if (sdlglcontext)
+	{
+		SDL_GL_DeleteContext(sdlglcontext);
+	}
 #endif
-#ifndef _arch_dreamcast
 	SDL_QuitSubSystem(SDL_INIT_VIDEO);
-#endif
 	framebuffer = SDL_FALSE;
 }
 #endif
diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
index 1b1a9fdf6bf1723095acc16f4cb835b6abfe5288..5c34c55c5f38ed4f241c2834f17f7e7236ed3e15 100644
--- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
+++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj
@@ -1264,7 +1264,7 @@
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					MAC_ALERT,
 					SDLMAIN,
-					SDL,
+					HAVE_SDL,
 					HAVE_MIXER,
 					HAVE_PNG,
 					HAVE_BLUA,
@@ -1386,7 +1386,7 @@
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					MAC_ALERT,
 					SDLMAIN,
-					SDL,
+					HAVE_SDL,
 					HAVE_MIXER,
 					HAVE_PNG,
 					HAVE_BLUA,
diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index 98159b47368c3996124ff78343bef212b5b298d4..8c90557f04145ebe451c3f9867714f4707f901f5 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -3,7 +3,7 @@
 
 #include "../doomdef.h"
 
-#if defined(SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
+#if defined(HAVE_SDL) && defined(HAVE_MIXER) && SOUND==SOUND_MIXER
 
 #include "../sounds.h"
 #include "../s_sound.h"
@@ -617,7 +617,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
 	}
 #endif
 
-	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
+	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
 	if (!music)
 	{
 		CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
@@ -778,7 +778,7 @@ void I_SetMIDIMusicVolume(UINT8 volume)
 
 INT32 I_RegisterSong(void *data, size_t len)
 {
-	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len));
+	music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE);
 	if (!music)
 	{
 		CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError());
diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c
index 9427d3317eba3f1ac5ab7e36ab55082231d9bedf..62055e10401e3b32cf0a4a34ba9c7f5a4bf9da2b 100644
--- a/src/sdl/ogl_sdl.c
+++ b/src/sdl/ogl_sdl.c
@@ -21,10 +21,12 @@
 #pragma warning(disable : 4214 4244)
 #endif
 
-#ifdef SDL
+#ifdef HAVE_SDL
 
 #include "SDL.h"
 
+#include "sdlmain.h"
+
 #ifdef _MSC_VER
 #pragma warning(default : 4214 4244)
 #endif
@@ -62,19 +64,11 @@ 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;
+SDL_GLContext sdlglcontext = 0;
 
 #ifndef STATIC_OPENGL
 void *GetGLFunc(const char *proc)
@@ -156,36 +150,13 @@ boolean LoadGL(void)
 
 	\return	if true, changed video mode
 */
-boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
+boolean OglSdlSurface(INT32 w, INT32 h)
 {
 	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 ?
@@ -200,55 +171,21 @@ boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
 	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;
+		maximumAnisotropy = 1;
 
 	granisotropicmode_cons_t[1].value = maximumAnisotropy;
 
+	SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
+
 	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;
 }
@@ -264,17 +201,11 @@ 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
+		SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
 	}
 	oldwaitvbl = waitvbl;
 
-	SDL_GL_SwapBuffers();
+	SDL_GL_SwapWindow(window);
 }
 
 EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
@@ -283,10 +214,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
 	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);
@@ -294,20 +221,6 @@ EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
 		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();
 }
 
diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h
index 43c28fa422a0b42e6367da418e62aa5ce3aa1fb0..72f130a52ef0c0f3bfe39b9eb5271404941529b3 100644
--- a/src/sdl/ogl_sdl.h
+++ b/src/sdl/ogl_sdl.h
@@ -18,13 +18,16 @@
 
 #include "../v_video.h"
 
-extern SDL_Surface *vidSurface;
 extern void *GLUhandle;
 
-boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen);
+boolean OglSdlSurface(INT32 w, INT32 h);
 
 void OglSdlFinishUpdate(boolean vidwait);
 
+extern SDL_Window *window;
+extern SDL_Renderer *renderer;
+extern SDL_GLContext sdlglcontext;
+
 #ifdef _CREATE_DLL_
 EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
 #endif
diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index 3750e67789f1d1af7676133f1ebd30184c31a32a..5d6c007b5696beca42b92e01ec2fa73531a8244c 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -23,7 +23,7 @@
 #pragma warning(disable : 4214 4244)
 #endif
 
-#if defined(SDL) && SOUND==SOUND_SDL
+#if defined(HAVE_SDL) && SOUND==SOUND_SDL
 
 #include "SDL.h"
 
@@ -856,6 +856,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16S(Uint8 *stream, int len)
 
 	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
 
+
 	// Mix sounds into the mixing buffer.
 	// Loop over len
 	while (len--)
@@ -945,6 +946,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len)
 
 	if (Snd_Mutex) SDL_LockMutex(Snd_Mutex);
 
+
 	// Mix sounds into the mixing buffer.
 	// Loop over len
 	while (len--)
@@ -1050,10 +1052,7 @@ 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
+	memset(stream, 0x00, len); // only work in !AUDIO_U8, that needs 0x80
 
 	if ((audio.channels != 1 && audio.channels != 2) ||
 	    (audio.format != AUDIO_S8 && audio.format != AUDIO_S16SYS))
@@ -1320,8 +1319,8 @@ void I_StartupSound(void)
 	}
 	else
 	{
-		char ad[100];
-		CONS_Printf(M_GetText(" Starting up with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad));
+		//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);
@@ -1782,7 +1781,9 @@ static boolean I_StartGMESong(const char *musicname, boolean looping)
 	gme_set_user_data(emu, data);
 	gme_set_user_cleanup(emu, I_CleanupGME);
 	gme_start_track(emu, 0);
+#ifdef HAVE_MIXER
 	gme_set_fade(emu, Digfade);
+#endif
 
 	Snd_LockAudio();
 	localdata.gme_emu = emu;
@@ -2027,4 +2028,4 @@ static void SDLCALL I_FinishMusic(void)
 	if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex);
 }
 #endif
-#endif //SDL
+#endif //HAVE_SDL
diff --git a/src/sdl/sdlmain.h b/src/sdl/sdlmain.h
index 1e497b10dcca125916b09c515d43eb0e0dcdd8db..af4e48f750c0533c8db014720cba663ce68665a3 100644
--- a/src/sdl/sdlmain.h
+++ b/src/sdl/sdlmain.h
@@ -22,6 +22,11 @@
 extern SDL_bool consolevent;
 extern SDL_bool framebuffer;
 
+#include "../m_fixed.h"
+
+// SDL2 stub macro
+#define SDL2STUB(name) CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
+
 /**	\brief	The JoyInfo_s struct
 
   info about joystick
diff --git a/src/sdl12/IMG_xpm.c b/src/sdl12/IMG_xpm.c
new file mode 100644
index 0000000000000000000000000000000000000000..e08736d66515b89367f29022afd4ed663e570497
--- /dev/null
+++ b/src/sdl12/IMG_xpm.c
@@ -0,0 +1,506 @@
+/*
+    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
new file mode 100644
index 0000000000000000000000000000000000000000..5907579c1bc9d16abb0e338cb709566fd75b6c61
--- /dev/null
+++ b/src/sdl12/MakeCYG.cfg
@@ -0,0 +1,17 @@
+#
+# 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
new file mode 100644
index 0000000000000000000000000000000000000000..457f52301f69d458486abb6320f55dec40d0e3c2
--- /dev/null
+++ b/src/sdl12/MakeNIX.cfg
@@ -0,0 +1,92 @@
+#
+# 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
new file mode 100644
index 0000000000000000000000000000000000000000..1f9c7204ffa45d200c2ab9c08b64db19e88abc31
--- /dev/null
+++ b/src/sdl12/Makefile.cfg
@@ -0,0 +1,163 @@
+#
+# 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 -DSDL
+
+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
new file mode 100644
index 0000000000000000000000000000000000000000..70bb02d3c97a0ffe37a5e890c4736386779bcbb1
--- /dev/null
+++ b/src/sdl12/SDL_icon.xpm
@@ -0,0 +1,80 @@
+/* XPM */
+static const char * SDL_icon_xpm[] = {
+"32 32 45 1",
+" 	c None",
+".	c #6B6BFF",
+"+	c #3D00B9",
+"@	c #4848FF",
+"#	c #2525FF",
+"$	c #310096",
+"%	c #003196",
+"&	c #003DB9",
+"*	c #620096",
+"=	c #6E6E6E",
+"-	c #966200",
+";	c #250073",
+">	c #626262",
+",	c #FF8F6B",
+"'	c #FFC66B",
+")	c #FFAB8E",
+"!	c #000080",
+"~	c #B6B6B6",
+"{	c #929292",
+"]	c #FFD48E",
+"^	c #0000B9",
+"/	c #565656",
+"(	c #868686",
+"_	c #808080",
+":	c #C0C0C0",
+"<	c #DADADA",
+"[	c #F2F2F2",
+"}	c #FFFFFF",
+"|	c #CECECE",
+"1	c #AAAAAA",
+"2	c #E6E6E6",
+"3	c #000096",
+"4	c #AB8EFF",
+"5	c #190050",
+"6	c #000000",
+"7	c #8E8EFF",
+"8	c #3E3E3E",
+"9	c #7A7A7A",
+"0	c #0E0E0E",
+"a	c #9E9E9E",
+"b	c #001950",
+"c	c #C2C2C2",
+"d	c #323232",
+"e	c #002573",
+"f	c #A0A0A4",
+"                                ",
+"                                ",
+"                                ",
+"             .+@##@.            ",
+"           @@.@#######@         ",
+"         @@....#########        ",
+" ..    .@.....@+##$%%%&&%       ",
+" ..@# @@....@+#*=-;%%%%%        ",
+"  ..@#@......@>,')!%%%$         ",
+" ~..$#.........{])^#+%/         ",
+"   +##@.........()^@@@@@_       ",
+"  $####@........#=#######+      ",
+"  +######....@@##^#########_    ",
+"  +#####=:<<:+##############/   ",
+"[<=####{<}}}}|###############=  ",
+" }1###=2}}}}}}.###############  ",
+" }<3#3~}}}}}}}4################ ",
+" }<5#6:}}}}}}}7################/",
+" }:6861}}}}}}}.########$$ 9  .@$",
+" }:0a6~}}}}}}}@######5b         ",
+"22cd262}}}}}}2######5b$         ",
+"  2>1a}}}}}}}{(*###%be##        ",
+"  860)1<[22c1)]]+##be###        ",
+"  ~)]]]))))]]]]]=#bb####        ",
+"   )]]]]]]]]](]]=eb$####        ",
+"    :]]]]]]]]]'9bbb$#####       ",
+"      ),'''''(    >db+###       ",
+"                      =##f      ",
+"                        {       ",
+"                                ",
+"                                ",
+"                                "};
diff --git a/src/sdl12/SDL_main/SDL_dummy_main.c b/src/sdl12/SDL_main/SDL_dummy_main.c
new file mode 100644
index 0000000000000000000000000000000000000000..d8cfdd5bb2a87d2bb2a718aaee1e42cb38914404
--- /dev/null
+++ b/src/sdl12/SDL_main/SDL_dummy_main.c
@@ -0,0 +1,12 @@
+/* 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
new file mode 100644
index 0000000000000000000000000000000000000000..4683df57a5e61fc41b189e67245f4a0a32d7552d
--- /dev/null
+++ b/src/sdl12/SDL_main/SDL_macosx_main.h
@@ -0,0 +1,11 @@
+/*   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
new file mode 100644
index 0000000000000000000000000000000000000000..226afe13d257f0b78a1bc99e93b9631ebe4fa547
--- /dev/null
+++ b/src/sdl12/SDL_main/SDL_macosx_main.m
@@ -0,0 +1,374 @@
+/*   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
new file mode 100644
index 0000000000000000000000000000000000000000..63db8da2d8f64f241bc05bc17a6609c270a4b65b
--- /dev/null
+++ b/src/sdl12/SDL_main/SDL_openxdk_main.c
@@ -0,0 +1,7 @@
+/* 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
new file mode 100644
index 0000000000000000000000000000000000000000..46b20d0bd83590b0f23cf092ef5df4b46bf4d017
--- /dev/null
+++ b/src/sdl12/SDL_main/SDL_win32_main.c
@@ -0,0 +1,406 @@
+/*
+    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/sdl/SRB2CE/Makefile.cfg b/src/sdl12/SRB2CE/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2CE/Makefile.cfg
rename to src/sdl12/SRB2CE/Makefile.cfg
diff --git a/src/sdl/SRB2CE/SRB2CE.zip b/src/sdl12/SRB2CE/SRB2CE.zip
similarity index 100%
rename from src/sdl/SRB2CE/SRB2CE.zip
rename to src/sdl12/SRB2CE/SRB2CE.zip
diff --git a/src/sdl/SRB2CE/cehelp.c b/src/sdl12/SRB2CE/cehelp.c
similarity index 100%
rename from src/sdl/SRB2CE/cehelp.c
rename to src/sdl12/SRB2CE/cehelp.c
diff --git a/src/sdl/SRB2CE/cehelp.h b/src/sdl12/SRB2CE/cehelp.h
similarity index 100%
rename from src/sdl/SRB2CE/cehelp.h
rename to src/sdl12/SRB2CE/cehelp.h
diff --git a/src/sdl/SRB2DC/.gitignore b/src/sdl12/SRB2DC/.gitignore
similarity index 100%
rename from src/sdl/SRB2DC/.gitignore
rename to src/sdl12/SRB2DC/.gitignore
diff --git a/src/sdl/SRB2DC/IP.BIN b/src/sdl12/SRB2DC/IP.BIN
similarity index 100%
rename from src/sdl/SRB2DC/IP.BIN
rename to src/sdl12/SRB2DC/IP.BIN
diff --git a/src/sdl/SRB2DC/Makefile.cfg b/src/sdl12/SRB2DC/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2DC/Makefile.cfg
rename to src/sdl12/SRB2DC/Makefile.cfg
diff --git a/src/sdl/SRB2DC/SELFBOOT.BIN b/src/sdl12/SRB2DC/SELFBOOT.BIN
similarity index 100%
rename from src/sdl/SRB2DC/SELFBOOT.BIN
rename to src/sdl12/SRB2DC/SELFBOOT.BIN
diff --git a/src/sdl/SRB2DC/VMU.xbm b/src/sdl12/SRB2DC/VMU.xbm
similarity index 100%
rename from src/sdl/SRB2DC/VMU.xbm
rename to src/sdl12/SRB2DC/VMU.xbm
diff --git a/src/sdl/SRB2DC/dchelp.c b/src/sdl12/SRB2DC/dchelp.c
similarity index 100%
rename from src/sdl/SRB2DC/dchelp.c
rename to src/sdl12/SRB2DC/dchelp.c
diff --git a/src/sdl/SRB2DC/dchelp.h b/src/sdl12/SRB2DC/dchelp.h
similarity index 100%
rename from src/sdl/SRB2DC/dchelp.h
rename to src/sdl12/SRB2DC/dchelp.h
diff --git a/src/sdl/SRB2DC/i_udp.c b/src/sdl12/SRB2DC/i_udp.c
similarity index 100%
rename from src/sdl/SRB2DC/i_udp.c
rename to src/sdl12/SRB2DC/i_udp.c
diff --git a/src/sdl/SRB2DC/scramble.c b/src/sdl12/SRB2DC/scramble.c
similarity index 100%
rename from src/sdl/SRB2DC/scramble.c
rename to src/sdl12/SRB2DC/scramble.c
diff --git a/src/sdl/SRB2PS3/ICON0.png b/src/sdl12/SRB2PS3/ICON0.png
similarity index 100%
rename from src/sdl/SRB2PS3/ICON0.png
rename to src/sdl12/SRB2PS3/ICON0.png
diff --git a/src/sdl/SRB2PS3/Makefile.cfg b/src/sdl12/SRB2PS3/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2PS3/Makefile.cfg
rename to src/sdl12/SRB2PS3/Makefile.cfg
diff --git a/src/sdl/SRB2PS3/sfo.xml b/src/sdl12/SRB2PS3/sfo.xml
similarity index 100%
rename from src/sdl/SRB2PS3/sfo.xml
rename to src/sdl12/SRB2PS3/sfo.xml
diff --git a/src/sdl/SRB2PSP/ICON0.png b/src/sdl12/SRB2PSP/ICON0.png
similarity index 100%
rename from src/sdl/SRB2PSP/ICON0.png
rename to src/sdl12/SRB2PSP/ICON0.png
diff --git a/src/sdl/SRB2PSP/Makefile.cfg b/src/sdl12/SRB2PSP/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2PSP/Makefile.cfg
rename to src/sdl12/SRB2PSP/Makefile.cfg
diff --git a/src/sdl/SRB2PSP/PIC1.png b/src/sdl12/SRB2PSP/PIC1.png
similarity index 100%
rename from src/sdl/SRB2PSP/PIC1.png
rename to src/sdl12/SRB2PSP/PIC1.png
diff --git a/src/sdl/SRB2PSP/psp-prxsign/.gitignore b/src/sdl12/SRB2PSP/psp-prxsign/.gitignore
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/.gitignore
rename to src/sdl12/SRB2PSP/psp-prxsign/.gitignore
diff --git a/src/sdl/SRB2PSP/psp-prxsign/Makefile b/src/sdl12/SRB2PSP/psp-prxsign/Makefile
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/Makefile
rename to src/sdl12/SRB2PSP/psp-prxsign/Makefile
diff --git a/src/sdl/SRB2PSP/psp-prxsign/cmac.c b/src/sdl12/SRB2PSP/psp-prxsign/cmac.c
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/cmac.c
rename to src/sdl12/SRB2PSP/psp-prxsign/cmac.c
diff --git a/src/sdl/SRB2PSP/psp-prxsign/cmac.h b/src/sdl12/SRB2PSP/psp-prxsign/cmac.h
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/cmac.h
rename to src/sdl12/SRB2PSP/psp-prxsign/cmac.h
diff --git a/src/sdl/SRB2PSP/psp-prxsign/kirk_header.h b/src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/kirk_header.h
rename to src/sdl12/SRB2PSP/psp-prxsign/kirk_header.h
diff --git a/src/sdl/SRB2PSP/psp-prxsign/main.c b/src/sdl12/SRB2PSP/psp-prxsign/main.c
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/main.c
rename to src/sdl12/SRB2PSP/psp-prxsign/main.c
diff --git a/src/sdl/SRB2PSP/psp-prxsign/psp_header.h b/src/sdl12/SRB2PSP/psp-prxsign/psp_header.h
similarity index 100%
rename from src/sdl/SRB2PSP/psp-prxsign/psp_header.h
rename to src/sdl12/SRB2PSP/psp-prxsign/psp_header.h
diff --git a/src/sdl12/SRB2Pandora/Makefile.cfg b/src/sdl12/SRB2Pandora/Makefile.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..c7f0f8449c67995c3486fc2fc8639e76be859f61
--- /dev/null
+++ b/src/sdl12/SRB2Pandora/Makefile.cfg
@@ -0,0 +1,39 @@
+# 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
new file mode 100644
index 0000000000000000000000000000000000000000..33a9587dbd7081cece3ad7804ab1db3d728685d4
--- /dev/null
+++ b/src/sdl12/SRB2Pandora/PXML.xml
@@ -0,0 +1,17 @@
+<?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
new file mode 100644
index 0000000000000000000000000000000000000000..63af73ac3a4e3046783312465aec2d985172f726
Binary files /dev/null and b/src/sdl12/SRB2Pandora/icon.png differ
diff --git a/src/sdl/SRB2WII/Makefile.cfg b/src/sdl12/SRB2WII/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2WII/Makefile.cfg
rename to src/sdl12/SRB2WII/Makefile.cfg
diff --git a/src/sdl/SRB2WII/icon.png b/src/sdl12/SRB2WII/icon.png
similarity index 100%
rename from src/sdl/SRB2WII/icon.png
rename to src/sdl12/SRB2WII/icon.png
diff --git a/src/sdl/SRB2WII/meta.xml b/src/sdl12/SRB2WII/meta.xml
similarity index 100%
rename from src/sdl/SRB2WII/meta.xml
rename to src/sdl12/SRB2WII/meta.xml
diff --git a/src/sdl/SRB2XBOX/Makefile.cfg b/src/sdl12/SRB2XBOX/Makefile.cfg
similarity index 100%
rename from src/sdl/SRB2XBOX/Makefile.cfg
rename to src/sdl12/SRB2XBOX/Makefile.cfg
diff --git a/src/sdl/SRB2XBOX/xboxhelp.c b/src/sdl12/SRB2XBOX/xboxhelp.c
similarity index 100%
rename from src/sdl/SRB2XBOX/xboxhelp.c
rename to src/sdl12/SRB2XBOX/xboxhelp.c
diff --git a/src/sdl/SRB2XBOX/xboxhelp.h b/src/sdl12/SRB2XBOX/xboxhelp.h
similarity index 100%
rename from src/sdl/SRB2XBOX/xboxhelp.h
rename to src/sdl12/SRB2XBOX/xboxhelp.h
diff --git a/src/sdl12/Srb2SDL-vc10.vcxproj b/src/sdl12/Srb2SDL-vc10.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..192f191561fdb2441a1bb8ce6c630ab565039da4
--- /dev/null
+++ b/src/sdl12/Srb2SDL-vc10.vcxproj
@@ -0,0 +1,1464 @@
+<?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;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;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;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;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>
\ No newline at end of file
diff --git a/src/sdl12/Srb2SDL-vc9.vcproj b/src/sdl12/Srb2SDL-vc9.vcproj
new file mode 100644
index 0000000000000000000000000000000000000000..620202bdfe240232db540e282739d2217f2bd39b
--- /dev/null
+++ b/src/sdl12/Srb2SDL-vc9.vcproj
@@ -0,0 +1,5845 @@
+<?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;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;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;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;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
new file mode 100644
index 0000000000000000000000000000000000000000..02c3b270109e383127375df4b1dfaa860b728f4b
--- /dev/null
+++ b/src/sdl12/Srb2SDL.dsp
@@ -0,0 +1,1057 @@
+# 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 "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 "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
new file mode 100644
index 0000000000000000000000000000000000000000..4f8f7bdce3b9de5b568c5371e4dd07d0d71f7131
--- /dev/null
+++ b/src/sdl12/Srb2SDL.dsw
@@ -0,0 +1,74 @@
+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
new file mode 100644
index 0000000000000000000000000000000000000000..5ab791af37f815c0164e6053c34879ecf0c3fff0
Binary files /dev/null and b/src/sdl12/Srb2SDL.ico differ
diff --git a/src/sdl12/dosstr.c b/src/sdl12/dosstr.c
new file mode 100644
index 0000000000000000000000000000000000000000..f9bbee9b4cf39e9ba7392e0a63e37c027d6d6f5e
--- /dev/null
+++ b/src/sdl12/dosstr.c
@@ -0,0 +1,38 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..1d7756b4de067a25e044adf1a47e3c8955510212
--- /dev/null
+++ b/src/sdl12/endtxt.c
@@ -0,0 +1,236 @@
+/*
+ * 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
new file mode 100644
index 0000000000000000000000000000000000000000..41f8e51adc2c1f12af6df13ba7f949176d63e4c0
--- /dev/null
+++ b/src/sdl12/endtxt.h
@@ -0,0 +1,24 @@
+// 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/sdl/filter/filters.c b/src/sdl12/filter/filters.c
similarity index 100%
rename from src/sdl/filter/filters.c
rename to src/sdl12/filter/filters.c
diff --git a/src/sdl/filter/filters.h b/src/sdl12/filter/filters.h
similarity index 100%
rename from src/sdl/filter/filters.h
rename to src/sdl12/filter/filters.h
diff --git a/src/sdl/filter/hq2x.c b/src/sdl12/filter/hq2x.c
similarity index 100%
rename from src/sdl/filter/hq2x.c
rename to src/sdl12/filter/hq2x.c
diff --git a/src/sdl/filter/hq2x.h b/src/sdl12/filter/hq2x.h
similarity index 100%
rename from src/sdl/filter/hq2x.h
rename to src/sdl12/filter/hq2x.h
diff --git a/src/sdl/filter/interp.h b/src/sdl12/filter/interp.h
similarity index 100%
rename from src/sdl/filter/interp.h
rename to src/sdl12/filter/interp.h
diff --git a/src/sdl/filter/lq2x.c b/src/sdl12/filter/lq2x.c
similarity index 100%
rename from src/sdl/filter/lq2x.c
rename to src/sdl12/filter/lq2x.c
diff --git a/src/sdl/filter/lq2x.h b/src/sdl12/filter/lq2x.h
similarity index 100%
rename from src/sdl/filter/lq2x.h
rename to src/sdl12/filter/lq2x.h
diff --git a/src/sdl/filter/main.c b/src/sdl12/filter/main.c
similarity index 100%
rename from src/sdl/filter/main.c
rename to src/sdl12/filter/main.c
diff --git a/src/sdl12/hwsym_sdl.c b/src/sdl12/hwsym_sdl.c
new file mode 100644
index 0000000000000000000000000000000000000000..43c71f7bf2274980ae56e2c354a7aa8212fa1f73
--- /dev/null
+++ b/src/sdl12/hwsym_sdl.c
@@ -0,0 +1,183 @@
+// 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 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);
+#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
new file mode 100644
index 0000000000000000000000000000000000000000..7297587bf3bcb42f5e3f10e52b43cc232e022b5b
--- /dev/null
+++ b/src/sdl12/hwsym_sdl.h
@@ -0,0 +1,23 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..adab39c902ce9ed215f630a7daaf76c2477f050f
--- /dev/null
+++ b/src/sdl12/i_cdmus.c
@@ -0,0 +1,588 @@
+// 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 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
new file mode 100644
index 0000000000000000000000000000000000000000..85abb704144a650f70d0308879f945361d28c1d0
--- /dev/null
+++ b/src/sdl12/i_main.c
@@ -0,0 +1,247 @@
+// 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 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
new file mode 100644
index 0000000000000000000000000000000000000000..c31935acf237edbeba60b25d65ae416f4af11eae
--- /dev/null
+++ b/src/sdl12/i_net.c
@@ -0,0 +1,442 @@
+// 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 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
new file mode 100644
index 0000000000000000000000000000000000000000..1e03edd88382245dea28ea95ea4ecad8b27df1f4
--- /dev/null
+++ b/src/sdl12/i_system.c
@@ -0,0 +1,3115 @@
+// 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 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
+}
+
+/**	\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
new file mode 100644
index 0000000000000000000000000000000000000000..770a81d98596d463248e5b7e032e1bbb835df699
--- /dev/null
+++ b/src/sdl12/i_ttf.c
@@ -0,0 +1,340 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..929c8021ccfae374c30415afca9a09e68ccc1c50
--- /dev/null
+++ b/src/sdl12/i_ttf.h
@@ -0,0 +1,88 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..1a2305fefcb6f577ed1312e1fb7bb679440c455d
--- /dev/null
+++ b/src/sdl12/i_video.c
@@ -0,0 +1,2100 @@
+// 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 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:
+		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;
+
+	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
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/src/sdl12/macosx/Info.plist b/src/sdl12/macosx/Info.plist
new file mode 100644
index 0000000000000000000000000000000000000000..ae0ce24de8e9ca4e07340ceb7851c1b13ec474bd
--- /dev/null
+++ b/src/sdl12/macosx/Info.plist
@@ -0,0 +1,28 @@
+<?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
new file mode 100644
index 0000000000000000000000000000000000000000..4baedc1c5a091a3917d2a33bc3780da5b1b5e996
Binary files /dev/null and b/src/sdl12/macosx/Srb2mac.icns differ
diff --git a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj
new file mode 100644
index 0000000000000000000000000000000000000000..de12201f5dc080390a9accea387021637c75aee5
--- /dev/null
+++ b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj
@@ -0,0 +1,3546 @@
+// !$*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
new file mode 100644
index 0000000000000000000000000000000000000000..1b1a9fdf6bf1723095acc16f4cb835b6abfe5288
--- /dev/null
+++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj
@@ -0,0 +1,1510 @@
+// !$*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.8;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(inherited)",
+					NORMALSRB2,
+				);
+				PRODUCT_NAME = Srb2mac;
+			};
+			name = Debug;
+		};
+		C01FCF4C08A954540054247B /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CURRENT_PROJECT_VERSION = 2.1.8;
+				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,
+					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,
+					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
new file mode 100644
index 0000000000000000000000000000000000000000..455e36509547e40af0a4a65f13f0e5517fb5dc24
--- /dev/null
+++ b/src/sdl12/macosx/mac_alert.c
@@ -0,0 +1,45 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..82a28d12023bcc1fe5954359c6a466306ca85a88
--- /dev/null
+++ b/src/sdl12/macosx/mac_alert.h
@@ -0,0 +1,27 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..98159b47368c3996124ff78343bef212b5b298d4
--- /dev/null
+++ b/src/sdl12/mixer_sound.c
@@ -0,0 +1,824 @@
+/// \file
+/// \brief SDL Mixer interface for sound
+
+#include "../doomdef.h"
+
+#if defined(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)sep<<1, 0xff), min((UINT16)(0xff-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)sep<<1, 0xff), min((UINT16)(0xff-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
new file mode 100644
index 0000000000000000000000000000000000000000..9427d3317eba3f1ac5ab7e36ab55082231d9bedf
--- /dev/null
+++ b/src/sdl12/ogl_sdl.c
@@ -0,0 +1,315 @@
+// 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 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;
+
+	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
new file mode 100644
index 0000000000000000000000000000000000000000..43c28fa422a0b42e6367da418e62aa5ce3aa1fb0
--- /dev/null
+++ b/src/sdl12/ogl_sdl.h
@@ -0,0 +1,30 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..3750e67789f1d1af7676133f1ebd30184c31a32a
--- /dev/null
+++ b/src/sdl12/sdl_sound.c
@@ -0,0 +1,2030 @@
+// 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(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 //SDL
diff --git a/src/sdl12/sdlmain.h b/src/sdl12/sdlmain.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e497b10dcca125916b09c515d43eb0e0dcdd8db
--- /dev/null
+++ b/src/sdl12/sdlmain.h
@@ -0,0 +1,65 @@
+// 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
new file mode 100644
index 0000000000000000000000000000000000000000..53f4c6a28a2adc0c97df4a7570ace24cf4949580
Binary files /dev/null and b/src/sdl12/srb2.ttf differ
diff --git a/src/v_video.c b/src/v_video.c
index 9daead7888b155ee4d6cb1c4977175479d4cff1c..d6ab2eef1bf52bf8312138d37e58cd9609f5a76c 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -222,7 +222,7 @@ void V_SetPalette(INT32 palettenum)
 #ifdef HWRENDER
 	if (rendermode != render_soft && rendermode != render_none)
 		HWR_SetPalette(&pLocalPalette[palettenum*256]);
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	else
 #endif
 #endif
@@ -236,7 +236,7 @@ void V_SetPaletteLump(const char *pal)
 #ifdef HWRENDER
 	if (rendermode != render_soft && rendermode != render_none)
 		HWR_SetPalette(pLocalPalette);
-#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL)
+#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
 	else
 #endif
 #endif
diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg
index 2ebde6b23c21f2b6cdc44e04be628fb6fd402a5d..b989923fe7f773efa5146f219eea62d00c682606 100644
--- a/src/win32/Makefile.cfg
+++ b/src/win32/Makefile.cfg
@@ -53,13 +53,12 @@ endif
 
 	# name of the exefile
 ifdef SDL
-	EXENAME?=srb2sdl.exe
+	EXENAME?=srb2sdl2.exe
 else
 	EXENAME?=srb2win.exe
 endif
 
 ifdef SDL
-	D_FILES+=$(D_DIR)/fmod.dll
 	i_system_o+=$(OBJDIR)/SRB2.res
 	i_main_o+=$(OBJDIR)/win_dbg.o
 ifndef NOHW