diff --git a/Source/Core/AudioCommon/Src/Mixer.h b/Source/Core/AudioCommon/Src/Mixer.h index 131a620a1e..f480f7a27a 100644 --- a/Source/Core/AudioCommon/Src/Mixer.h +++ b/Source/Core/AudioCommon/Src/Mixer.h @@ -19,6 +19,7 @@ #define _MIXER_H_ #include "FixedSizeQueue.h" +#include "Thread.h" // On real hardware, this fifo is much, much smaller. But timing is also // tighter than under Windows, so... diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index fe792ee81d..0442f59430 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -85,16 +85,16 @@ #define HAVE_SFML 1 #define HAVE_OPENAL 1 -namespace -{ // it is VERY DANGEROUS to mix _SECURE_SCL=0 and _SECURE_SCL=1 compiled libraries. // You will get bizarre crash bugs whenever you use STL. - #ifndef _SECURE_SCL - #error Please define _SECURE_SCL=0 in the project settings - #else - CompileTimeAssert<_SECURE_SCL==0> x; - #endif -} + namespace + { + #ifndef _SECURE_SCL + #error Please define _SECURE_SCL=0 in the project settings + #else + CompileTimeAssert<_SECURE_SCL==0> x; + #endif + } // Debug definions #if defined(_DEBUG) @@ -111,7 +111,7 @@ namespace #define MAX_PATH 260 // Windows compatibility - #define __forceinline inline + #define __forceinline inline __attribute__((always_inline)) #ifdef _LP64 #define _M_X64 1 @@ -119,11 +119,12 @@ namespace #define _M_IX86 1 #endif // Alignment - #define GC_ALIGNED16(x) __attribute((aligned(16))) x - #define GC_ALIGNED32(x) __attribute((aligned(16))) x - #define GC_ALIGNED64(x) __attribute((aligned(64))) x - #define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x - #define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x + #define GC_ALIGNED16(x) __attribute__((aligned(16))) x + #define GC_ALIGNED32(x) __attribute__((aligned(16))) x + #define GC_ALIGNED64(x) __attribute__((aligned(64))) x + #define GC_ALIGNED16_DECL(x) __attribute__((aligned(16))) x + #define GC_ALIGNED64_DECL(x) __attribute__((aligned(64))) x + #endif // WIN32 // A macro to disallow the copy constructor and operator= functions diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 1b476161e7..5703fe5ce6 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -17,6 +17,7 @@ #include "Common.h" #include "FileUtil.h" +#include "StringUtil.h" #ifdef _WIN32 #include diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index d5f7f3d725..2933a324c6 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -102,15 +102,14 @@ enum LOG_LEVELS { #define INFO_LOG(...) {} #define DEBUG_LOG(...) {} -// FIXME can we get rid of this? -#include "LogManager.h" +void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *fmt, ...); #ifdef GEKKO #define GENERIC_LOG(t, v, ...) #else // Let the compiler optimize this out -#define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {LogManager::GetInstance()->Log(v, t, __VA_ARGS__);}} +#define GENERIC_LOG(t, v, ...) {if (v <= MAX_LOGLEVEL) {GenericLog(v, t, __VA_ARGS__);}} #endif #if MAX_LOGLEVEL >= ERROR_LEVEL diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp index 0159ddc174..b9dad4be6d 100644 --- a/Source/Core/Common/Src/LogManager.cpp +++ b/Source/Core/Common/Src/LogManager.cpp @@ -18,6 +18,14 @@ #include "LogManager.h" #include "Timer.h" +void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + LogManager::GetInstance()->Log(level, type, fmt, args); + va_end(args); +} + LogManager *LogManager::m_logManager = NULL; LogManager::LogManager()\ @@ -85,8 +93,7 @@ LogManager::~LogManager() { } void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, - const char *format, ...) { - va_list args; + const char *format, va_list args) { char temp[MAX_MSGLEN]; char msg[MAX_MSGLEN + 512]; @@ -94,10 +101,8 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, if (! log->isEnable() || level > log->getLevel()) return; - - va_start(args, format); + CharArrayFromFormatV(temp, MAX_MSGLEN, format, args); - va_end(args); static const char level_to_char[7] = "-NEWID"; sprintf(msg, "%s %c[%s]: %s\n", diff --git a/Source/Core/Common/Src/LogManager.h b/Source/Core/Common/Src/LogManager.h index 3669858d39..d675ea888f 100644 --- a/Source/Core/Common/Src/LogManager.h +++ b/Source/Core/Common/Src/LogManager.h @@ -137,7 +137,7 @@ public: static u32 GetMaxLevel() { return MAX_LOGLEVEL; } void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, - const char *fmt, ...); + const char *fmt, va_list args); void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) { m_Log[type]->setLevel(level); diff --git a/Source/Core/Common/Src/MathUtil.h b/Source/Core/Common/Src/MathUtil.h index 3b9967f05f..04d5034ff7 100644 --- a/Source/Core/Common/Src/MathUtil.h +++ b/Source/Core/Common/Src/MathUtil.h @@ -18,10 +18,11 @@ #ifndef _MATH_UTIL_H_ #define _MATH_UTIL_H_ -#include - #include "Common.h" +#include +#include + namespace MathUtil { diff --git a/Source/Core/Common/Src/SymbolDB.h b/Source/Core/Common/Src/SymbolDB.h index 41d22a0b44..6b0a5b42e3 100644 --- a/Source/Core/Common/Src/SymbolDB.h +++ b/Source/Core/Common/Src/SymbolDB.h @@ -24,6 +24,7 @@ #include #include +#include #include "Common.h" diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp index 8b355ff0d4..ae0086abd7 100644 --- a/Source/Core/Common/Src/Timer.cpp +++ b/Source/Core/Common/Src/Timer.cpp @@ -15,11 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#ifdef _WIN32 -#include -#include -#endif - #include #include diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h index 292829f122..abe2e6a228 100644 --- a/Source/Core/Common/Src/Timer.h +++ b/Source/Core/Common/Src/Timer.h @@ -21,6 +21,7 @@ #include "Common.h" #include #ifdef _WIN32 +#include #include #endif namespace Common diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h index 1e450b5fea..528c457287 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h @@ -18,6 +18,8 @@ #ifndef _EXI_DEVICEMEMORYCARD_H #define _EXI_DEVICEMEMORYCARD_H +#include "Thread.h" + // Data structure to be passed to the flushing thread. typedef struct { diff --git a/Source/Core/Core/Src/HW/PixelEngine.cpp b/Source/Core/Core/Src/HW/PixelEngine.cpp index dfd12ce8a3..8e7d437ebb 100644 --- a/Source/Core/Core/Src/HW/PixelEngine.cpp +++ b/Source/Core/Core/Src/HW/PixelEngine.cpp @@ -22,6 +22,7 @@ #include "Common.h" #include "ChunkFile.h" +#include "Thread.h" #include "PixelEngine.h" diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index b8cdde2755..04a12d255a 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -20,6 +20,7 @@ #include "State.h" #include "Core.h" #include "StringUtil.h" +#include "Thread.h" #include "CoreTiming.h" #include "HW/HW.h" #include "PowerPC/PowerPC.h" diff --git a/Source/Core/Core/Src/State.h b/Source/Core/Core/Src/State.h index 34b4714987..e1de508821 100644 --- a/Source/Core/Core/Src/State.h +++ b/Source/Core/Core/Src/State.h @@ -20,6 +20,8 @@ #ifndef _STATE_H_ #define _STATE_H_ +#include + typedef struct { u8 *buffer; diff --git a/Source/Core/DSPCore/Src/disassemble.cpp b/Source/Core/DSPCore/Src/disassemble.cpp index c58465e9fe..d81ac8d273 100644 --- a/Source/Core/DSPCore/Src/disassemble.cpp +++ b/Source/Core/DSPCore/Src/disassemble.cpp @@ -26,6 +26,7 @@ #include #include +#include "Common.h" #include "FileUtil.h" #include "disassemble.h" #include "DSPTables.h" @@ -34,6 +35,10 @@ #pragma warning(disable:4996) #endif +#ifndef MAX_PATH +#include // For MAX_PATH +#endif + extern void nop(const UDSPInstruction& opc); DSPDisassembler::DSPDisassembler(const AssemblerSettings &settings) diff --git a/Source/Core/InputCommon/Src/Configuration.cpp b/Source/Core/InputCommon/Src/Configuration.cpp index 35260fd40c..76882e3e1e 100644 --- a/Source/Core/InputCommon/Src/Configuration.cpp +++ b/Source/Core/InputCommon/Src/Configuration.cpp @@ -37,6 +37,11 @@ #include #endif +#ifdef _WIN32 +#define NOMINMAX +#include +#endif + #include "SDL.h" // Local //////////////////////////////////// diff --git a/Source/Core/VideoCommon/Src/HiresTextures.cpp b/Source/Core/VideoCommon/Src/HiresTextures.cpp index 58861fe93b..5b3801b2e9 100644 --- a/Source/Core/VideoCommon/Src/HiresTextures.cpp +++ b/Source/Core/VideoCommon/Src/HiresTextures.cpp @@ -24,6 +24,7 @@ #include "CommonPaths.h" #include "FileUtil.h" #include "FileSearch.h" +#include "StringUtil.h" namespace HiresTextures { diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 2a5bb7c74d..d98573f922 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -34,6 +34,7 @@ DSPDebuggerHLE* m_DebuggerFrame = NULL; #include "Setup.h" #include "StringUtil.h" #include "AudioCommon.h" +#include "LogManager.h" // Declarations and definitions diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index 6356e7e506..1ab2bd60ed 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -18,7 +18,9 @@ #include "Common.h" // Common #include "CommonTypes.h" -#include "Mixer.h" +#include "LogManager.h" +#include "Thread.h" +#include "ChunkFile.h" #include "Globals.h" // Local #include "DSPInterpreter.h" @@ -28,11 +30,9 @@ #include "Config.h" #include "AudioCommon.h" +#include "Mixer.h" #include "Logging/Logging.h" // For Logging -#include "Thread.h" -#include "ChunkFile.h" - #include "DSPTables.h" #include "DSPCore.h" diff --git a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp index a2ab1e1fc0..6740f364ef 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp @@ -22,6 +22,7 @@ #include #include "Common.h" +#include "LogManager.h" #include "pluginspecs_pad.h" #include "PadSimple.h" #include "IniFile.h" diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 95687350ad..ebb111de1f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -20,6 +20,8 @@ #include #include "Common.h" +#include "Thread.h" +#include "LogManager.h" #include "svnrev.h" #include "resource.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index ceede1917a..4692cf0928 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -20,6 +20,8 @@ #include "Common.h" +#include + // Log in two categories, and save three other options in the same byte #define CONF_LOG 1 #define CONF_PRIMLOG 2 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 4cd91d33c1..c4261ffb56 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -17,6 +17,7 @@ #include "Globals.h" +#include "Thread.h" #include #include diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 3a6e1ed67e..d8b6d14010 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -52,6 +52,8 @@ Make AA apply instantly during gameplay if possible #include "Globals.h" +#include "LogManager.h" +#include "Thread.h" #include diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index a18bbc6c2f..88e617f4cb 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -33,6 +33,7 @@ and Wiimote functions worked. */ #include "Common.h" // Common +#include "LogManager.h" #include "StringUtil.h" #include "Timer.h" diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 36d57fcce1..130cb2c47e 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -69,6 +69,7 @@ // Include // ŻŻŻŻŻŻŻŻŻ #include "nJoy.h" +#include "LogManager.h" // Declare config window so that we can write debugging info to it from functions in this file #if defined(HAVE_WX) && HAVE_WX diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp index e68ae37ee9..001657df7e 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp @@ -30,6 +30,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// #include "nJoy.h" +#include "LogManager.h" ////////////////////////////////////////////////////////////////////////////////////////// // Variables