diff --git a/libxenia.vcxproj b/libxenia.vcxproj
index 74515307c..e5e1950e5 100644
--- a/libxenia.vcxproj
+++ b/libxenia.vcxproj
@@ -397,6 +397,7 @@
+
diff --git a/libxenia.vcxproj.filters b/libxenia.vcxproj.filters
index 9484f4917..86f734604 100644
--- a/libxenia.vcxproj.filters
+++ b/libxenia.vcxproj.filters
@@ -1371,6 +1371,9 @@
src\xenia\ui
+
+ src\xenia\ui\gl
+
diff --git a/src/xenia/apu/xaudio2/xaudio2_audio_driver.cc b/src/xenia/apu/xaudio2/xaudio2_audio_driver.cc
index ad2097303..7ed03bd1f 100644
--- a/src/xenia/apu/xaudio2/xaudio2_audio_driver.cc
+++ b/src/xenia/apu/xaudio2/xaudio2_audio_driver.cc
@@ -9,6 +9,8 @@
#include "xenia/apu/xaudio2/xaudio2_audio_driver.h"
+#include
+
#include "xenia/apu/apu_flags.h"
#include "xenia/base/clock.h"
#include "xenia/base/logging.h"
@@ -39,13 +41,16 @@ class XAudio2AudioDriver::VoiceCallback : public IXAudio2VoiceCallback {
};
XAudio2AudioDriver::XAudio2AudioDriver(Emulator* emulator, HANDLE semaphore)
- : audio_(nullptr),
+ : AudioDriver(emulator),
+ audio_(nullptr),
mastering_voice_(nullptr),
pcm_voice_(nullptr),
semaphore_(semaphore),
voice_callback_(nullptr),
- current_frame_(0),
- AudioDriver(emulator) {}
+ current_frame_(0) {
+ static_assert(frame_count_ == XAUDIO2_MAX_QUEUED_BUFFERS,
+ "xaudio header differs");
+}
XAudio2AudioDriver::~XAudio2AudioDriver() = default;
diff --git a/src/xenia/apu/xaudio2/xaudio2_audio_driver.h b/src/xenia/apu/xaudio2/xaudio2_audio_driver.h
index cc93eabe5..bae67ebb4 100644
--- a/src/xenia/apu/xaudio2/xaudio2_audio_driver.h
+++ b/src/xenia/apu/xaudio2/xaudio2_audio_driver.h
@@ -10,10 +10,12 @@
#ifndef XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_DRIVER_H_
#define XENIA_APU_XAUDIO2_XAUDIO2_AUDIO_DRIVER_H_
-#include
-
#include "xenia/apu/audio_driver.h"
+struct IXAudio2;
+struct IXAudio2MasteringVoice;
+struct IXAudio2SourceVoice;
+
namespace xe {
namespace apu {
namespace xaudio2 {
@@ -36,7 +38,7 @@ class XAudio2AudioDriver : public AudioDriver {
class VoiceCallback;
VoiceCallback* voice_callback_;
- static const uint32_t frame_count_ = XAUDIO2_MAX_QUEUED_BUFFERS;
+ static const uint32_t frame_count_ = 64;
static const uint32_t frame_channels_ = 6;
static const uint32_t channel_samples_ = 256;
static const uint32_t frame_samples_ = frame_channels_ * channel_samples_;
diff --git a/src/xenia/base/debugging_win.cc b/src/xenia/base/debugging_win.cc
index 826c807c1..ab0aaff05 100644
--- a/src/xenia/base/debugging_win.cc
+++ b/src/xenia/base/debugging_win.cc
@@ -8,9 +8,9 @@
*/
#include "xenia/base/debugging.h"
-#include "xenia/base/string_buffer.h"
-#include
+#include "xenia/base/platform.h"
+#include "xenia/base/string_buffer.h"
namespace xe {
namespace debugging {
diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc
index 36a48d596..cbf0c4dbf 100644
--- a/src/xenia/base/filesystem_win.cc
+++ b/src/xenia/base/filesystem_win.cc
@@ -9,8 +9,6 @@
#include "xenia/base/filesystem.h"
-#include
-
#include
#include "xenia/base/platform.h"
diff --git a/src/xenia/base/main_win.cc b/src/xenia/base/main_win.cc
index 2e56405a8..43595a76e 100644
--- a/src/xenia/base/main_win.cc
+++ b/src/xenia/base/main_win.cc
@@ -10,10 +10,9 @@
#include "xenia/base/main.h"
#include
-#include
-#include
-
#include
+#include
+
#include "xenia/base/string.h"
namespace xe {
diff --git a/src/xenia/base/mapped_memory_win.cc b/src/xenia/base/mapped_memory_win.cc
index 945440749..52c1e2b6e 100644
--- a/src/xenia/base/mapped_memory_win.cc
+++ b/src/xenia/base/mapped_memory_win.cc
@@ -9,14 +9,13 @@
#include "xenia/base/mapped_memory.h"
-#include
-
#include
#include
#include
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
+#include "xenia/base/platform.h"
namespace xe {
diff --git a/src/xenia/base/platform.h b/src/xenia/base/platform.h
index ee75d72c9..a3ededa78 100644
--- a/src/xenia/base/platform.h
+++ b/src/xenia/base/platform.h
@@ -45,11 +45,16 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
+#define NOMINMAX
#include
#include
#include
-#undef min
-#undef max
+#include
+#include
+#include
+#include
+#include
+#include
#define strdup _strdup
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
diff --git a/src/xenia/base/platform_win.cc b/src/xenia/base/platform_win.cc
index bf12e2635..566a96193 100644
--- a/src/xenia/base/platform_win.cc
+++ b/src/xenia/base/platform_win.cc
@@ -9,8 +9,6 @@
#include "xenia/base/platform.h"
-#include
-
namespace xe {
void LaunchBrowser(const char* url) {
diff --git a/src/xenia/cpu/backend/x64/x64_backend.cc b/src/xenia/cpu/backend/x64/x64_backend.cc
index 50a112c81..ec2126366 100644
--- a/src/xenia/cpu/backend/x64/x64_backend.cc
+++ b/src/xenia/cpu/backend/x64/x64_backend.cc
@@ -15,7 +15,6 @@
#include "xenia/cpu/backend/x64/x64_sequences.h"
#include "xenia/cpu/backend/x64/x64_stack_layout.h"
#include "xenia/cpu/processor.h"
-#include "third_party/xbyak/xbyak/xbyak_util.h"
DEFINE_bool(
enable_haswell_instructions, true,
diff --git a/src/xenia/cpu/backend/x64/x64_emitter.h b/src/xenia/cpu/backend/x64/x64_emitter.h
index c9d1cc4f1..d5b56ee17 100644
--- a/src/xenia/cpu/backend/x64/x64_emitter.h
+++ b/src/xenia/cpu/backend/x64/x64_emitter.h
@@ -10,9 +10,6 @@
#ifndef XENIA_BACKEND_X64_X64_EMITTER_H_
#define XENIA_BACKEND_X64_X64_EMITTER_H_
-#include "third_party/xbyak/xbyak/xbyak.h"
-#include "third_party/xbyak/xbyak/xbyak_util.h"
-
#include "xenia/base/arena.h"
#include "xenia/cpu/hir/hir_builder.h"
#include "xenia/cpu/hir/instr.h"
@@ -20,6 +17,10 @@
#include "xenia/debug/function_trace_data.h"
#include "xenia/memory.h"
+// NOTE: must be included last as it expects windows.h to already be included.
+#include "third_party/xbyak/xbyak/xbyak.h"
+#include "third_party/xbyak/xbyak/xbyak_util.h"
+
namespace xe {
namespace cpu {
class DebugInfo;
diff --git a/src/xenia/cpu/mmio_handler_win.cc b/src/xenia/cpu/mmio_handler_win.cc
index 2c7979230..cff291977 100644
--- a/src/xenia/cpu/mmio_handler_win.cc
+++ b/src/xenia/cpu/mmio_handler_win.cc
@@ -9,8 +9,7 @@
#include "xenia/cpu/mmio_handler.h"
-#include
-
+#include "xenia/base/platform.h"
#include "xenia/profiling.h"
namespace xe {
diff --git a/src/xenia/kernel/xam_net.cc b/src/xenia/kernel/xam_net.cc
index d39d334e6..b55e1cddd 100644
--- a/src/xenia/kernel/xam_net.cc
+++ b/src/xenia/kernel/xam_net.cc
@@ -7,9 +7,6 @@
******************************************************************************
*/
-#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
-#include
-
#include
#include "xenia/base/clock.h"
@@ -20,6 +17,10 @@
#include "xenia/kernel/xam_private.h"
#include "xenia/xbox.h"
+// NOTE: must be included last as it expects windows.h to already be included.
+#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
+#include
+
namespace xe {
namespace kernel {
diff --git a/src/xenia/ui/gl/blitter.h b/src/xenia/ui/gl/blitter.h
index c4eed6c73..5e86946f6 100644
--- a/src/xenia/ui/gl/blitter.h
+++ b/src/xenia/ui/gl/blitter.h
@@ -12,8 +12,7 @@
#include
-#include "third_party/GL/glew.h"
-#include "third_party/GL/wglew.h"
+#include "xenia/ui/gl/gl.h"
namespace xe {
namespace ui {
diff --git a/src/xenia/ui/gl/circular_buffer.h b/src/xenia/ui/gl/circular_buffer.h
index 1cbc42c50..3b9c119f8 100644
--- a/src/xenia/ui/gl/circular_buffer.h
+++ b/src/xenia/ui/gl/circular_buffer.h
@@ -12,7 +12,7 @@
#include
-#include "xenia/ui/gl/gl_context.h"
+#include "xenia/ui/gl/gl.h"
namespace xe {
namespace ui {
diff --git a/src/xenia/ui/gl/gl.h b/src/xenia/ui/gl/gl.h
new file mode 100644
index 000000000..4352ca8b3
--- /dev/null
+++ b/src/xenia/ui/gl/gl.h
@@ -0,0 +1,21 @@
+/**
+******************************************************************************
+* Xenia : Xbox 360 Emulator Research Project *
+******************************************************************************
+* Copyright 2015 Ben Vanik. All rights reserved. *
+* Released under the BSD license - see LICENSE in the root for more details. *
+******************************************************************************
+*/
+
+#ifndef XENIA_UI_GL_GL_H_
+#define XENIA_UI_GL_GL_H_
+
+#include "xenia/base/platform.h"
+
+#include "third_party/GL/glew.h"
+#include "third_party/GL/wglew.h"
+
+extern "C" GLEWContext* glewGetContext();
+extern "C" WGLEWContext* wglewGetContext();
+
+#endif // XENIA_UI_GL_GL_H_
diff --git a/src/xenia/ui/gl/gl_context.h b/src/xenia/ui/gl/gl_context.h
index 64184a715..d8ae4f766 100644
--- a/src/xenia/ui/gl/gl_context.h
+++ b/src/xenia/ui/gl/gl_context.h
@@ -14,15 +14,11 @@
#include
-#include "third_party/GL/glew.h"
-#include "third_party/GL/wglew.h"
#include "xenia/ui/gl/blitter.h"
+#include "xenia/ui/gl/gl.h"
DECLARE_bool(thread_safe_gl);
-extern "C" GLEWContext* glewGetContext();
-extern "C" WGLEWContext* wglewGetContext();
-
namespace xe {
namespace ui {
namespace gl {
diff --git a/src/xenia/ui/win32/win32_control.h b/src/xenia/ui/win32/win32_control.h
index 9beda4cef..87e3d849d 100644
--- a/src/xenia/ui/win32/win32_control.h
+++ b/src/xenia/ui/win32/win32_control.h
@@ -10,9 +10,7 @@
#ifndef XENIA_UI_WIN32_WIN32_CONTROL_H_
#define XENIA_UI_WIN32_WIN32_CONTROL_H_
-#include
-#include
-
+#include "xenia/base/platform.h"
#include "xenia/ui/control.h"
namespace xe {
diff --git a/src/xenia/ui/win32/win32_file_picker.cc b/src/xenia/ui/win32/win32_file_picker.cc
index baefbbaf5..ded97de33 100644
--- a/src/xenia/ui/win32/win32_file_picker.cc
+++ b/src/xenia/ui/win32/win32_file_picker.cc
@@ -9,12 +9,7 @@
#include "xenia/ui/win32/win32_file_picker.h"
-#include
-#include
-#include
-#include
-#include
-
+#include "xenia/base/platform.h"
#include "xenia/base/assert.h"
namespace xe {
diff --git a/src/xenia/ui/win32/win32_loop.h b/src/xenia/ui/win32/win32_loop.h
index fc0fc3121..617d6b63f 100644
--- a/src/xenia/ui/win32/win32_loop.h
+++ b/src/xenia/ui/win32/win32_loop.h
@@ -10,14 +10,12 @@
#ifndef XENIA_UI_WIN32_WIN32_LOOP_H_
#define XENIA_UI_WIN32_WIN32_LOOP_H_
-#include
-#include
-
#include
#include
#include
#include
+#include "xenia/base/platform.h"
#include "xenia/base/threading.h"
#include "xenia/ui/loop.h"
diff --git a/src/xenia/ui/win32/win32_menu_item.h b/src/xenia/ui/win32/win32_menu_item.h
index 392af2e55..46974229a 100644
--- a/src/xenia/ui/win32/win32_menu_item.h
+++ b/src/xenia/ui/win32/win32_menu_item.h
@@ -10,9 +10,7 @@
#ifndef XENIA_UI_WIN32_WIN32_MENU_ITEM_H_
#define XENIA_UI_WIN32_WIN32_MENU_ITEM_H_
-#include
-#include
-
+#include "xenia/base/platform.h"
#include "xenia/ui/menu_item.h"
namespace xe {
diff --git a/src/xenia/ui/win32/win32_window.cc b/src/xenia/ui/win32/win32_window.cc
index d335956ee..4436e789d 100644
--- a/src/xenia/ui/win32/win32_window.cc
+++ b/src/xenia/ui/win32/win32_window.cc
@@ -10,9 +10,6 @@
#include "xenia/ui/win32/win32_window.h"
#include
-#include
-#include
-#include
#include "xenia/base/logging.h"