diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index de5a4fdde8..427aab557a 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -2,14 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "AudioCommon/Mixer.h" + #include -#include "AudioCommon/AudioCommon.h" -#include "AudioCommon/Mixer.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" #if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__) diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp index c7013f10ae..2707e33d81 100644 --- a/Source/Core/AudioCommon/WaveFile.cpp +++ b/Source/Core/AudioCommon/WaveFile.cpp @@ -2,15 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "AudioCommon/WaveFile.h" + #include -#include "AudioCommon/WaveFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" -#include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" - +#include "Common/Swap.h" #include "Core/ConfigManager.h" constexpr size_t WaveFileWriter::BUFFER_SIZE; diff --git a/Source/Core/Common/ColorUtil.cpp b/Source/Core/Common/ColorUtil.cpp index b859f843f8..bce7276aa1 100644 --- a/Source/Core/Common/ColorUtil.cpp +++ b/Source/Core/Common/ColorUtil.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include "Common/ColorUtil.h" -#include "Common/CommonFuncs.h" +#include "Common/Swap.h" namespace ColorUtil { diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 9f2b64f56d..a30d70b4c9 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -134,6 +134,7 @@ + diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters index 92d5fb2ae1..e68660d752 100644 --- a/Source/Core/Common/Common.vcxproj.filters +++ b/Source/Core/Common/Common.vcxproj.filters @@ -63,6 +63,7 @@ + diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h index 4dc359ee3c..fe0a6f5a1a 100644 --- a/Source/Core/Common/CommonFuncs.h +++ b/Source/Core/Common/CommonFuncs.h @@ -4,12 +4,7 @@ #pragma once -#ifdef __APPLE__ -#include -#endif - #include -#include #include #include "Common/CommonTypes.h" @@ -29,13 +24,6 @@ constexpr size_t ArraySize(T (&arr)[N]) #ifndef _WIN32 -#include -#ifdef __linux__ -#include -#elif defined __FreeBSD__ -#include -#endif - // go to debugger mode #define Crash() \ { \ @@ -103,153 +91,3 @@ __declspec(dllimport) void __stdcall DebugBreak(void); // This function might change the error code. // Defined in Misc.cpp. std::string GetLastErrorMsg(); - -namespace Common -{ -inline u8 swap8(u8 _data) -{ - return _data; -} -inline u32 swap24(const u8* _data) -{ - return (_data[0] << 16) | (_data[1] << 8) | _data[2]; -} - -#if defined(ANDROID) || defined(__OpenBSD__) -#undef swap16 -#undef swap32 -#undef swap64 -#endif - -#ifdef _WIN32 -inline u16 swap16(u16 _data) -{ - return _byteswap_ushort(_data); -} -inline u32 swap32(u32 _data) -{ - return _byteswap_ulong(_data); -} -inline u64 swap64(u64 _data) -{ - return _byteswap_uint64(_data); -} -#elif __linux__ -inline u16 swap16(u16 _data) -{ - return bswap_16(_data); -} -inline u32 swap32(u32 _data) -{ - return bswap_32(_data); -} -inline u64 swap64(u64 _data) -{ - return bswap_64(_data); -} -#elif __APPLE__ -inline __attribute__((always_inline)) u16 swap16(u16 _data) -{ - return OSSwapInt16(_data); -} -inline __attribute__((always_inline)) u32 swap32(u32 _data) -{ - return OSSwapInt32(_data); -} -inline __attribute__((always_inline)) u64 swap64(u64 _data) -{ - return OSSwapInt64(_data); -} -#elif __FreeBSD__ -inline u16 swap16(u16 _data) -{ - return bswap16(_data); -} -inline u32 swap32(u32 _data) -{ - return bswap32(_data); -} -inline u64 swap64(u64 _data) -{ - return bswap64(_data); -} -#else -// Slow generic implementation. -inline u16 swap16(u16 data) -{ - return (data >> 8) | (data << 8); -} -inline u32 swap32(u32 data) -{ - return (swap16(data) << 16) | swap16(data >> 16); -} -inline u64 swap64(u64 data) -{ - return ((u64)swap32(data) << 32) | swap32(data >> 32); -} -#endif - -inline u16 swap16(const u8* data) -{ - u16 value; - std::memcpy(&value, data, sizeof(u16)); - - return swap16(value); -} -inline u32 swap32(const u8* data) -{ - u32 value; - std::memcpy(&value, data, sizeof(u32)); - - return swap32(value); -} -inline u64 swap64(const u8* data) -{ - u64 value; - std::memcpy(&value, data, sizeof(u64)); - - return swap64(value); -} - -template -void swap(u8*); - -template <> -inline void swap<1>(u8* data) -{ -} - -template <> -inline void swap<2>(u8* data) -{ - const u16 value = swap16(data); - - std::memcpy(data, &value, sizeof(u16)); -} - -template <> -inline void swap<4>(u8* data) -{ - const u32 value = swap32(data); - - std::memcpy(data, &value, sizeof(u32)); -} - -template <> -inline void swap<8>(u8* data) -{ - const u64 value = swap64(data); - - std::memcpy(data, &value, sizeof(u64)); -} - -template -inline T FromBigEndian(T data) -{ - static_assert(std::is_arithmetic::value, "function only makes sense with arithmetic types"); - - swap(reinterpret_cast(&data)); - return data; -} - -} // Namespace Common diff --git a/Source/Core/Common/NandPaths.cpp b/Source/Core/Common/NandPaths.cpp index 99c75f01f8..3984d2d620 100644 --- a/Source/Core/Common/NandPaths.cpp +++ b/Source/Core/Common/NandPaths.cpp @@ -3,20 +3,17 @@ // Refer to the license.txt file included. #include -#include -#include -#include #include #include #include +#include -#include "Common/CommonFuncs.h" -#include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/NandPaths.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" namespace Common { diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp index 54efd77f70..9d0bd84eb3 100644 --- a/Source/Core/Common/SettingsHandler.cpp +++ b/Source/Core/Common/SettingsHandler.cpp @@ -14,7 +14,6 @@ #include #include #include -#include "Common/CommonFuncs.h" // snprintf #endif #include "Common/CommonTypes.h" diff --git a/Source/Core/Common/Swap.h b/Source/Core/Common/Swap.h new file mode 100644 index 0000000000..6274ce19cc --- /dev/null +++ b/Source/Core/Common/Swap.h @@ -0,0 +1,167 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#ifdef __APPLE__ +#include +#elif defined(__linux__) +#include +#elif defined(__FreeBSD__) +#include +#endif + +#include "Common/CommonTypes.h" + +namespace Common +{ +inline u8 swap8(u8 data) +{ + return data; +} +inline u32 swap24(const u8* data) +{ + return (data[0] << 16) | (data[1] << 8) | data[2]; +} + +#if defined(ANDROID) || defined(__OpenBSD__) +#undef swap16 +#undef swap32 +#undef swap64 +#endif + +#ifdef _WIN32 +inline u16 swap16(u16 data) +{ + return _byteswap_ushort(data); +} +inline u32 swap32(u32 data) +{ + return _byteswap_ulong(data); +} +inline u64 swap64(u64 data) +{ + return _byteswap_uint64(data); +} +#elif __linux__ +inline u16 swap16(u16 data) +{ + return bswap_16(data); +} +inline u32 swap32(u32 data) +{ + return bswap_32(data); +} +inline u64 swap64(u64 data) +{ + return bswap_64(data); +} +#elif __APPLE__ +inline __attribute__((always_inline)) u16 swap16(u16 data) +{ + return OSSwapInt16(data); +} +inline __attribute__((always_inline)) u32 swap32(u32 data) +{ + return OSSwapInt32(data); +} +inline __attribute__((always_inline)) u64 swap64(u64 data) +{ + return OSSwapInt64(data); +} +#elif __FreeBSD__ +inline u16 swap16(u16 data) +{ + return bswap16(data); +} +inline u32 swap32(u32 data) +{ + return bswap32(data); +} +inline u64 swap64(u64 data) +{ + return bswap64(data); +} +#else +// Slow generic implementation. +inline u16 swap16(u16 data) +{ + return (data >> 8) | (data << 8); +} +inline u32 swap32(u32 data) +{ + return (swap16(data) << 16) | swap16(data >> 16); +} +inline u64 swap64(u64 data) +{ + return ((u64)swap32(data) << 32) | swap32(data >> 32); +} +#endif + +inline u16 swap16(const u8* data) +{ + u16 value; + std::memcpy(&value, data, sizeof(u16)); + + return swap16(value); +} +inline u32 swap32(const u8* data) +{ + u32 value; + std::memcpy(&value, data, sizeof(u32)); + + return swap32(value); +} +inline u64 swap64(const u8* data) +{ + u64 value; + std::memcpy(&value, data, sizeof(u64)); + + return swap64(value); +} + +template +void swap(u8*); + +template <> +inline void swap<1>(u8* data) +{ +} + +template <> +inline void swap<2>(u8* data) +{ + const u16 value = swap16(data); + + std::memcpy(data, &value, sizeof(u16)); +} + +template <> +inline void swap<4>(u8* data) +{ + const u32 value = swap32(data); + + std::memcpy(data, &value, sizeof(u32)); +} + +template <> +inline void swap<8>(u8* data) +{ + const u64 value = swap64(data); + + std::memcpy(data, &value, sizeof(u64)); +} + +template +inline T FromBigEndian(T data) +{ + static_assert(std::is_arithmetic::value, "function only makes sense with arithmetic types"); + + swap(reinterpret_cast(&data)); + return data; +} +} // Namespace Common diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp index 5633628948..6b2b1eb6c1 100644 --- a/Source/Core/Common/SysConf.cpp +++ b/Source/Core/Common/SysConf.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Common/SysConf.h" + #include #include #include @@ -9,13 +11,10 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" -#include "Common/Logging/Log.h" -#include "Common/SysConf.h" - +#include "Common/Swap.h" #include "Core/Movie.h" SysConf::SysConf(const Common::FromWhichRoot root_type) diff --git a/Source/Core/Core/ARDecrypt.cpp b/Source/Core/Core/ARDecrypt.cpp index cb6b393423..831caaabc6 100644 --- a/Source/Core/Core/ARDecrypt.cpp +++ b/Source/Core/Core/ARDecrypt.cpp @@ -6,6 +6,8 @@ // GCNcrypt - GameCube AR Crypto Program // Copyright (C) 2003-2004 Parasyte +#include "Core/ARDecrypt.h" + #include #include @@ -16,7 +18,7 @@ #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/MsgHandler.h" -#include "Core/ARDecrypt.h" +#include "Common/Swap.h" namespace ActionReplay { diff --git a/Source/Core/Core/ARDecrypt.h b/Source/Core/Core/ARDecrypt.h index 399b5d0dc0..4179bae95c 100644 --- a/Source/Core/Core/ARDecrypt.h +++ b/Source/Core/Core/ARDecrypt.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "Common/CommonTypes.h" diff --git a/Source/Core/Core/Boot/Boot_DOL.cpp b/Source/Core/Core/Boot/Boot_DOL.cpp index cd2660e645..b86169744d 100644 --- a/Source/Core/Core/Boot/Boot_DOL.cpp +++ b/Source/Core/Core/Boot/Boot_DOL.cpp @@ -2,14 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/Boot/Boot_DOL.h" + #include #include #include -#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" - -#include "Core/Boot/Boot_DOL.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" CDolLoader::CDolLoader(const std::vector& buffer) diff --git a/Source/Core/Core/Boot/Boot_ELF.cpp b/Source/Core/Core/Boot/Boot_ELF.cpp index c626725698..4dc9cd18d5 100644 --- a/Source/Core/Core/Boot/Boot_ELF.cpp +++ b/Source/Core/Core/Boot/Boot_ELF.cpp @@ -4,8 +4,8 @@ #include -#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" +#include "Common/Swap.h" #include "Core/Boot/Boot.h" #include "Core/Boot/ElfReader.h" #include "Core/HLE/HLE.h" diff --git a/Source/Core/Core/Boot/ElfReader.cpp b/Source/Core/Core/Boot/ElfReader.cpp index 770f27e548..91eeba7487 100644 --- a/Source/Core/Core/Boot/ElfReader.cpp +++ b/Source/Core/Core/Boot/ElfReader.cpp @@ -6,10 +6,10 @@ #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/PPCSymbolDB.h" diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 6299164cc2..7162b2b600 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -9,11 +9,9 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Event.h" #include "Common/Hash.h" -#include "Common/Logging/Log.h" #include "Common/MemoryUtil.h" #include "Common/MsgHandler.h" diff --git a/Source/Core/Core/DSP/DSPHWInterface.cpp b/Source/Core/Core/DSP/DSPHWInterface.cpp index 7620f3bee9..07ea38a16d 100644 --- a/Source/Core/Core/DSP/DSPHWInterface.cpp +++ b/Source/Core/Core/DSP/DSPHWInterface.cpp @@ -6,10 +6,11 @@ #include "Core/DSP/DSPHWInterface.h" #include "Common/CPUDetect.h" -#include "Common/CommonFuncs.h" +#include "Common/CommonTypes.h" #include "Common/Intrinsics.h" #include "Common/Logging/Log.h" #include "Common/MemoryUtil.h" +#include "Common/Swap.h" #include "Core/DSP/DSPAccelerator.h" #include "Core/DSP/DSPCore.h" diff --git a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp index 77c48bb0a7..4773d7ab38 100644 --- a/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoAnalyzer.cpp @@ -2,14 +2,16 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/FifoPlayer/FifoAnalyzer.h" + #include #include -#include "Core/FifoPlayer/FifoAnalyzer.h" - #include "Common/Assert.h" -#include "Core/Core.h" +#include "Common/Swap.h" + #include "Core/FifoPlayer/FifoRecordAnalyzer.h" + #include "VideoCommon/OpcodeDecoding.h" #include "VideoCommon/VertexLoader.h" #include "VideoCommon/VertexLoader_Normal.h" diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp index 6f422ef79c..7d8e4522f2 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp @@ -5,11 +5,11 @@ #include "Core/HW/DSPHLE/UCodes/AX.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" +#include "Common/Swap.h" #include "Core/HW/DSP.h" #include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/MailHandler.h" diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp index 469844d225..22e2268168 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXWii.cpp @@ -7,11 +7,10 @@ #include "Core/HW/DSPHLE/UCodes/AXWii.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" -#include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/MailHandler.h" #include "Core/HW/DSPHLE/UCodes/AXStructs.h" diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp index 586930c395..230d8900ff 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/GBA.cpp @@ -5,7 +5,6 @@ #include "Core/HW/DSPHLE/UCodes/GBA.h" #include "Common/Align.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Core/HW/DSP.h" diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp index 86c578e999..11f7d73b48 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp @@ -12,12 +12,12 @@ #endif #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Hash.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" #include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/UCodes/AX.h" diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index 7f848cb63f..2d7ab824f7 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -7,9 +7,9 @@ #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" #include "Core/HW/DSP.h" #include "Core/HW/DSPHLE/DSPHLE.h" #include "Core/HW/DSPHLE/MailHandler.h" diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceGecko.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceGecko.cpp index 5b28d9abd0..777b96a79e 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceGecko.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceGecko.cpp @@ -11,7 +11,6 @@ #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp index 69511aa946..b7baf230fc 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp @@ -14,6 +14,7 @@ #include "Common/Logging/Log.h" #include "Common/MemoryUtil.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Common/Timer.h" #include "Core/ConfigManager.h" diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp index 5b04adac4c..c0af034eac 100644 --- a/Source/Core/Core/HW/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard.cpp @@ -2,18 +2,21 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/HW/GCMemcard.h" + #include #include #include #include #include "Common/ColorUtil.h" +#include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" -#include "Core/HW/GCMemcard.h" +#include "Common/Swap.h" static void ByteSwap(u8* valueA, u8* valueB) { diff --git a/Source/Core/Core/HW/GCMemcard.h b/Source/Core/Core/HW/GCMemcard.h index 8887dffd09..0b501e206f 100644 --- a/Source/Core/Core/HW/GCMemcard.h +++ b/Source/Core/Core/HW/GCMemcard.h @@ -7,10 +7,10 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/NandPaths.h" #include "Common/NonCopyable.h" +#include "Common/Swap.h" #include "Common/Timer.h" #include "Core/HW/EXI/EXI_DeviceIPL.h" diff --git a/Source/Core/Core/HW/GPFifo.cpp b/Source/Core/Core/HW/GPFifo.cpp index d822dd0d88..febd1bd3c7 100644 --- a/Source/Core/Core/HW/GPFifo.cpp +++ b/Source/Core/Core/HW/GPFifo.cpp @@ -2,12 +2,13 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/HW/GPFifo.h" + #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" -#include "Core/HW/GPFifo.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/HW/ProcessorInterface.h" #include "Core/PowerPC/JitInterface.h" diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index 6260483881..8fa5e4f337 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -11,10 +11,10 @@ #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MemArena.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" #include "Core/HW/AudioInterface.h" #include "Core/HW/DSP.h" diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h index 1e628fe215..10baa444ab 100644 --- a/Source/Core/Core/HW/Memmap.h +++ b/Source/Core/Core/HW/Memmap.h @@ -9,6 +9,7 @@ #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" #include "Core/PowerPC/PowerPC.h" // Global declarations diff --git a/Source/Core/Core/HW/Sram.cpp b/Source/Core/Core/HW/Sram.cpp index 158a927747..79b92209d5 100644 --- a/Source/Core/Core/HW/Sram.cpp +++ b/Source/Core/Core/HW/Sram.cpp @@ -3,9 +3,11 @@ // Refer to the license.txt file included. #include "Core/HW/Sram.h" + #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" // english diff --git a/Source/Core/Core/HW/WiiSaveCrypted.cpp b/Source/Core/Core/HW/WiiSaveCrypted.cpp index 442e4b3db1..d646fae570 100644 --- a/Source/Core/Core/HW/WiiSaveCrypted.cpp +++ b/Source/Core/Core/HW/WiiSaveCrypted.cpp @@ -7,6 +7,8 @@ // Licensed under the terms of the GNU GPL, version 2 // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt +#include "Core/HW/WiiSaveCrypted.h" + #include #include #include @@ -19,7 +21,6 @@ #include #include "Common/Align.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Crypto/ec.h" #include "Common/FileUtil.h" @@ -27,8 +28,7 @@ #include "Common/MsgHandler.h" #include "Common/NandPaths.h" #include "Common/StringUtil.h" - -#include "Core/HW/WiiSaveCrypted.h" +#include "Common/Swap.h" const u8 CWiiSaveCrypted::s_sd_key[16] = {0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D}; diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp index af968ff143..7c11cec49e 100644 --- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp @@ -25,6 +25,7 @@ #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "Core/Core.h" #include "Core/HW/WiimoteEmu/Attachment/Attachment.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 5d8e81ab7e..e896b6f40d 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -2,17 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/HW/WiimoteReal/WiimoteReal.h" + #include #include #include #include -#include "Core/HW/WiimoteReal/WiimoteReal.h" - #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/IniFile.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" #include "Core/Core.h" diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index 9c2ae3a7ea..0a65a21318 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/ES/ES.h" + #include #include #include @@ -15,23 +17,18 @@ #include "Common/Align.h" #include "Common/Assert.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/NandPaths.h" +#include "Common/Swap.h" #include "Core/Boot/Boot.h" -#include "Core/Boot/Boot_DOL.h" #include "Core/ConfigManager.h" #include "Core/HLE/HLE.h" -#include "Core/HW/DVDInterface.h" #include "Core/HW/Memmap.h" -#include "Core/IOS/ES/ES.h" #include "Core/IOS/ES/Formats.h" #include "Core/PatchEngine.h" #include "Core/PowerPC/PPCSymbolDB.h" -#include "Core/PowerPC/PowerPC.h" -#include "Core/WiiRoot.h" #include "Core/ec_wii.h" #include "DiscIO/NANDContentLoader.h" #include "DiscIO/Volume.h" diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index 96a81004e5..602811a83c 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -11,9 +11,9 @@ #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Crypto/AES.h" +#include "Common/Swap.h" namespace IOS { diff --git a/Source/Core/Core/IOS/MIOS.cpp b/Source/Core/Core/IOS/MIOS.cpp index 2a9e55402f..d20cf9f594 100644 --- a/Source/Core/Core/IOS/MIOS.cpp +++ b/Source/Core/Core/IOS/MIOS.cpp @@ -6,12 +6,12 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/NandPaths.h" +#include "Common/Swap.h" #include "Core/Boot/Boot.h" #include "Core/Boot/ElfReader.h" #include "Core/ConfigManager.h" diff --git a/Source/Core/Core/IOS/Network/KD/NWC24Config.cpp b/Source/Core/Core/IOS/Network/KD/NWC24Config.cpp index 4492f22443..543b490429 100644 --- a/Source/Core/Core/IOS/Network/KD/NWC24Config.cpp +++ b/Source/Core/Core/IOS/Network/KD/NWC24Config.cpp @@ -6,11 +6,11 @@ #include -#include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" namespace IOS { diff --git a/Source/Core/Core/IOS/Network/WD/Command.cpp b/Source/Core/Core/IOS/Network/WD/Command.cpp index 236355e32a..3cbbcf9296 100644 --- a/Source/Core/Core/IOS/Network/WD/Command.cpp +++ b/Source/Core/Core/IOS/Network/WD/Command.cpp @@ -7,10 +7,10 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/Network.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/IOS/Network/MACUtils.h" diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp index 1048ad4ed4..c4131f38a8 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp @@ -2,19 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/Bluetooth/BTBase.h" + #include #include #include -#include "Common/Assert.h" -#include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/SysConf.h" -#include "Core/HW/Memmap.h" -#include "Core/IOS/USB/Bluetooth/BTBase.h" namespace IOS { diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 72d536fd3a..e76becfc96 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -15,12 +15,12 @@ #include "Common/Assert.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/LibusbContext.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/Network.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" #include "Core/Core.h" diff --git a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h index 3937a0c777..8253566b71 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h +++ b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h @@ -8,8 +8,8 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" #include "Core/IOS/USB/Bluetooth/hci.h" class PointerWrap; diff --git a/Source/Core/Core/IOS/USB/Common.cpp b/Source/Core/Core/IOS/USB/Common.cpp index 0c1a7317a7..b8fecd5faf 100644 --- a/Source/Core/Core/IOS/USB/Common.cpp +++ b/Source/Core/Core/IOS/USB/Common.cpp @@ -2,15 +2,16 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/Common.h" + #include #include "Common/Align.h" #include "Common/Assert.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" -#include "Core/IOS/USB/Common.h" namespace IOS { diff --git a/Source/Core/Core/IOS/USB/OH0/OH0.cpp b/Source/Core/Core/IOS/USB/OH0/OH0.cpp index 4a19e5cc21..3a9ec8d97e 100644 --- a/Source/Core/Core/IOS/USB/OH0/OH0.cpp +++ b/Source/Core/Core/IOS/USB/OH0/OH0.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/OH0/OH0.h" + #include #include #include @@ -9,15 +11,12 @@ #include #include -#include "Common/Assert.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/Logging/Log.h" #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/HW/Memmap.h" #include "Core/IOS/USB/Common.h" -#include "Core/IOS/USB/OH0/OH0.h" #include "Core/IOS/USB/USBV0.h" namespace IOS diff --git a/Source/Core/Core/IOS/USB/USBV0.cpp b/Source/Core/Core/IOS/USB/USBV0.cpp index fb844f0f09..3f9e276e4f 100644 --- a/Source/Core/Core/IOS/USB/USBV0.cpp +++ b/Source/Core/Core/IOS/USB/USBV0.cpp @@ -2,13 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/USBV0.h" + #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/IOS/Device.h" -#include "Core/IOS/USB/USBV0.h" namespace IOS { diff --git a/Source/Core/Core/IOS/USB/USBV4.cpp b/Source/Core/Core/IOS/USB/USBV4.cpp index fae4e2011a..b28142f1e1 100644 --- a/Source/Core/Core/IOS/USB/USBV4.cpp +++ b/Source/Core/Core/IOS/USB/USBV4.cpp @@ -2,15 +2,16 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/USBV4.h" + #include #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/IOS/Device.h" -#include "Core/IOS/USB/USBV4.h" namespace IOS { diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index 4734490f1c..e7c87a1c26 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -2,19 +2,20 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/USB_HID/HIDv4.h" + #include #include #include "Common/Align.h" #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" #include "Core/CoreTiming.h" #include "Core/HW/Memmap.h" #include "Core/IOS/Device.h" #include "Core/IOS/USB/Common.h" #include "Core/IOS/USB/USBV4.h" -#include "Core/IOS/USB/USB_HID/HIDv4.h" namespace IOS { diff --git a/Source/Core/Core/IOS/USB/USB_KBD.cpp b/Source/Core/Core/IOS/USB/USB_KBD.cpp index 5baa6717e4..9fe4443f34 100644 --- a/Source/Core/Core/IOS/USB/USB_KBD.cpp +++ b/Source/Core/Core/IOS/USB/USB_KBD.cpp @@ -2,16 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/USB_KBD.h" + #include -#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" #include "Core/Core.h" // Local core functions #include "Core/HW/Memmap.h" -#include "Core/IOS/USB/USB_KBD.h" #ifdef _WIN32 #include diff --git a/Source/Core/Core/IOS/USB/USB_VEN/VEN.cpp b/Source/Core/Core/IOS/USB/USB_VEN/VEN.cpp index a8171fcedb..303915f92a 100644 --- a/Source/Core/Core/IOS/USB/USB_VEN/VEN.cpp +++ b/Source/Core/Core/IOS/USB/USB_VEN/VEN.cpp @@ -2,17 +2,19 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "Core/IOS/USB/USB_VEN/VEN.h" + #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" + #include "Core/CoreTiming.h" #include "Core/HW/Memmap.h" #include "Core/IOS/Device.h" #include "Core/IOS/USB/Common.h" #include "Core/IOS/USB/USBV5.h" -#include "Core/IOS/USB/USB_VEN/VEN.h" namespace IOS { diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index 7fea082b63..b73e6cbffa 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -21,7 +21,6 @@ #include #include "Common/Assert.h" -#include "Common/CommonPaths.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Common/StringUtil.h" @@ -33,8 +32,6 @@ #include "Core/PatchEngine.h" #include "Core/PowerPC/PowerPC.h" -using namespace Common; - namespace PatchEngine { const char* PatchTypeStrings[] = { diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index bb5e0e3a41..f49ced547e 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "Core/PowerPC/Interpreter/Interpreter.h" + #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 39b1a0db36..5313d2eda2 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -6,6 +6,7 @@ #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "Core/ConfigManager.h" #include "Core/PowerPC/Interpreter/Interpreter.h" diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp index 3aebf23e58..334fe8f7e1 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp @@ -9,12 +9,12 @@ #include #include "Common/Assert.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/GekkoDisassembler.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Common/x64Reg.h" #include "Core/HW/Memmap.h" #include "Core/MachineContext.h" diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp index 209d3cffe4..2606df9682 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp @@ -9,6 +9,7 @@ #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/JitArm64/Jit.h" diff --git a/Source/Core/Core/PowerPC/PPCCache.cpp b/Source/Core/Core/PowerPC/PPCCache.cpp index 6b539e50e6..1b8e41b5b1 100644 --- a/Source/Core/Core/PowerPC/PPCCache.cpp +++ b/Source/Core/Core/PowerPC/PPCCache.cpp @@ -7,7 +7,7 @@ #include #include "Common/ChunkFile.h" -#include "Common/CommonFuncs.h" +#include "Common/Swap.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/PowerPC.h" diff --git a/Source/Core/Core/ec_wii.cpp b/Source/Core/Core/ec_wii.cpp index 89a68ee396..fc3b031e49 100644 --- a/Source/Core/Core/ec_wii.cpp +++ b/Source/Core/Core/ec_wii.cpp @@ -10,14 +10,15 @@ #include "Core/ec_wii.h" #include -#include +#include #include -#include "Common/CommonFuncs.h" +#include "Common/CommonTypes.h" #include "Common/Crypto/ec.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" constexpr u32 default_NG_id = 0x0403AC68; constexpr u32 default_NG_key_id = 0x6AAB8C59; diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h index 7f954cd65b..cf04789b01 100644 --- a/Source/Core/DiscIO/Blob.h +++ b/Source/Core/DiscIO/Blob.h @@ -17,8 +17,9 @@ #include #include #include -#include "Common/CommonFuncs.h" + #include "Common/CommonTypes.h" +#include "Common/Swap.h" namespace DiscIO { diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index c08e5bbef8..559fd86eb2 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DiscIO/NANDContentLoader.h" + #include #include #include @@ -15,7 +17,6 @@ #include #include "Common/Align.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Crypto/AES.h" #include "Common/FileUtil.h" @@ -23,9 +24,8 @@ #include "Common/MsgHandler.h" #include "Common/NandPaths.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" -#include "DiscIO/Enums.h" -#include "DiscIO/NANDContentLoader.h" #include "DiscIO/WiiWad.h" namespace DiscIO diff --git a/Source/Core/DiscIO/TGCBlob.cpp b/Source/Core/DiscIO/TGCBlob.cpp index 886bbb6a78..a3db368133 100644 --- a/Source/Core/DiscIO/TGCBlob.cpp +++ b/Source/Core/DiscIO/TGCBlob.cpp @@ -2,13 +2,14 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DiscIO/TGCBlob.h" + #include #include #include -#include "Common/CommonFuncs.h" #include "Common/FileUtil.h" -#include "DiscIO/TGCBlob.h" +#include "Common/Swap.h" namespace { diff --git a/Source/Core/DiscIO/Volume.cpp b/Source/Core/DiscIO/Volume.cpp index 0209bc0f57..640b709ffe 100644 --- a/Source/Core/DiscIO/Volume.cpp +++ b/Source/Core/DiscIO/Volume.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DiscIO/Volume.h" + #include #include #include @@ -9,12 +11,12 @@ #include #include "Common/ColorUtil.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" + #include "DiscIO/Enums.h" -#include "DiscIO/Volume.h" namespace DiscIO { diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h index f3f530e5e4..cd48249ccb 100644 --- a/Source/Core/DiscIO/Volume.h +++ b/Source/Core/DiscIO/Volume.h @@ -9,9 +9,9 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Core/IOS/ES/Formats.h" #include "DiscIO/Enums.h" diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index 71e50252db..ad9cd917d5 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DiscIO/VolumeWiiCrypted.h" + #include #include #include @@ -12,18 +14,17 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" + #include "DiscIO/Blob.h" #include "DiscIO/Enums.h" #include "DiscIO/FileMonitor.h" #include "DiscIO/Filesystem.h" #include "DiscIO/Volume.h" #include "DiscIO/VolumeCreator.h" -#include "DiscIO/VolumeGC.h" -#include "DiscIO/VolumeWiiCrypted.h" namespace DiscIO { diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 0d249d72eb..7234978df0 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DiscIO/WbfsBlob.h" + #include #include #include @@ -12,12 +14,10 @@ #include "Common/Align.h" #include "Common/Assert.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" -#include "Common/Logging/Log.h" #include "Common/MsgHandler.h" -#include "DiscIO/WbfsBlob.h" +#include "Common/Swap.h" namespace DiscIO { diff --git a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp index 11a2f43dd5..6b106c248d 100644 --- a/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp +++ b/Source/Core/DolphinWX/Cheats/CheatSearchTab.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/Cheats/CheatSearchTab.h" + #include #include #include @@ -17,13 +19,13 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/StringUtil.h" -#include "Core/ActionReplay.h" +#include "Common/Swap.h" + #include "Core/Core.h" #include "Core/HW/Memmap.h" -#include "DolphinWX/Cheats/CheatSearchTab.h" + #include "DolphinWX/Cheats/CreateCodeDialog.h" #include "DolphinWX/WxUtils.h" diff --git a/Source/Core/DolphinWX/Cheats/CheatSearchTab.h b/Source/Core/DolphinWX/Cheats/CheatSearchTab.h index 6d53169d68..d62a86659c 100644 --- a/Source/Core/DolphinWX/Cheats/CheatSearchTab.h +++ b/Source/Core/DolphinWX/Cheats/CheatSearchTab.h @@ -8,6 +8,8 @@ #include #include +#include "Common/CommonTypes.h" + class wxButton; class wxChoice; class wxFocusEvent; diff --git a/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp b/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp index aaed813d4d..d2080743da 100644 --- a/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp @@ -17,14 +17,14 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonPaths.h" #include "Common/FileSearch.h" #include "Common/FileUtil.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" + #include "Core/ConfigManager.h" -#include "Core/HotkeyManager.h" + #include "DolphinWX/Frame.h" #include "DolphinWX/Input/InputConfigDiag.h" #include "DolphinWX/WxUtils.h" diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/FifoPlayerDlg.cpp index 83fa6fd8ae..18ced62d58 100644 --- a/Source/Core/DolphinWX/FifoPlayerDlg.cpp +++ b/Source/Core/DolphinWX/FifoPlayerDlg.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/FifoPlayerDlg.h" + #include #include #include @@ -27,11 +29,11 @@ #include "Common/Assert.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" #include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoPlaybackAnalyzer.h" #include "Core/FifoPlayer/FifoPlayer.h" #include "Core/FifoPlayer/FifoRecorder.h" -#include "DolphinWX/FifoPlayerDlg.h" #include "DolphinWX/WxUtils.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/OpcodeDecoding.h" diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp index 82cc74daa8..cbde39be6c 100644 --- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp +++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/OGL/SamplerCache.h" + #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/GL/GLInterfaceBase.h" -#include "VideoBackends/OGL/SamplerCache.h" #include "VideoCommon/SamplerCommon.h" #include "VideoCommon/VideoConfig.h" diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index 481c66cf71..ecd82f6dbd 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -6,17 +6,16 @@ #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "VideoBackends/Software/EfbInterface.h" #include "VideoBackends/Software/SWRenderer.h" #include "VideoBackends/Software/TextureSampler.h" #include "VideoCommon/BPMemory.h" -#include "VideoCommon/Fifo.h" #include "VideoCommon/ImageWrite.h" #include "VideoCommon/Statistics.h" #include "VideoCommon/VideoConfig.h" diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index 1392969223..31248455c5 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -8,9 +8,10 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" + #include "VideoCommon/BPMemory.h" #include "VideoCommon/LookUpTables.h" #include "VideoCommon/PerfQueryBase.h" diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp index ae6905f1c2..92dffe1b4b 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp +++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp @@ -2,13 +2,15 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoBackends/Software/TextureEncoder.h" + #include "Common/Align.h" #include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "VideoBackends/Software/EfbInterface.h" -#include "VideoBackends/Software/TextureEncoder.h" #include "VideoCommon/BPMemory.h" #include "VideoCommon/LookUpTables.h" diff --git a/Source/Core/VideoBackends/Software/TransformUnit.cpp b/Source/Core/VideoBackends/Software/TransformUnit.cpp index 0a2138f193..3babc89fc4 100644 --- a/Source/Core/VideoBackends/Software/TransformUnit.cpp +++ b/Source/Core/VideoBackends/Software/TransformUnit.cpp @@ -8,11 +8,11 @@ #include #include "Common/Assert.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "VideoBackends/Software/NativeVertexFormat.h" #include "VideoBackends/Software/Vec3.h" diff --git a/Source/Core/VideoCommon/DataReader.h b/Source/Core/VideoCommon/DataReader.h index 08c02d64ba..51430d508d 100644 --- a/Source/Core/VideoCommon/DataReader.h +++ b/Source/Core/VideoCommon/DataReader.h @@ -5,9 +5,10 @@ #pragma once #include + #include "Common/Common.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" class DataReader { diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index e9589f7218..e18931db9c 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/HiresTextures.h" + #include #include #include @@ -22,10 +24,10 @@ #include "Common/Logging/Log.h" #include "Common/MemoryUtil.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #include "Common/Thread.h" #include "Common/Timer.h" #include "Core/ConfigManager.h" -#include "VideoCommon/HiresTextures.h" #include "VideoCommon/OnScreenDisplay.h" #include "VideoCommon/VideoConfig.h" diff --git a/Source/Core/VideoCommon/TextureDecoder_Common.cpp b/Source/Core/VideoCommon/TextureDecoder_Common.cpp index 7f151b2406..cad1a918e3 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Common.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Common.cpp @@ -5,9 +5,10 @@ #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" + #include "VideoCommon/LookUpTables.h" #include "VideoCommon/TextureDecoder.h" #include "VideoCommon/TextureDecoder_Util.h" diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index eb7ed141ef..cf89cf2632 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -6,8 +6,9 @@ #include #include "Common/CPUDetect.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" + #include "VideoCommon/LookUpTables.h" #include "VideoCommon/TextureDecoder.h" #include "VideoCommon/TextureDecoder_Util.h" diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp index 4697e8ba1b..3d5da590f5 100644 --- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp @@ -7,10 +7,10 @@ #include #include "Common/CPUDetect.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Intrinsics.h" #include "Common/MsgHandler.h" +#include "Common/Swap.h" #include "VideoCommon/LookUpTables.h" #include "VideoCommon/TextureDecoder.h" diff --git a/Source/Core/VideoCommon/VertexLoader_Color.cpp b/Source/Core/VideoCommon/VertexLoader_Color.cpp index 8ae672f6e0..7a87519bd3 100644 --- a/Source/Core/VideoCommon/VertexLoader_Color.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Color.cpp @@ -4,8 +4,9 @@ #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" + #include "VideoCommon/VertexLoader.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexLoaderUtils.h" diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/VertexLoader_Normal.cpp index c780d88cf7..305fd85a6e 100644 --- a/Source/Core/VideoCommon/VertexLoader_Normal.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Normal.cpp @@ -2,17 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/VertexLoader_Normal.h" + #include #include #include "Common/Common.h" -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" + #include "VideoCommon/DataReader.h" #include "VideoCommon/VertexLoader.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexLoaderUtils.h" -#include "VideoCommon/VertexLoader_Normal.h" // warning: mapping buffer should be disabled to use this #define LOG_NORM() // PRIM_LOG("norm: %f %f %f, ", ((float*)g_vertex_manager_write_ptr)[-3], diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.h b/Source/Core/VideoCommon/VertexLoader_Normal.h index 811d2d05a7..5b91615761 100644 --- a/Source/Core/VideoCommon/VertexLoader_Normal.h +++ b/Source/Core/VideoCommon/VertexLoader_Normal.h @@ -5,6 +5,7 @@ #pragma once #include "Common/CommonTypes.h" +#include "VideoCommon/VertexLoader.h" class VertexLoader_Normal { diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp index 4b52861122..86f1e76e36 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp @@ -2,16 +2,18 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/VertexLoader_Position.h" + #include #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" + #include "VideoCommon/DataReader.h" #include "VideoCommon/VertexLoader.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexLoaderUtils.h" -#include "VideoCommon/VertexLoader_Position.h" #include "VideoCommon/VideoCommon.h" template diff --git a/Source/Core/VideoCommon/VertexLoader_Position.h b/Source/Core/VideoCommon/VertexLoader_Position.h index b34542128f..1a8a2855e3 100644 --- a/Source/Core/VideoCommon/VertexLoader_Position.h +++ b/Source/Core/VideoCommon/VertexLoader_Position.h @@ -5,6 +5,7 @@ #pragma once #include "Common/CommonTypes.h" +#include "VideoCommon/VertexLoader.h" class VertexLoader_Position { diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp index aa4e87415c..99d3a797ec 100644 --- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp +++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp @@ -2,15 +2,17 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/VertexLoader_TextCoord.h" + #include -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" +#include "Common/Swap.h" + #include "VideoCommon/DataReader.h" #include "VideoCommon/VertexLoader.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VertexLoaderUtils.h" -#include "VideoCommon/VertexLoader_TextCoord.h" template void LOG_TEX(); diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.h b/Source/Core/VideoCommon/VertexLoader_TextCoord.h index fe04e5670f..1b135e46d3 100644 --- a/Source/Core/VideoCommon/VertexLoader_TextCoord.h +++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.h @@ -5,6 +5,7 @@ #pragma once #include "Common/CommonTypes.h" +#include "VideoCommon/VertexLoader.h" class VertexLoader_TextCoord { diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp index abe35ed422..9a2db74459 100644 --- a/Source/Core/VideoCommon/XFStructs.cpp +++ b/Source/Core/VideoCommon/XFStructs.cpp @@ -2,10 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" +#include "Common/Swap.h" + #include "Core/HW/Memmap.h" + #include "VideoCommon/CPMemory.h" #include "VideoCommon/DataReader.h" #include "VideoCommon/Fifo.h" diff --git a/Source/UnitTests/Common/CMakeLists.txt b/Source/UnitTests/Common/CMakeLists.txt index 8a88efe60c..8b0eed1abf 100644 --- a/Source/UnitTests/Common/CMakeLists.txt +++ b/Source/UnitTests/Common/CMakeLists.txt @@ -11,4 +11,5 @@ add_dolphin_test(FlagTest FlagTest.cpp) add_dolphin_test(MathUtilTest MathUtilTest.cpp) add_dolphin_test(NandPathsTest NandPathsTest.cpp) add_dolphin_test(StringUtilTest StringUtilTest.cpp) +add_dolphin_test(SwapTest SwapTest.cpp) add_dolphin_test(x64EmitterTest x64EmitterTest.cpp) diff --git a/Source/UnitTests/Common/CommonFuncsTest.cpp b/Source/UnitTests/Common/CommonFuncsTest.cpp index c33dbda8c6..8808290771 100644 --- a/Source/UnitTests/Common/CommonFuncsTest.cpp +++ b/Source/UnitTests/Common/CommonFuncsTest.cpp @@ -30,11 +30,3 @@ TEST(CommonFuncs, CrashMacro) { EXPECT_DEATH({ Crash(); }, ""); } - -TEST(CommonFuncs, Swap) -{ - EXPECT_EQ(0xf0, Common::swap8(0xf0)); - EXPECT_EQ(0x1234, Common::swap16(0x3412)); - EXPECT_EQ(0x12345678u, Common::swap32(0x78563412)); - EXPECT_EQ(0x123456789abcdef0ull, Common::swap64(0xf0debc9a78563412ull)); -} diff --git a/Source/UnitTests/Common/SwapTest.cpp b/Source/UnitTests/Common/SwapTest.cpp new file mode 100644 index 0000000000..b44a6efa50 --- /dev/null +++ b/Source/UnitTests/Common/SwapTest.cpp @@ -0,0 +1,15 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include + +#include "Common/Swap.h" + +TEST(Swap, SwapByValue) +{ + EXPECT_EQ(0xf0, Common::swap8(0xf0)); + EXPECT_EQ(0x1234, Common::swap16(0x3412)); + EXPECT_EQ(0x12345678u, Common::swap32(0x78563412)); + EXPECT_EQ(0x123456789abcdef0ull, Common::swap64(0xf0debc9a78563412ull)); +}