diff --git a/aegisub/font_file_lister.cpp b/aegisub/font_file_lister.cpp
index 460347886c843d51518b908a3ccc78ada95bdae0..fb9f0243e1720b6fb0b9fa82ce2f860d412536db 100644
--- a/aegisub/font_file_lister.cpp
+++ b/aegisub/font_file_lister.cpp
@@ -42,7 +42,7 @@
 #include "text_file_writer.h"
 #include "text_file_reader.h"
 #include "standard_paths.h"
-#if defined(WIN32) || defined(__APPLE__)
+#if defined(__WINDOWS__) || defined(__APPLE__)
 #ifdef WITH_FREETYPE2
 #include "font_file_lister_freetype.h"
 #define FontListerClass FreetypeFontFileLister
diff --git a/aegisub/font_file_lister.h b/aegisub/font_file_lister.h
index 5c5cd5acb1407e23317de416fdeae3be0189cf33..90e1e2ccec75c867f4e09c717f9a95c6319b311d 100644
--- a/aegisub/font_file_lister.h
+++ b/aegisub/font_file_lister.h
@@ -47,7 +47,7 @@
 
 ////////////
 // Typedefs
-#if defined(WIN32) || defined(__APPLE__)
+#if defined(__WINDOWS__) || defined(__APPLE__)
 typedef struct FT_LibraryRec_ *FT_Library;
 #endif
 typedef std::map<wxString,wxArrayString> FontMap;
diff --git a/aegisub/stdwx.h b/aegisub/stdwx.h
index dfc83cb9ccbfdb5974d4f833c6d6e0c4e74f9bf1..8f837d35a68dce6f9a12d041025b66cdc5eb98a3 100644
--- a/aegisub/stdwx.h
+++ b/aegisub/stdwx.h
@@ -99,5 +99,7 @@
 #include <list>
 #include <map>
 
+#pragma warning(default: 6011)
+
 
 #endif // C++
diff --git a/build/aegisub_vs2005/aegisub_vs2005.vcproj b/build/aegisub_vs2005/aegisub_vs2005.vcproj
index f840a1d186436aca01d74a6a8ba37df2fcc59197..5356e1521d75404d18db9bccd1701e079c7d7e93 100644
--- a/build/aegisub_vs2005/aegisub_vs2005.vcproj
+++ b/build/aegisub_vs2005/aegisub_vs2005.vcproj
@@ -132,7 +132,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="../../aegisub/win64;../../hunspell/src"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				PreprocessorDefinitions="WIN32;WIN64;_DEBUG;_WINDOWS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -305,7 +305,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="../../aegisub/win64;../../hunspell/src"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				PreprocessorDefinitions="WIN32;WIN64;NDEBUG;_WINDOWS"
 				RuntimeLibrary="2"
 				OpenMP="true"
 				UsePrecompiledHeader="2"
@@ -1387,14 +1387,6 @@
 		<Filter
 			Name="Core"
 			>
-			<File
-				RelativePath="..\..\aegisub\win32\config.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\aegisub\win32\config0.h"
-				>
-			</File>
 			<File
 				RelativePath="..\..\aegisub\frame_main.cpp"
 				>
@@ -1820,6 +1812,34 @@
 				>
 			</File>
 		</Filter>
+		<Filter
+			Name="Config"
+			>
+			<Filter
+				Name="win32"
+				>
+				<File
+					RelativePath="..\..\aegisub\win32\config.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\aegisub\win32\config0.h"
+					>
+				</File>
+			</Filter>
+			<Filter
+				Name="win64"
+				>
+				<File
+					RelativePath="..\..\aegisub\win64\config.h"
+					>
+				</File>
+				<File
+					RelativePath="..\..\aegisub\win64\config0.h"
+					>
+				</File>
+			</Filter>
+		</Filter>
 		<File
 			RelativePath="..\..\aegisub\changelog.txt"
 			>
diff --git a/universalchardet/prcpucfg.h b/universalchardet/prcpucfg.h
index ff316f8f1c651477dbba20d022a49e388dd3ba84..7b1c816e4437233fc972d2fa47ce229fe318df8d 100644
--- a/universalchardet/prcpucfg.h
+++ b/universalchardet/prcpucfg.h
@@ -143,8 +143,60 @@
 
 #else /* defined(_M_IX86) || defined(_X86_) */
 
+#ifdef WIN64
+
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_WORD	4
+#define PR_BYTES_PER_DWORD	8
+#define PR_BYTES_PER_DOUBLE 8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_WORD	32
+#define PR_BITS_PER_DWORD	64
+#define PR_BITS_PER_DOUBLE  64
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_WORD_LOG2	5
+#define PR_BITS_PER_DWORD_LOG2	6
+#define PR_BITS_PER_DOUBLE_LOG2 6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_WORD	4
+#define PR_ALIGN_OF_DWORD	8
+#define PR_ALIGN_OF_DOUBLE  4
+#define PR_ALIGN_OF_POINTER 4
+
+#define PR_BYTES_PER_WORD_LOG2	2
+#define PR_BYTES_PER_DWORD_LOG2	2
+
+#else
+
 #error unknown processor architecture
 
+#endif
+
 #endif /* defined(_M_IX86) || defined(_X86_) */
 
 #define HAVE_LONG_LONG
diff --git a/universalchardet/universalcharset.vcproj b/universalchardet/universalcharset.vcproj
index 75d3f2f3596a789cc160c50aec31c5b32a9c6a51..671a424d6384672d4d554866ff5f2dd0007e0865 100644
--- a/universalchardet/universalcharset.vcproj
+++ b/universalchardet/universalcharset.vcproj
@@ -82,12 +82,11 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="1"
-			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -103,11 +102,15 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="2"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;WIN64;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
@@ -124,7 +127,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="../lib/univcset.lib"
+				OutputFile="../lib/univcset_d.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -143,11 +146,12 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="4"
 			CharacterSet="1"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -163,15 +167,11 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
@@ -188,7 +188,7 @@
 			/>
 			<Tool
 				Name="VCLibrarianTool"
-				OutputFile="../lib/univcset_d.lib"
+				OutputFile="../lib/univcset.lib"
 			/>
 			<Tool
 				Name="VCALinkTool"
@@ -232,7 +232,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				PreprocessorDefinitions="WIN32;WIN64;NDEBUG;_LIB"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"