From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/common/assert.h | 26 +- src/common/bit_field.h | 26 +- src/common/bit_set.h | 203 ++- src/common/break_points.cpp | 54 +- src/common/break_points.h | 18 +- src/common/chunk_file.h | 539 ++++--- src/common/code_block.h | 42 +- src/common/color.h | 30 +- src/common/common_funcs.h | 25 +- src/common/common_paths.h | 54 +- src/common/common_types.h | 8 +- src/common/emu_window.cpp | 48 +- src/common/emu_window.h | 54 +- src/common/file_util.cpp | 515 +++---- src/common/file_util.h | 118 +- src/common/hash.cpp | 96 +- src/common/key_map.cpp | 30 +- src/common/key_map.h | 11 +- src/common/linear_disk_cache.h | 78 +- src/common/logging/backend.cpp | 139 +- src/common/logging/backend.h | 6 +- src/common/logging/filter.cpp | 7 +- src/common/logging/filter.h | 4 +- src/common/logging/log.h | 136 +- src/common/logging/text_formatter.cpp | 52 +- src/common/logging/text_formatter.h | 1 - src/common/math_util.h | 33 +- src/common/memory_util.cpp | 90 +- src/common/memory_util.h | 6 +- src/common/microprofile.h | 2 +- src/common/misc.cpp | 8 +- src/common/platform.h | 4 +- src/common/profiler.cpp | 4 +- src/common/scope_exit.h | 23 +- src/common/string_util.cpp | 191 +-- src/common/string_util.h | 56 +- src/common/swap.h | 331 +++-- src/common/symbols.cpp | 66 +- src/common/symbols.h | 25 +- src/common/synchronized_wrapper.h | 22 +- src/common/thread.cpp | 80 +- src/common/thread.h | 40 +- src/common/thread_queue_list.h | 22 +- src/common/timer.cpp | 73 +- src/common/timer.h | 11 +- src/common/vector_math.h | 707 +++++---- src/common/x64/abi.cpp | 127 +- src/common/x64/abi.h | 15 +- src/common/x64/cpu_detect.cpp | 92 +- src/common/x64/emitter.cpp | 2614 ++++++++++++++++++++------------- src/common/x64/emitter.h | 601 +++++--- 51 files changed, 4173 insertions(+), 3390 deletions(-) (limited to 'src/common') diff --git a/src/common/assert.h b/src/common/assert.h index cd9b819a9..70214efae 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -18,25 +18,29 @@ // enough for our purposes. template #if defined(_MSC_VER) - __declspec(noinline, noreturn) +__declspec(noinline, noreturn) #elif defined(__GNUC__) __attribute__((noinline, noreturn, cold)) #endif -static void assert_noinline_call(const Fn& fn) { + static void assert_noinline_call(const Fn& fn) { fn(); Crash(); exit(1); // Keeps GCC's mouth shut about this actually returning } -#define ASSERT(_a_) \ - do if (!(_a_)) { assert_noinline_call([] { \ - LOG_CRITICAL(Debug, "Assertion Failed!"); \ - }); } while (0) - -#define ASSERT_MSG(_a_, ...) \ - do if (!(_a_)) { assert_noinline_call([&] { \ - LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \ - }); } while (0) +#define ASSERT(_a_) \ + do \ + if (!(_a_)) { \ + assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!"); }); \ + } \ + while (0) + +#define ASSERT_MSG(_a_, ...) \ + do \ + if (!(_a_)) { \ + assert_noinline_call([&] { LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \ + } \ + while (0) #define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") #define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__) diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 4748999ed..8d45743e2 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h @@ -1,7 +1,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - // Copyright 2014 Tony Wasserka // All rights reserved. // @@ -29,7 +28,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #pragma once #include @@ -111,9 +109,8 @@ * symptoms. */ #pragma pack(1) -template -struct BitField -{ +template +struct BitField { private: // We hide the copy assigment operator here, because the default copy // assignment would copy the full storage value, rather than just the bits @@ -141,13 +138,10 @@ public: } FORCE_INLINE T Value() const { - if (std::numeric_limits::is_signed) - { - std::size_t shift = 8 * sizeof(T)-bits; + if (std::numeric_limits::is_signed) { + std::size_t shift = 8 * sizeof(T) - bits; return (T)((storage << (shift - position)) >> shift); - } - else - { + } else { return (T)((storage & GetMask()) >> position); } } @@ -162,15 +156,14 @@ private: // T is an enumeration. Note that T is wrapped within an enable_if in the // former case to workaround compile errors which arise when using // std::underlying_type::type directly. - typedef typename std::conditional < std::is_enum::value, - std::underlying_type, - std::enable_if < true, T >> ::type::type StorageType; + typedef typename std::conditional::value, std::underlying_type, + std::enable_if>::type::type StorageType; // Unsigned version of StorageType typedef typename std::make_unsigned::type StorageTypeU; FORCE_INLINE StorageType GetMask() const { - return (((StorageTypeU)~0) >> (8 * sizeof(T)-bits)) << position; + return (((StorageTypeU)~0) >> (8 * sizeof(T) - bits)) << position; } StorageType storage; @@ -186,5 +179,6 @@ private: #pragma pack() #if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER) -static_assert(std::is_trivially_copyable>::value, "BitField must be trivially copyable"); +static_assert(std::is_trivially_copyable>::value, + "BitField must be trivially copyable"); #endif diff --git a/src/common/bit_set.h b/src/common/bit_set.h index 7f5de8df2..b83cbbb36 100644 --- a/src/common/bit_set.h +++ b/src/common/bit_set.h @@ -18,49 +18,60 @@ namespace Common { #ifdef _WIN32 template -static inline int CountSetBits(T v) -{ +static inline int CountSetBits(T v) { // from https://graphics.stanford.edu/~seander/bithacks.html // GCC has this built in, but MSVC's intrinsic will only emit the actual // POPCNT instruction, which we're not depending on - v = v - ((v >> 1) & (T)~(T)0/3); - v = (v & (T)~(T)0/15*3) + ((v >> 2) & (T)~(T)0/15*3); - v = (v + (v >> 4)) & (T)~(T)0/255*15; - return (T)(v * ((T)~(T)0/255)) >> (sizeof(T) - 1) * 8; + v = v - ((v >> 1) & (T) ~(T)0 / 3); + v = (v & (T) ~(T)0 / 15 * 3) + ((v >> 2) & (T) ~(T)0 / 15 * 3); + v = (v + (v >> 4)) & (T) ~(T)0 / 255 * 15; + return (T)(v * ((T) ~(T)0 / 255)) >> (sizeof(T) - 1) * 8; } -static inline int LeastSignificantSetBit(u8 val) -{ +static inline int LeastSignificantSetBit(u8 val) { unsigned long index; _BitScanForward(&index, val); return (int)index; } -static inline int LeastSignificantSetBit(u16 val) -{ +static inline int LeastSignificantSetBit(u16 val) { unsigned long index; _BitScanForward(&index, val); return (int)index; } -static inline int LeastSignificantSetBit(u32 val) -{ +static inline int LeastSignificantSetBit(u32 val) { unsigned long index; _BitScanForward(&index, val); return (int)index; } -static inline int LeastSignificantSetBit(u64 val) -{ +static inline int LeastSignificantSetBit(u64 val) { unsigned long index; _BitScanForward64(&index, val); return (int)index; } #else -static inline int CountSetBits(u8 val) { return __builtin_popcount(val); } -static inline int CountSetBits(u16 val) { return __builtin_popcount(val); } -static inline int CountSetBits(u32 val) { return __builtin_popcount(val); } -static inline int CountSetBits(u64 val) { return __builtin_popcountll(val); } -static inline int LeastSignificantSetBit(u8 val) { return __builtin_ctz(val); } -static inline int LeastSignificantSetBit(u16 val) { return __builtin_ctz(val); } -static inline int LeastSignificantSetBit(u32 val) { return __builtin_ctz(val); } -static inline int LeastSignificantSetBit(u64 val) { return __builtin_ctzll(val); } +static inline int CountSetBits(u8 val) { + return __builtin_popcount(val); +} +static inline int CountSetBits(u16 val) { + return __builtin_popcount(val); +} +static inline int CountSetBits(u32 val) { + return __builtin_popcount(val); +} +static inline int CountSetBits(u64 val) { + return __builtin_popcountll(val); +} +static inline int LeastSignificantSetBit(u8 val) { + return __builtin_ctz(val); +} +static inline int LeastSignificantSetBit(u16 val) { + return __builtin_ctz(val); +} +static inline int LeastSignificantSetBit(u32 val) { + return __builtin_ctz(val); +} +static inline int LeastSignificantSetBit(u64 val) { + return __builtin_ctzll(val); +} #endif // Similar to std::bitset, this is a class which encapsulates a bitset, i.e. @@ -84,100 +95,144 @@ static inline int LeastSignificantSetBit(u64 val) { return __builtin_ctzll(val); // TODO: use constexpr when MSVC gets out of the Dark Ages template -class BitSet -{ +class BitSet { static_assert(!std::is_signed::value, "BitSet should not be used with signed types"); + public: // A reference to a particular bit, returned from operator[]. - class Ref - { + class Ref { public: - Ref(Ref&& other) : m_bs(other.m_bs), m_mask(other.m_mask) {} - Ref(BitSet* bs, IntTy mask) : m_bs(bs), m_mask(mask) {} - operator bool() const { return (m_bs->m_val & m_mask) != 0; } - bool operator=(bool set) - { + Ref(Ref&& other) : m_bs(other.m_bs), m_mask(other.m_mask) { + } + Ref(BitSet* bs, IntTy mask) : m_bs(bs), m_mask(mask) { + } + operator bool() const { + return (m_bs->m_val & m_mask) != 0; + } + bool operator=(bool set) { m_bs->m_val = (m_bs->m_val & ~m_mask) | (set ? m_mask : 0); return set; } + private: BitSet* m_bs; IntTy m_mask; }; // A STL-like iterator is required to be able to use range-based for loops. - class Iterator - { + class Iterator { public: - Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) {} - Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) {} - Iterator& operator=(Iterator other) { new (this) Iterator(other); return *this; } - int operator*() { return m_bit; } - Iterator& operator++() - { - if (m_val == 0) - { + Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) { + } + Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) { + } + Iterator& operator=(Iterator other) { + new (this) Iterator(other); + return *this; + } + int operator*() { + return m_bit; + } + Iterator& operator++() { + if (m_val == 0) { m_bit = -1; - } - else - { + } else { int bit = LeastSignificantSetBit(m_val); m_val &= ~(1 << bit); m_bit = bit; } return *this; } - Iterator operator++(int _) - { + Iterator operator++(int _) { Iterator other(*this); ++*this; return other; } - bool operator==(Iterator other) const { return m_bit == other.m_bit; } - bool operator!=(Iterator other) const { return m_bit != other.m_bit; } + bool operator==(Iterator other) const { + return m_bit == other.m_bit; + } + bool operator!=(Iterator other) const { + return m_bit != other.m_bit; + } + private: IntTy m_val; int m_bit; }; - BitSet() : m_val(0) {} - explicit BitSet(IntTy val) : m_val(val) {} - BitSet(std::initializer_list init) - { + BitSet() : m_val(0) { + } + explicit BitSet(IntTy val) : m_val(val) { + } + BitSet(std::initializer_list init) { m_val = 0; for (int bit : init) m_val |= (IntTy)1 << bit; } - static BitSet AllTrue(size_t count) - { - return BitSet(count == sizeof(IntTy)*8 ? ~(IntTy)0 : (((IntTy)1 << count) - 1)); - } - - Ref operator[](size_t bit) { return Ref(this, (IntTy)1 << bit); } - const Ref operator[](size_t bit) const { return (*const_cast(this))[bit]; } - bool operator==(BitSet other) const { return m_val == other.m_val; } - bool operator!=(BitSet other) const { return m_val != other.m_val; } - bool operator<(BitSet other) const { return m_val < other.m_val; } - bool operator>(BitSet other) const { return m_val > other.m_val; } - BitSet operator|(BitSet other) const { return BitSet(m_val | other.m_val); } - BitSet operator&(BitSet other) const { return BitSet(m_val & other.m_val); } - BitSet operator^(BitSet other) const { return BitSet(m_val ^ other.m_val); } - BitSet operator~() const { return BitSet(~m_val); } - BitSet& operator|=(BitSet other) { return *this = *this | other; } - BitSet& operator&=(BitSet other) { return *this = *this & other; } - BitSet& operator^=(BitSet other) { return *this = *this ^ other; } + static BitSet AllTrue(size_t count) { + return BitSet(count == sizeof(IntTy) * 8 ? ~(IntTy)0 : (((IntTy)1 << count) - 1)); + } + + Ref operator[](size_t bit) { + return Ref(this, (IntTy)1 << bit); + } + const Ref operator[](size_t bit) const { + return (*const_cast(this))[bit]; + } + bool operator==(BitSet other) const { + return m_val == other.m_val; + } + bool operator!=(BitSet other) const { + return m_val != other.m_val; + } + bool operator<(BitSet other) const { + return m_val < other.m_val; + } + bool operator>(BitSet other) const { + return m_val > other.m_val; + } + BitSet operator|(BitSet other) const { + return BitSet(m_val | other.m_val); + } + BitSet operator&(BitSet other) const { + return BitSet(m_val & other.m_val); + } + BitSet operator^(BitSet other) const { + return BitSet(m_val ^ other.m_val); + } + BitSet operator~() const { + return BitSet(~m_val); + } + BitSet& operator|=(BitSet other) { + return *this = *this | other; + } + BitSet& operator&=(BitSet other) { + return *this = *this & other; + } + BitSet& operator^=(BitSet other) { + return *this = *this ^ other; + } operator u32() = delete; - operator bool() { return m_val != 0; } + operator bool() { + return m_val != 0; + } // Warning: Even though on modern CPUs this is a single fast instruction, // Dolphin's official builds do not currently assume POPCNT support on x86, // so slower explicit bit twiddling is generated. Still should generally // be faster than a loop. - unsigned int Count() const { return CountSetBits(m_val); } + unsigned int Count() const { + return CountSetBits(m_val); + } - Iterator begin() const { Iterator it(m_val, 0); return ++it; } - Iterator end() const { return Iterator(m_val, -1); } + Iterator begin() const { + Iterator it(m_val, 0); + return ++it; + } + Iterator end() const { + return Iterator(m_val, -1); + } IntTy m_val; }; diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index e7d0d3e43..3218db314 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -5,30 +5,27 @@ #include "common/break_points.h" #include "common/logging/log.h" -#include #include +#include -bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const -{ +bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const { auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; - auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); + auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); return it != m_BreakPoints.end(); } -bool BreakPoints::IsTempBreakPoint(u32 iAddress) const -{ - auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; }; - auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); +bool BreakPoints::IsTempBreakPoint(u32 iAddress) const { + auto cond = [&iAddress](const TBreakPoint& bp) { + return bp.iAddress == iAddress && bp.bTemporary; + }; + auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); return it != m_BreakPoints.end(); } -BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const -{ +BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const { TBreakPointsStr bps; - for (auto breakpoint : m_BreakPoints) - { - if (!breakpoint.bTemporary) - { + for (auto breakpoint : m_BreakPoints) { + if (!breakpoint.bTemporary) { std::stringstream bp; bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : ""); bps.push_back(bp.str()); @@ -38,10 +35,8 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const return bps; } -void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) -{ - for (auto bps_item : bps) - { +void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) { + for (auto bps_item : bps) { TBreakPoint bp; std::stringstream bpstr; bpstr << std::hex << bps_item; @@ -52,18 +47,15 @@ void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) } } -void BreakPoints::Add(const TBreakPoint& bp) -{ - if (!IsAddressBreakPoint(bp.iAddress)) - { +void BreakPoints::Add(const TBreakPoint& bp) { + if (!IsAddressBreakPoint(bp.iAddress)) { m_BreakPoints.push_back(bp); - //if (jit) + // if (jit) // jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); } } -void BreakPoints::Add(u32 em_address, bool temp) -{ +void BreakPoints::Add(u32 em_address, bool temp) { if (!IsAddressBreakPoint(em_address)) // only add new addresses { TBreakPoint pt; // breakpoint settings @@ -73,22 +65,20 @@ void BreakPoints::Add(u32 em_address, bool temp) m_BreakPoints.push_back(pt); - //if (jit) + // if (jit) // jit->GetBlockCache()->InvalidateICache(em_address, 4); } } -void BreakPoints::Remove(u32 em_address) -{ +void BreakPoints::Remove(u32 em_address) { auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; }; - auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); + auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); if (it != m_BreakPoints.end()) m_BreakPoints.erase(it); } -void BreakPoints::Clear() -{ - //if (jit) +void BreakPoints::Clear() { + // if (jit) //{ // std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(), // [](const TBreakPoint& bp) diff --git a/src/common/break_points.h b/src/common/break_points.h index b0629df37..1a5b7d296 100644 --- a/src/common/break_points.h +++ b/src/common/break_points.h @@ -4,28 +4,28 @@ #pragma once -#include #include +#include #include "common/common_types.h" class DebugInterface; -struct TBreakPoint -{ - u32 iAddress; +struct TBreakPoint { + u32 iAddress; bool bOn; bool bTemporary; }; // Code breakpoints. -class BreakPoints -{ +class BreakPoints { public: typedef std::vector TBreakPoints; typedef std::vector TBreakPointsStr; - const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } + const TBreakPoints& GetBreakPoints() { + return m_BreakPoints; + } TBreakPointsStr GetStrings() const; void AddFromStrings(const TBreakPointsStr& bps); @@ -35,7 +35,7 @@ public: bool IsTempBreakPoint(u32 iAddress) const; // Add BreakPoint - void Add(u32 em_address, bool temp=false); + void Add(u32 em_address, bool temp = false); void Add(const TBreakPoint& bp); // Remove Breakpoint @@ -46,5 +46,5 @@ public: private: TBreakPoints m_BreakPoints; - u32 m_iBreakOnCount; + u32 m_iBreakOnCount; }; diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 1e1bcff31..3b36c0a9e 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -41,81 +41,86 @@ #include "common/logging/log.h" template -struct LinkedListItem : public T -{ - LinkedListItem *next; +struct LinkedListItem : public T { + LinkedListItem* next; }; class PointerWrap; -class PointerWrapSection -{ +class PointerWrapSection { public: - PointerWrapSection(PointerWrap &p, int ver, const char *title) : p_(p), ver_(ver), title_(title) { + PointerWrapSection(PointerWrap& p, int ver, const char* title) + : p_(p), ver_(ver), title_(title) { } ~PointerWrapSection(); - bool operator == (const int &v) const { return ver_ == v; } - bool operator != (const int &v) const { return ver_ != v; } - bool operator <= (const int &v) const { return ver_ <= v; } - bool operator >= (const int &v) const { return ver_ >= v; } - bool operator < (const int &v) const { return ver_ < v; } - bool operator > (const int &v) const { return ver_ > v; } + bool operator==(const int& v) const { + return ver_ == v; + } + bool operator!=(const int& v) const { + return ver_ != v; + } + bool operator<=(const int& v) const { + return ver_ <= v; + } + bool operator>=(const int& v) const { + return ver_ >= v; + } + bool operator<(const int& v) const { + return ver_ < v; + } + bool operator>(const int& v) const { + return ver_ > v; + } - operator bool() const { + operator bool() const { return ver_ > 0; } private: - PointerWrap &p_; + PointerWrap& p_; int ver_; - const char *title_; + const char* title_; }; // Wrapper class -class PointerWrap -{ - // This makes it a compile error if you forget to define DoState() on non-POD. - // Which also can be a problem, for example struct tm is non-POD on linux, for whatever reason... +class PointerWrap { +// This makes it a compile error if you forget to define DoState() on non-POD. +// Which also can be a problem, for example struct tm is non-POD on linux, for whatever reason... #ifdef _MSC_VER - template::value, bool isPointer = std::is_pointer::value> + template ::value, + bool isPointer = std::is_pointer::value> #else - template::value> + template ::value> #endif - struct DoHelper - { - static void DoArray(PointerWrap *p, T *x, int count) - { + struct DoHelper { + static void DoArray(PointerWrap* p, T* x, int count) { for (int i = 0; i < count; ++i) p->Do(x[i]); } - static void Do(PointerWrap *p, T &x) - { + static void Do(PointerWrap* p, T& x) { p->DoClass(x); } }; - template - struct DoHelper - { - static void DoArray(PointerWrap *p, T *x, int count) - { - p->DoVoid((void *)x, sizeof(T) * count); + template + struct DoHelper { + static void DoArray(PointerWrap* p, T* x, int count) { + p->DoVoid((void*)x, sizeof(T) * count); } - static void Do(PointerWrap *p, T &x) - { - p->DoVoid((void *)&x, sizeof(x)); + static void Do(PointerWrap* p, T& x) { + p->DoVoid((void*)&x, sizeof(x)); } }; public: enum Mode { MODE_READ = 1, // load - MODE_WRITE, // save - MODE_MEASURE, // calculate size - MODE_VERIFY, // compare + MODE_WRITE, // save + MODE_MEASURE, // calculate size + MODE_VERIFY, // compare }; enum Error { @@ -124,247 +129,239 @@ public: ERROR_FAILURE = 2, }; - u8 **ptr; + u8** ptr; Mode mode; Error error; public: - PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_), error(ERROR_NONE) {} - PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_), error(ERROR_NONE) {} + PointerWrap(u8** ptr_, Mode mode_) : ptr(ptr_), mode(mode_), error(ERROR_NONE) { + } + PointerWrap(unsigned char** ptr_, int mode_) + : ptr((u8**)ptr_), mode((Mode)mode_), error(ERROR_NONE) { + } - PointerWrapSection Section(const char *title, int ver) { + PointerWrapSection Section(const char* title, int ver) { return Section(title, ver, ver); } // The returned object can be compared against the version that was loaded. // This can be used to support versions as old as minVer. // Version = 0 means the section was not found. - PointerWrapSection Section(const char *title, int minVer, int ver) { + PointerWrapSection Section(const char* title, int minVer, int ver) { char marker[16] = {0}; int foundVersion = ver; strncpy(marker, title, sizeof(marker)); - if (!ExpectVoid(marker, sizeof(marker))) - { + if (!ExpectVoid(marker, sizeof(marker))) { // Might be before we added name markers for safety. if (foundVersion == 1 && ExpectVoid(&foundVersion, sizeof(foundVersion))) DoMarker(title); // Wasn't found, but maybe we can still load the state. else foundVersion = 0; - } - else + } else Do(foundVersion); if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) { - LOG_ERROR(Common, "Savestate failure: wrong version %d found for %s", foundVersion, title); + LOG_ERROR(Common, "Savestate failure: wrong version %d found for %s", foundVersion, + title); SetError(ERROR_FAILURE); return PointerWrapSection(*this, -1, title); } return PointerWrapSection(*this, foundVersion, title); } - void SetMode(Mode mode_) {mode = mode_;} - Mode GetMode() const {return mode;} - u8 **GetPPtr() {return ptr;} - void SetError(Error error_) - { + void SetMode(Mode mode_) { + mode = mode_; + } + Mode GetMode() const { + return mode; + } + u8** GetPPtr() { + return ptr; + } + void SetError(Error error_) { if (error < error_) error = error_; if (error > ERROR_WARNING) mode = PointerWrap::MODE_MEASURE; } - bool ExpectVoid(void *data, int size) - { + bool ExpectVoid(void* data, int size) { switch (mode) { - case MODE_READ: if (memcmp(data, *ptr, size) != 0) return false; break; - case MODE_WRITE: memcpy(*ptr, data, size); break; - case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything + case MODE_READ: + if (memcmp(data, *ptr, size) != 0) + return false; + break; + case MODE_WRITE: + memcpy(*ptr, data, size); + break; + case MODE_MEASURE: + break; // MODE_MEASURE - don't need to do anything case MODE_VERIFY: for (int i = 0; i < size; i++) { - DEBUG_ASSERT_MSG(((u8*)data)[i] == (*ptr)[i], + DEBUG_ASSERT_MSG( + ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", - ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], - (*ptr)[i], (*ptr)[i], &(*ptr)[i]); + ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], + &(*ptr)[i]); } break; - default: break; // throw an error? + default: + break; // throw an error? } (*ptr) += size; return true; } - void DoVoid(void *data, int size) - { + void DoVoid(void* data, int size) { switch (mode) { - case MODE_READ: memcpy(data, *ptr, size); break; - case MODE_WRITE: memcpy(*ptr, data, size); break; - case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything + case MODE_READ: + memcpy(data, *ptr, size); + break; + case MODE_WRITE: + memcpy(*ptr, data, size); + break; + case MODE_MEASURE: + break; // MODE_MEASURE - don't need to do anything case MODE_VERIFY: for (int i = 0; i < size; i++) { - DEBUG_ASSERT_MSG(((u8*)data)[i] == (*ptr)[i], + DEBUG_ASSERT_MSG( + ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", - ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], - (*ptr)[i], (*ptr)[i], &(*ptr)[i]); + ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], + &(*ptr)[i]); } break; - default: break; // throw an error? + default: + break; // throw an error? } (*ptr) += size; } - template - void Do(std::map &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { + template + void Do(std::map& x) { + if (mode == MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { if (it->second != nullptr) delete it->second; } } - T *dv = nullptr; + T* dv = nullptr; DoMap(x, dv); } - template - void Do(std::map &x) - { + template + void Do(std::map& x) { T dv = T(); DoMap(x, dv); } - template - void DoMap(std::map &x, T &default_val) - { + template + void DoMap(std::map& x, T& default_val) { unsigned int number = (unsigned int)x.size(); Do(number); switch (mode) { - case MODE_READ: - { - x.clear(); - while (number > 0) - { - K first = K(); - Do(first); - T second = default_val; - Do(second); - x[first] = second; - --number; - } + case MODE_READ: { + x.clear(); + while (number > 0) { + K first = K(); + Do(first); + T second = default_val; + Do(second); + x[first] = second; + --number; } - break; + } break; case MODE_WRITE: case MODE_MEASURE: - case MODE_VERIFY: - { - typename std::map::iterator itr = x.begin(); - while (number > 0) - { - K first = itr->first; - Do(first); - Do(itr->second); - --number; - ++itr; - } + case MODE_VERIFY: { + typename std::map::iterator itr = x.begin(); + while (number > 0) { + K first = itr->first; + Do(first); + Do(itr->second); + --number; + ++itr; } - break; + } break; } } - template - void Do(std::multimap &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { + template + void Do(std::multimap& x) { + if (mode == MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { if (it->second != nullptr) delete it->second; } } - T *dv = nullptr; + T* dv = nullptr; DoMultimap(x, dv); } - template - void Do(std::multimap &x) - { + template + void Do(std::multimap& x) { T dv = T(); DoMultimap(x, dv); } - template - void DoMultimap(std::multimap &x, T &default_val) - { + template + void DoMultimap(std::multimap& x, T& default_val) { unsigned int number = (unsigned int)x.size(); Do(number); switch (mode) { - case MODE_READ: - { - x.clear(); - while (number > 0) - { - K first = K(); - Do(first); - T second = default_val; - Do(second); - x.insert(std::make_pair(first, second)); - --number; - } + case MODE_READ: { + x.clear(); + while (number > 0) { + K first = K(); + Do(first); + T second = default_val; + Do(second); + x.insert(std::make_pair(first, second)); + --number; } - break; + } break; case MODE_WRITE: case MODE_MEASURE: - case MODE_VERIFY: - { - typename std::multimap::iterator itr = x.begin(); - while (number > 0) - { - Do(itr->first); - Do(itr->second); - --number; - ++itr; - } + case MODE_VERIFY: { + typename std::multimap::iterator itr = x.begin(); + while (number > 0) { + Do(itr->first); + Do(itr->second); + --number; + ++itr; } - break; + } break; } } // Store vectors. - template - void Do(std::vector &x) - { - T *dv = nullptr; + template + void Do(std::vector& x) { + T* dv = nullptr; DoVector(x, dv); } - template - void Do(std::vector &x) - { + template + void Do(std::vector& x) { T dv = T(); DoVector(x, dv); } - - template - void DoPOD(std::vector &x) - { + template + void DoPOD(std::vector& x) { T dv = T(); DoVectorPOD(x, dv); } - template - void Do(std::vector &x, T &default_val) - { + template + void Do(std::vector& x, T& default_val) { DoVector(x, default_val); } - template - void DoVector(std::vector &x, T &default_val) - { + template + void DoVector(std::vector& x, T& default_val) { u32 vec_size = (u32)x.size(); Do(vec_size); x.resize(vec_size, default_val); @@ -372,9 +369,8 @@ public: DoArray(&x[0], vec_size); } - template - void DoVectorPOD(std::vector &x, T &default_val) - { + template + void DoVectorPOD(std::vector& x, T& default_val) { u32 vec_size = (u32)x.size(); Do(vec_size); x.resize(vec_size, default_val); @@ -383,55 +379,48 @@ public: } // Store deques. - template - void Do(std::deque &x) - { - T *dv = nullptr; + template + void Do(std::deque& x) { + T* dv = nullptr; DoDeque(x, dv); } - template - void Do(std::deque &x) - { + template + void Do(std::deque& x) { T dv = T(); DoDeque(x, dv); } - template - void DoDeque(std::deque &x, T &default_val) - { + template + void DoDeque(std::deque& x, T& default_val) { u32 deq_size = (u32)x.size(); Do(deq_size); x.resize(deq_size, default_val); u32 i; - for(i = 0; i < deq_size; i++) + for (i = 0; i < deq_size; i++) Do(x[i]); } // Store STL lists. - template - void Do(std::list &x) - { - T *dv = nullptr; + template + void Do(std::list& x) { + T* dv = nullptr; Do(x, dv); } - template - void Do(std::list &x) - { + template + void Do(std::list& x) { T dv = T(); DoList(x, dv); } - template - void Do(std::list &x, T &default_val) - { + template + void Do(std::list& x, T& default_val) { DoList(x, default_val); } - template - void DoList(std::list &x, T &default_val) - { + template + void DoList(std::list& x, T& default_val) { u32 list_size = (u32)x.size(); Do(list_size); x.resize(list_size, default_val); @@ -441,15 +430,11 @@ public: Do(*itr); } - // Store STL sets. template - void Do(std::set &x) - { - if (mode == MODE_READ) - { - for (auto it = x.begin(), end = x.end(); it != end; ++it) - { + void Do(std::set& x) { + if (mode == MODE_READ) { + for (auto it = x.begin(), end = x.end(); it != end; ++it) { if (*it != nullptr) delete *it; } @@ -458,39 +443,31 @@ public: } template - void Do(std::set &x) - { + void Do(std::set& x) { DoSet(x); } template - void DoSet(std::set &x) - { + void DoSet(std::set& x) { unsigned int number = (unsigned int)x.size(); Do(number); - switch (mode) - { - case MODE_READ: - { - x.clear(); - while (number-- > 0) - { - T it = T(); - Do(it); - x.insert(it); - } + switch (mode) { + case MODE_READ: { + x.clear(); + while (number-- > 0) { + T it = T(); + Do(it); + x.insert(it); } - break; + } break; case MODE_WRITE: case MODE_MEASURE: - case MODE_VERIFY: - { - typename std::set::iterator itr = x.begin(); - while (number-- > 0) - Do(*itr++); - } - break; + case MODE_VERIFY: { + typename std::set::iterator itr = x.begin(); + while (number-- > 0) + Do(*itr++); + } break; default: LOG_ERROR(Common, "Savestate error: invalid mode %d.", mode); @@ -498,51 +475,58 @@ public: } // Store strings. - void Do(std::string &x) - { + void Do(std::string& x) { int stringLen = (int)x.length() + 1; Do(stringLen); switch (mode) { - case MODE_READ: x = (char*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; + case MODE_READ: + x = (char*)*ptr; + break; + case MODE_WRITE: + memcpy(*ptr, x.c_str(), stringLen); + break; + case MODE_MEASURE: + break; case MODE_VERIFY: DEBUG_ASSERT_MSG((x == (char*)*ptr), - "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", - x.c_str(), (char*)*ptr, ptr); + "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", + x.c_str(), (char*)*ptr, ptr); break; } (*ptr) += stringLen; } - void Do(std::wstring &x) - { - int stringLen = sizeof(wchar_t)*((int)x.length() + 1); + void Do(std::wstring& x) { + int stringLen = sizeof(wchar_t) * ((int)x.length() + 1); Do(stringLen); switch (mode) { - case MODE_READ: x = (wchar_t*)*ptr; break; - case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; - case MODE_MEASURE: break; + case MODE_READ: + x = (wchar_t*)*ptr; + break; + case MODE_WRITE: + memcpy(*ptr, x.c_str(), stringLen); + break; + case MODE_MEASURE: + break; case MODE_VERIFY: DEBUG_ASSERT_MSG((x == (wchar_t*)*ptr), - "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", - x.c_str(), (wchar_t*)*ptr, ptr); + "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", + x.c_str(), (wchar_t*)*ptr, ptr); break; } (*ptr) += stringLen; } - template - void DoClass(T &x) { + template + void DoClass(T& x) { x.DoState(*this); } - template - void DoClass(T *&x) { - if (mode == MODE_READ) - { + template + void DoClass(T*& x) { + if (mode == MODE_READ) { if (x != nullptr) delete x; x = new T(); @@ -550,81 +534,70 @@ public: x->DoState(*this); } - template - void DoArray(T *x, int count) { + template + void DoArray(T* x, int count) { DoHelper::DoArray(this, x, count); } - template - void Do(T &x) { + template + void Do(T& x) { DoHelper::Do(this, x); } - template - void DoPOD(T &x) { + template + void DoPOD(T& x) { DoHelper::Do(this, x); } - template - void DoPointer(T* &x, T*const base) { - // pointers can be more than 2^31 apart, but you're using this function wrong if you need that much range + template + void DoPointer(T*& x, T* const base) { + // pointers can be more than 2^31 apart, but you're using this function wrong if you need + // that much range s32 offset = x - base; Do(offset); if (mode == MODE_READ) x = base + offset; } - template* (*TNew)(), void (*TFree)(LinkedListItem*), void (*TDo)(PointerWrap&, T*)> - void DoLinkedList(LinkedListItem*& list_start, LinkedListItem** list_end = nullptr) - { + template * (*TNew)(), void (*TFree)(LinkedListItem*), + void (*TDo)(PointerWrap&, T*)> + void DoLinkedList(LinkedListItem*& list_start, LinkedListItem** list_end = nullptr) { LinkedListItem* list_cur = list_start; LinkedListItem* prev = nullptr; - while (true) - { + while (true) { u8 shouldExist = (list_cur ? 1 : 0); Do(shouldExist); - if (shouldExist == 1) - { + if (shouldExist == 1) { LinkedListItem* cur = list_cur ? list_cur : TNew(); TDo(*this, (T*)cur); - if (!list_cur) - { - if (mode == MODE_READ) - { + if (!list_cur) { + if (mode == MODE_READ) { cur->next = nullptr; list_cur = cur; if (prev) prev->next = cur; else list_start = cur; - } - else - { + } else { TFree(cur); continue; } } - } - else - { - if (mode == MODE_READ) - { + } else { + if (mode == MODE_READ) { if (prev) prev->next = nullptr; if (list_end) *list_end = prev; - if (list_cur) - { + if (list_cur) { if (list_start == list_cur) list_start = nullptr; - do - { + do { LinkedListItem* next = list_cur->next; TFree(list_cur); list_cur = next; - } - while (list_cur); + } while (list_cur); } } break; @@ -634,13 +607,13 @@ public: } } - void DoMarker(const char* prevName, u32 arbitraryNumber=0x42) - { + void DoMarker(const char* prevName, u32 arbitraryNumber = 0x42) { u32 cookie = arbitraryNumber; Do(cookie); - if(mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) - { - LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); + if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { + LOG_ERROR(Common, "After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). " + "Aborting savestate load...", + prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); SetError(ERROR_FAILURE); } } diff --git a/src/common/code_block.h b/src/common/code_block.h index 2fa4a0090..58696737e 100644 --- a/src/common/code_block.h +++ b/src/common/code_block.h @@ -14,24 +14,28 @@ // having to prefix them with gen-> or something similar. // Example implementation: // class JIT : public CodeBlock {} -template class CodeBlock : public T, NonCopyable -{ +template +class CodeBlock : public T, NonCopyable { private: // A privately used function to set the executable RAM space to something invalid. - // For debugging usefulness it should be used to set the RAM to a host specific breakpoint instruction + // For debugging usefulness it should be used to set the RAM to a host specific breakpoint + // instruction virtual void PoisonMemory() = 0; protected: - u8 *region; + u8* region; size_t region_size; public: - CodeBlock() : region(nullptr), region_size(0) {} - virtual ~CodeBlock() { if (region) FreeCodeSpace(); } + CodeBlock() : region(nullptr), region_size(0) { + } + virtual ~CodeBlock() { + if (region) + FreeCodeSpace(); + } // Call this before you generate any code. - void AllocCodeSpace(int size) - { + void AllocCodeSpace(int size) { region_size = size; region = (u8*)AllocateExecutableMemory(region_size); T::SetCodePtr(region); @@ -39,15 +43,13 @@ public: // Always clear code space with breakpoints, so that if someone accidentally executes // uninitialized, it just breaks into the debugger. - void ClearCodeSpace() - { + void ClearCodeSpace() { PoisonMemory(); ResetCodePtr(); } // Call this when shutting down. Don't rely on the destructor, even though it'll do the job. - void FreeCodeSpace() - { + void FreeCodeSpace() { #ifdef __SYMBIAN32__ ResetExecutableMemory(region); #else @@ -57,33 +59,29 @@ public: region_size = 0; } - bool IsInSpace(const u8 *ptr) - { + bool IsInSpace(const u8* ptr) { return (ptr >= region) && (ptr < (region + region_size)); } // Cannot currently be undone. Will write protect the entire code region. // Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()). - void WriteProtect() - { + void WriteProtect() { WriteProtectMemory(region, region_size, true); } - void ResetCodePtr() - { + void ResetCodePtr() { T::SetCodePtr(region); } - size_t GetSpaceLeft() const - { + size_t GetSpaceLeft() const { return region_size - (T::GetCodePtr() - region); } - u8 *GetBasePtr() { + u8* GetBasePtr() { return region; } - size_t GetOffset(const u8 *ptr) const { + size_t GetOffset(const u8* ptr) const { return ptr - region; } }; diff --git a/src/common/color.h b/src/common/color.h index 908879ea6..4ebd4f3d0 100644 --- a/src/common/color.h +++ b/src/common/color.h @@ -56,7 +56,7 @@ constexpr u8 Convert8To6(u8 value) { * @return Result color decoded as Math::Vec4 */ inline const Math::Vec4 DecodeRGBA8(const u8* bytes) { - return { bytes[3], bytes[2], bytes[1], bytes[0] }; + return {bytes[3], bytes[2], bytes[1], bytes[0]}; } /** @@ -65,7 +65,7 @@ inline const Math::Vec4 DecodeRGBA8(const u8* bytes) { * @return Result color decoded as Math::Vec4 */ inline const Math::Vec4 DecodeRGB8(const u8* bytes) { - return { bytes[2], bytes[1], bytes[0], 255 }; + return {bytes[2], bytes[1], bytes[0], 255}; } /** @@ -74,7 +74,7 @@ inline const Math::Vec4 DecodeRGB8(const u8* bytes) { * @return Result color decoded as Math::Vec4 */ inline const Math::Vec4 DecodeRG8(const u8* bytes) { - return { bytes[1], bytes[0], 0, 255 }; + return {bytes[1], bytes[0], 0, 255}; } /** @@ -84,8 +84,8 @@ inline const Math::Vec4 DecodeRG8(const u8* bytes) { */ inline const Math::Vec4 DecodeRGB565(const u8* bytes) { const u16_le pixel = *reinterpret_cast(bytes); - return { Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), - Convert5To8(pixel & 0x1F), 255 }; + return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), + Convert5To8(pixel & 0x1F), 255}; } /** @@ -95,8 +95,8 @@ inline const Math::Vec4 DecodeRGB565(const u8* bytes) { */ inline const Math::Vec4 DecodeRGB5A1(const u8* bytes) { const u16_le pixel = *reinterpret_cast(bytes); - return { Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), - Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1) }; + return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), + Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1)}; } /** @@ -106,8 +106,8 @@ inline const Math::Vec4 DecodeRGB5A1(const u8* bytes) { */ inline const Math::Vec4 DecodeRGBA4(const u8* bytes) { const u16_le pixel = *reinterpret_cast(bytes); - return { Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), - Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF) }; + return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), + Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF)}; } /** @@ -134,7 +134,7 @@ inline u32 DecodeD24(const u8* bytes) { * @return Resulting values stored as a Math::Vec2 */ inline const Math::Vec2 DecodeD24S8(const u8* bytes) { - return { static_cast((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3] }; + return {static_cast((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]}; } /** @@ -175,8 +175,8 @@ inline void EncodeRG8(const Math::Vec4& color, u8* bytes) { * @param bytes Destination pointer to store encoded color */ inline void EncodeRGB565(const Math::Vec4& color, u8* bytes) { - *reinterpret_cast(bytes) = (Convert8To5(color.r()) << 11) | - (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); + *reinterpret_cast(bytes) = + (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); } /** @@ -186,7 +186,8 @@ inline void EncodeRGB565(const Math::Vec4& color, u8* bytes) { */ inline void EncodeRGB5A1(const Math::Vec4& color, u8* bytes) { *reinterpret_cast(bytes) = (Convert8To5(color.r()) << 11) | - (Convert8To5(color.g()) << 6) | (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); + (Convert8To5(color.g()) << 6) | + (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); } /** @@ -196,7 +197,8 @@ inline void EncodeRGB5A1(const Math::Vec4& color, u8* bytes) { */ inline void EncodeRGBA4(const Math::Vec4& color, u8* bytes) { *reinterpret_cast(bytes) = (Convert8To4(color.r()) << 12) | - (Convert8To4(color.g()) << 8) | (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); + (Convert8To4(color.g()) << 8) | + (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); } /** diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 4633897ce..ad5bdbc08 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -14,7 +14,7 @@ /// Textually concatenates two tokens. The double-expansion is required by the C preprocessor. #define CONCAT2(x, y) DO_CONCAT2(x, y) -#define DO_CONCAT2(x, y) x ## y +#define DO_CONCAT2(x, y) x##y // helper macro to properly align structure members. // Calling INSERT_PADDING_BYTES will add a new member variable with a name like "pad121", @@ -24,9 +24,9 @@ // Inlining #ifdef _WIN32 - #define FORCE_INLINE __forceinline +#define FORCE_INLINE __forceinline #else - #define FORCE_INLINE inline __attribute__((always_inline)) +#define FORCE_INLINE inline __attribute__((always_inline)) #endif #ifndef _MSC_VER @@ -46,7 +46,8 @@ #else inline u32 rotl(u32 x, int shift) { shift &= 31; - if (!shift) return x; + if (!shift) + return x; return (x << shift) | (x >> (32 - shift)); } #endif @@ -56,17 +57,18 @@ inline u32 rotl(u32 x, int shift) { #else inline u32 rotr(u32 x, int shift) { shift &= 31; - if (!shift) return x; + if (!shift) + return x; return (x >> shift) | (x << (32 - shift)); } #endif -inline u64 _rotl64(u64 x, unsigned int shift){ +inline u64 _rotl64(u64 x, unsigned int shift) { unsigned int n = shift % 64; return (x << n) | (x >> (64 - n)); } -inline u64 _rotr64(u64 x, unsigned int shift){ +inline u64 _rotr64(u64 x, unsigned int shift) { unsigned int n = shift % 64; return (x >> n) | (x << (64 - n)); } @@ -74,17 +76,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){ #else // _MSC_VER #if (_MSC_VER < 1900) - // Function Cross-Compatibility - #define snprintf _snprintf +// Function Cross-Compatibility +#define snprintf _snprintf #endif // Locale Cross-Compatibility #define locale_t _locale_t extern "C" { - __declspec(dllimport) void __stdcall DebugBreak(void); +__declspec(dllimport) void __stdcall DebugBreak(void); } -#define Crash() {DebugBreak();} +#define Crash() \ + { DebugBreak(); } // cstdlib provides these on MSVC #define rotr _rotr diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 2903f2cf2..a5342a610 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -16,13 +16,13 @@ #define ROOT_DIR "." #define USERDATA_DIR "user" #ifdef USER_DIR - #define EMU_DATA_DIR USER_DIR +#define EMU_DATA_DIR USER_DIR #else - #ifdef _WIN32 - #define EMU_DATA_DIR "Citra Emulator" - #else - #define EMU_DATA_DIR "citra-emu" - #endif +#ifdef _WIN32 +#define EMU_DATA_DIR "Citra Emulator" +#else +#define EMU_DATA_DIR "citra-emu" +#endif #endif // Dirs in both User and Sys @@ -31,32 +31,32 @@ #define JAP_DIR "JAP" // Subdirs in the User dir returned by GetUserPath(D_USER_IDX) -#define CONFIG_DIR "config" -#define GAMECONFIG_DIR "game_config" -#define MAPS_DIR "maps" -#define CACHE_DIR "cache" -#define SDMC_DIR "sdmc" -#define NAND_DIR "nand" -#define SYSDATA_DIR "sysdata" -#define SHADERCACHE_DIR "shader_cache" -#define STATESAVES_DIR "state_saves" -#define SCREENSHOTS_DIR "screenShots" -#define DUMP_DIR "dump" -#define DUMP_TEXTURES_DIR "textures" -#define DUMP_FRAMES_DIR "frames" -#define DUMP_AUDIO_DIR "audio" -#define LOGS_DIR "logs" -#define SHADERS_DIR "shaders" -#define SYSCONF_DIR "sysconf" +#define CONFIG_DIR "config" +#define GAMECONFIG_DIR "game_config" +#define MAPS_DIR "maps" +#define CACHE_DIR "cache" +#define SDMC_DIR "sdmc" +#define NAND_DIR "nand" +#define SYSDATA_DIR "sysdata" +#define SHADERCACHE_DIR "shader_cache" +#define STATESAVES_DIR "state_saves" +#define SCREENSHOTS_DIR "screenShots" +#define DUMP_DIR "dump" +#define DUMP_TEXTURES_DIR "textures" +#define DUMP_FRAMES_DIR "frames" +#define DUMP_AUDIO_DIR "audio" +#define LOGS_DIR "logs" +#define SHADERS_DIR "shaders" +#define SYSCONF_DIR "sysconf" // Filenames // Files in the directory returned by GetUserPath(D_CONFIG_IDX) -#define EMU_CONFIG "emu.ini" -#define DEBUGGER_CONFIG "debugger.ini" -#define LOGGER_CONFIG "logger.ini" +#define EMU_CONFIG "emu.ini" +#define DEBUGGER_CONFIG "debugger.ini" +#define LOGGER_CONFIG "logger.ini" // Sys files -#define SHARED_FONT "shared_font.bin" +#define SHARED_FONT "shared_font.bin" // Files in the directory returned by GetUserPath(D_LOGS_IDX) #define MAIN_LOG "emu.log" diff --git a/src/common/common_types.h b/src/common/common_types.h index 9f51dff18..ee18eac81 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h @@ -32,18 +32,18 @@ #endif #endif -typedef std::uint8_t u8; ///< 8-bit unsigned byte +typedef std::uint8_t u8; ///< 8-bit unsigned byte typedef std::uint16_t u16; ///< 16-bit unsigned short typedef std::uint32_t u32; ///< 32-bit unsigned word typedef std::uint64_t u64; ///< 64-bit unsigned int -typedef std::int8_t s8; ///< 8-bit signed byte +typedef std::int8_t s8; ///< 8-bit signed byte typedef std::int16_t s16; ///< 16-bit signed short typedef std::int32_t s32; ///< 32-bit signed word typedef std::int64_t s64; ///< 64-bit signed int -typedef float f32; ///< 32-bit floating point -typedef double f64; ///< 64-bit floating point +typedef float f32; ///< 32-bit floating point +typedef double f64; ///< 64-bit floating point // TODO: It would be nice to eventually replace these with strong types that prevent accidental // conversion between each other. diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index fd728c109..c86f663a8 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -44,18 +44,17 @@ void EmuWindow::CirclePadUpdated(float x, float y) { */ static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y) { - return (framebuffer_y >= layout.bottom_screen.top && - framebuffer_y < layout.bottom_screen.bottom && - framebuffer_x >= layout.bottom_screen.left && - framebuffer_x < layout.bottom_screen.right); + return ( + framebuffer_y >= layout.bottom_screen.top && framebuffer_y < layout.bottom_screen.bottom && + framebuffer_x >= layout.bottom_screen.left && framebuffer_x < layout.bottom_screen.right); } -std::tuple EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { +std::tuple EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { new_x = std::max(new_x, framebuffer_layout.bottom_screen.left); - new_x = std::min(new_x, framebuffer_layout.bottom_screen.right-1); + new_x = std::min(new_x, framebuffer_layout.bottom_screen.right - 1); new_y = std::max(new_y, framebuffer_layout.bottom_screen.top); - new_y = std::min(new_y, framebuffer_layout.bottom_screen.bottom-1); + new_y = std::min(new_y, framebuffer_layout.bottom_screen.bottom - 1); return std::make_tuple(new_x, new_y); } @@ -64,10 +63,12 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) { if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) return; - touch_x = VideoCore::kScreenBottomWidth * (framebuffer_x - framebuffer_layout.bottom_screen.left) / - (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left); - touch_y = VideoCore::kScreenBottomHeight * (framebuffer_y - framebuffer_layout.bottom_screen.top) / - (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top); + touch_x = VideoCore::kScreenBottomWidth * + (framebuffer_x - framebuffer_layout.bottom_screen.left) / + (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left); + touch_y = VideoCore::kScreenBottomHeight * + (framebuffer_y - framebuffer_layout.bottom_screen.top) / + (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top); touch_pressed = true; pad_state.touch.Assign(1); @@ -90,16 +91,19 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) { TouchPressed(framebuffer_x, framebuffer_y); } -EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, unsigned height) { +EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, + unsigned height) { // When hiding the widget, the function receives a size of 0 - if (width == 0) width = 1; - if (height == 0) height = 1; + if (width == 0) + width = 1; + if (height == 0) + height = 1; - EmuWindow::FramebufferLayout res = { width, height, {}, {} }; + EmuWindow::FramebufferLayout res = {width, height, {}, {}}; float window_aspect_ratio = static_cast(height) / width; - float emulation_aspect_ratio = static_cast(VideoCore::kScreenTopHeight * 2) / - VideoCore::kScreenTopWidth; + float emulation_aspect_ratio = + static_cast(VideoCore::kScreenTopHeight * 2) / VideoCore::kScreenTopWidth; if (window_aspect_ratio > emulation_aspect_ratio) { // Window is narrower than the emulation content => apply borders to the top and bottom @@ -110,8 +114,9 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u res.top_screen.top = (height - viewport_height) / 2; res.top_screen.bottom = res.top_screen.top + viewport_height / 2; - int bottom_width = static_cast((static_cast(VideoCore::kScreenBottomWidth) / - VideoCore::kScreenTopWidth) * (res.top_screen.right - res.top_screen.left)); + int bottom_width = static_cast( + (static_cast(VideoCore::kScreenBottomWidth) / VideoCore::kScreenTopWidth) * + (res.top_screen.right - res.top_screen.left)); int bottom_border = ((res.top_screen.right - res.top_screen.left) - bottom_width) / 2; res.bottom_screen.left = bottom_border; @@ -127,8 +132,9 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u res.top_screen.top = 0; res.top_screen.bottom = res.top_screen.top + height / 2; - int bottom_width = static_cast((static_cast(VideoCore::kScreenBottomWidth) / - VideoCore::kScreenTopWidth) * (res.top_screen.right - res.top_screen.left)); + int bottom_width = static_cast( + (static_cast(VideoCore::kScreenBottomWidth) / VideoCore::kScreenTopWidth) * + (res.top_screen.right - res.top_screen.left)); int bottom_border = ((res.top_screen.right - res.top_screen.left) - bottom_width) / 2; res.bottom_screen.left = res.top_screen.left + bottom_border; diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 57e303b6d..de8badd4f 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -30,15 +30,14 @@ * - DO NOT TREAT THIS CLASS AS A GUI TOOLKIT ABSTRACTION LAYER. That's not what it is. Please * re-read the upper points again and think about it if you don't see this. */ -class EmuWindow -{ +class EmuWindow { public: /// Data structure to store emuwindow configuration struct WindowConfig { - bool fullscreen; - int res_width; - int res_height; - std::pair min_client_area_size; + bool fullscreen; + int res_width; + int res_height; + std::pair min_client_area_size; }; /// Describes the layout of the window framebuffer (size and top/bottom screen positions) @@ -193,15 +192,18 @@ public: /** * Returns currently active configuration. - * @note Accesses to the returned object need not be consistent because it may be modified in another thread + * @note Accesses to the returned object need not be consistent because it may be modified in + * another thread */ const WindowConfig& GetActiveConfig() const { return active_config; } /** - * Requests the internal configuration to be replaced by the specified argument at some point in the future. - * @note This method is thread-safe, because it delays configuration changes to the GUI event loop. Hence there is no guarantee on when the requested configuration will be active. + * Requests the internal configuration to be replaced by the specified argument at some point in + * the future. + * @note This method is thread-safe, because it delays configuration changes to the GUI event + * loop. Hence there is no guarantee on when the requested configuration will be active. */ void SetConfig(const WindowConfig& val) { config = val; @@ -227,7 +229,8 @@ protected: circle_pad_y = 0; touch_pressed = false; } - virtual ~EmuWindow() {} + virtual ~EmuWindow() { + } /** * Processes any pending configuration changes from the last SetConfig call. @@ -258,7 +261,7 @@ protected: * Update internal client area size with the given parameter. * @note EmuWindow implementations will usually use this in window resize event handlers. */ - void NotifyClientAreaSizeChanged(const std::pair& size) { + void NotifyClientAreaSizeChanged(const std::pair& size) { client_area_width = size.first; client_area_height = size.second; } @@ -266,32 +269,35 @@ protected: private: /** * Handler called when the minimal client area was requested to be changed via SetConfig. - * For the request to be honored, EmuWindow implementations will usually reimplement this function. + * For the request to be honored, EmuWindow implementations will usually reimplement this + * function. */ - virtual void OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { + virtual void + OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { // By default, ignore this request and do nothing. } FramebufferLayout framebuffer_layout; ///< Current framebuffer layout - unsigned client_area_width; ///< Current client width, should be set by window impl. - unsigned client_area_height; ///< Current client height, should be set by window impl. + unsigned client_area_width; ///< Current client width, should be set by window impl. + unsigned client_area_height; ///< Current client height, should be set by window impl. - WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) - WindowConfig active_config; ///< Internal active configuration + WindowConfig config; ///< Internal configuration (changes pending for being applied in + /// ProcessConfigurationChanges) + WindowConfig active_config; ///< Internal active configuration - bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false + bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false - u16 touch_x; ///< Touchpad X-position in native 3DS pixel coordinates (0-320) - u16 touch_y; ///< Touchpad Y-position in native 3DS pixel coordinates (0-240) + u16 touch_x; ///< Touchpad X-position in native 3DS pixel coordinates (0-320) + u16 touch_y; ///< Touchpad Y-position in native 3DS pixel coordinates (0-240) s16 circle_pad_x; ///< Circle pad X-position in native 3DS pixel coordinates (-156 - 156) s16 circle_pad_y; ///< Circle pad Y-position in native 3DS pixel coordinates (-156 - 156) - /** - * Clip the provided coordinates to be inside the touchscreen area. - */ - std::tuple ClipToTouchScreen(unsigned new_x, unsigned new_y); + /** + * Clip the provided coordinates to be inside the touchscreen area. + */ + std::tuple ClipToTouchScreen(unsigned new_x, unsigned new_y); Service::HID::PadState pad_state; }; diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index bc83ab737..c8723a4b3 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -2,73 +2,70 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/file_util.h" #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_paths.h" -#include "common/file_util.h" #include "common/logging/log.h" #ifdef _WIN32 - #include - #include // for SHGetFolderPath - #include - #include // for GetSaveFileName - #include - #include // getcwd - #include - - #include "common/string_util.h" - - // 64 bit offsets for windows - #define fseeko _fseeki64 - #define ftello _ftelli64 - #define atoll _atoi64 - #define stat64 _stat64 - #define fstat64 _fstat64 - #define fileno _fileno +#include +#include // for GetSaveFileName +#include // getcwd +#include +#include +#include // for SHGetFolderPath +#include + +#include "common/string_util.h" + +// 64 bit offsets for windows +#define fseeko _fseeki64 +#define ftello _ftelli64 +#define atoll _atoi64 +#define stat64 _stat64 +#define fstat64 _fstat64 +#define fileno _fileno #else - #ifdef __APPLE__ - #include - #endif - #include - #include - #include - #include - #include - #include - #include +#ifdef __APPLE__ +#include +#endif +#include +#include +#include +#include +#include +#include +#include #endif #if defined(__APPLE__) - #include - #include - #include +#include +#include +#include #endif #include #include #ifndef S_ISDIR - #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) #endif #ifdef BSD4_4 - #define stat64 stat - #define fstat64 fstat +#define stat64 stat +#define fstat64 fstat #endif // This namespace has various generic functions related to files and paths. // The code still needs a ton of cleanup. // REMEMBER: strdup considered harmful! -namespace FileUtil -{ +namespace FileUtil { // Remove any ending forward slashes from directory paths // Modifies argument. -static void StripTailDirSlashes(std::string &fname) -{ - if (fname.length() > 1) - { +static void StripTailDirSlashes(std::string& fname) { + if (fname.length() > 1) { size_t i = fname.length(); while (i > 0 && fname[i - 1] == DIR_SEP_CHR) --i; @@ -78,8 +75,7 @@ static void StripTailDirSlashes(std::string &fname) } // Returns true if file filename exists -bool Exists(const std::string &filename) -{ +bool Exists(const std::string& filename) { struct stat64 file_info; std::string copy(filename); @@ -99,8 +95,7 @@ bool Exists(const std::string &filename) } // Returns true if filename is a directory -bool IsDirectory(const std::string &filename) -{ +bool IsDirectory(const std::string& filename) { struct stat64 file_info; std::string copy(filename); @@ -117,8 +112,8 @@ bool IsDirectory(const std::string &filename) #endif if (result < 0) { - LOG_WARNING(Common_Filesystem, "stat failed on %s: %s", - filename.c_str(), GetLastErrorMsg()); + LOG_WARNING(Common_Filesystem, "stat failed on %s: %s", filename.c_str(), + GetLastErrorMsg()); return false; } @@ -127,36 +122,32 @@ bool IsDirectory(const std::string &filename) // Deletes a given filename, return true on success // Doesn't supports deleting a directory -bool Delete(const std::string &filename) -{ +bool Delete(const std::string& filename) { LOG_INFO(Common_Filesystem, "file %s", filename.c_str()); // Return true because we care about the file no // being there, not the actual delete. - if (!Exists(filename)) - { + if (!Exists(filename)) { LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str()); return true; } // We can't delete a directory - if (IsDirectory(filename)) - { + if (IsDirectory(filename)) { LOG_ERROR(Common_Filesystem, "Failed: %s is a directory", filename.c_str()); return false; } #ifdef _WIN32 - if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) - { - LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s", - filename.c_str(), GetLastErrorMsg()); + if (!DeleteFileW(Common::UTF8ToUTF16W(filename).c_str())) { + LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s", filename.c_str(), + GetLastErrorMsg()); return false; } #else if (unlink(filename.c_str()) == -1) { - LOG_ERROR(Common_Filesystem, "unlink failed on %s: %s", - filename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "unlink failed on %s: %s", filename.c_str(), + GetLastErrorMsg()); return false; } #endif @@ -165,16 +156,15 @@ bool Delete(const std::string &filename) } // Returns true if successful, or path already exists. -bool CreateDir(const std::string &path) -{ +bool CreateDir(const std::string& path) { LOG_TRACE(Common_Filesystem, "directory %s", path.c_str()); #ifdef _WIN32 if (::CreateDirectoryW(Common::UTF8ToUTF16W(path).c_str(), nullptr)) return true; DWORD error = GetLastError(); - if (error == ERROR_ALREADY_EXISTS) - { - LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str()); + if (error == ERROR_ALREADY_EXISTS) { + LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", + path.c_str()); return true; } LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error); @@ -185,8 +175,7 @@ bool CreateDir(const std::string &path) int err = errno; - if (err == EEXIST) - { + if (err == EEXIST) { LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str()); return true; } @@ -197,20 +186,17 @@ bool CreateDir(const std::string &path) } // Creates the full path of fullPath returns true on success -bool CreateFullPath(const std::string &fullPath) -{ +bool CreateFullPath(const std::string& fullPath) { int panicCounter = 100; LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str()); - if (FileUtil::Exists(fullPath)) - { + if (FileUtil::Exists(fullPath)) { LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str()); return true; } size_t position = 0; - while (true) - { + while (true) { // Find next sub path position = fullPath.find(DIR_SEP_CHR, position); @@ -227,8 +213,7 @@ bool CreateFullPath(const std::string &fullPath) // A safety check panicCounter--; - if (panicCounter <= 0) - { + if (panicCounter <= 0) { LOG_ERROR(Common, "CreateFullPath: directory structure is too deep"); return false; } @@ -236,15 +221,12 @@ bool CreateFullPath(const std::string &fullPath) } } - // Deletes a directory filename, returns true on success -bool DeleteDir(const std::string &filename) -{ +bool DeleteDir(const std::string& filename) { LOG_INFO(Common_Filesystem, "directory %s", filename.c_str()); // check if a directory - if (!FileUtil::IsDirectory(filename)) - { + if (!FileUtil::IsDirectory(filename)) { LOG_ERROR(Common_Filesystem, "Not a directory %s", filename.c_str()); return false; } @@ -262,83 +244,73 @@ bool DeleteDir(const std::string &filename) } // renames file srcFilename to destFilename, returns true on success -bool Rename(const std::string &srcFilename, const std::string &destFilename) -{ - LOG_TRACE(Common_Filesystem, "%s --> %s", - srcFilename.c_str(), destFilename.c_str()); +bool Rename(const std::string& srcFilename, const std::string& destFilename) { + LOG_TRACE(Common_Filesystem, "%s --> %s", srcFilename.c_str(), destFilename.c_str()); #ifdef _WIN32 - if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(), Common::UTF8ToUTF16W(destFilename).c_str()) == 0) + if (_wrename(Common::UTF8ToUTF16W(srcFilename).c_str(), + Common::UTF8ToUTF16W(destFilename).c_str()) == 0) return true; #else if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) return true; #endif - LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), + GetLastErrorMsg()); return false; } // copies file srcFilename to destFilename, returns true on success -bool Copy(const std::string &srcFilename, const std::string &destFilename) -{ - LOG_TRACE(Common_Filesystem, "%s --> %s", - srcFilename.c_str(), destFilename.c_str()); +bool Copy(const std::string& srcFilename, const std::string& destFilename) { + LOG_TRACE(Common_Filesystem, "%s --> %s", srcFilename.c_str(), destFilename.c_str()); #ifdef _WIN32 - if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(), Common::UTF8ToUTF16W(destFilename).c_str(), FALSE)) + if (CopyFileW(Common::UTF8ToUTF16W(srcFilename).c_str(), + Common::UTF8ToUTF16W(destFilename).c_str(), FALSE)) return true; - LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), + GetLastErrorMsg()); return false; #else - // buffer size +// buffer size #define BSIZE 1024 char buffer[BSIZE]; // Open input file - FILE *input = fopen(srcFilename.c_str(), "rb"); - if (!input) - { - LOG_ERROR(Common_Filesystem, "opening input failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + FILE* input = fopen(srcFilename.c_str(), "rb"); + if (!input) { + LOG_ERROR(Common_Filesystem, "opening input failed %s --> %s: %s", srcFilename.c_str(), + destFilename.c_str(), GetLastErrorMsg()); return false; } // open output file - FILE *output = fopen(destFilename.c_str(), "wb"); - if (!output) - { + FILE* output = fopen(destFilename.c_str(), "wb"); + if (!output) { fclose(input); - LOG_ERROR(Common_Filesystem, "opening output failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "opening output failed %s --> %s: %s", srcFilename.c_str(), + destFilename.c_str(), GetLastErrorMsg()); return false; } // copy loop - while (!feof(input)) - { + while (!feof(input)) { // read input int rnum = fread(buffer, sizeof(char), BSIZE, input); - if (rnum != BSIZE) - { - if (ferror(input) != 0) - { - LOG_ERROR(Common_Filesystem, - "failed reading from source, %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + if (rnum != BSIZE) { + if (ferror(input) != 0) { + LOG_ERROR(Common_Filesystem, "failed reading from source, %s --> %s: %s", + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } } // write output int wnum = fwrite(buffer, sizeof(char), rnum, output); - if (wnum != rnum) - { - LOG_ERROR(Common_Filesystem, - "failed writing to output, %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + if (wnum != rnum) { + LOG_ERROR(Common_Filesystem, "failed writing to output, %s --> %s: %s", + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); goto bail; } } @@ -356,16 +328,13 @@ bail: } // Returns the size of filename (64bit) -u64 GetSize(const std::string &filename) -{ - if (!Exists(filename)) - { +u64 GetSize(const std::string& filename) { + if (!Exists(filename)) { LOG_ERROR(Common_Filesystem, "failed %s: No such file", filename.c_str()); return 0; } - if (IsDirectory(filename)) - { + if (IsDirectory(filename)) { LOG_ERROR(Common_Filesystem, "failed %s: is a directory", filename.c_str()); return 0; } @@ -377,65 +346,54 @@ u64 GetSize(const std::string &filename) if (stat64(filename.c_str(), &buf) == 0) #endif { - LOG_TRACE(Common_Filesystem, "%s: %lld", - filename.c_str(), (long long)buf.st_size); + LOG_TRACE(Common_Filesystem, "%s: %lld", filename.c_str(), (long long)buf.st_size); return buf.st_size; } - LOG_ERROR(Common_Filesystem, "Stat failed %s: %s", - filename.c_str(), GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "Stat failed %s: %s", filename.c_str(), GetLastErrorMsg()); return 0; } // Overloaded GetSize, accepts file descriptor -u64 GetSize(const int fd) -{ +u64 GetSize(const int fd) { struct stat64 buf; if (fstat64(fd, &buf) != 0) { - LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", - fd, GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg()); return 0; } return buf.st_size; } // Overloaded GetSize, accepts FILE* -u64 GetSize(FILE *f) -{ +u64 GetSize(FILE* f) { // can't use off_t here because it can be 32-bit u64 pos = ftello(f); if (fseeko(f, 0, SEEK_END) != 0) { - LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", - f, GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", f, GetLastErrorMsg()); return 0; } u64 size = ftello(f); if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) { - LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", - f, GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s", f, GetLastErrorMsg()); return 0; } return size; } // creates an empty file filename, returns true on success -bool CreateEmptyFile(const std::string &filename) -{ +bool CreateEmptyFile(const std::string& filename) { LOG_TRACE(Common_Filesystem, "%s", filename.c_str()); - if (!FileUtil::IOFile(filename, "wb")) - { - LOG_ERROR(Common_Filesystem, "failed %s: %s", - filename.c_str(), GetLastErrorMsg()); + if (!FileUtil::IOFile(filename, "wb")) { + LOG_ERROR(Common_Filesystem, "failed %s: %s", filename.c_str(), GetLastErrorMsg()); return false; } return true; } - -bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directory, DirectoryEntryCallable callback) -{ +bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, + DirectoryEntryCallable callback) { LOG_TRACE(Common_Filesystem, "directory %s", directory.c_str()); // How many files + directories we found @@ -457,7 +415,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo do { const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName)); #else - DIR *dirp = opendir(directory.c_str()); + DIR* dirp = opendir(directory.c_str()); if (!dirp) return false; @@ -493,8 +451,8 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo return true; } -unsigned ScanDirectoryTree(const std::string &directory, FSTEntry& parent_entry, unsigned int recursion) -{ +unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, + unsigned int recursion) { const auto callback = [recursion, &parent_entry](unsigned* num_entries_out, const std::string& directory, const std::string& virtual_name) -> bool { @@ -526,11 +484,8 @@ unsigned ScanDirectoryTree(const std::string &directory, FSTEntry& parent_entry, return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; } - -bool DeleteDirRecursively(const std::string &directory, unsigned int recursion) -{ - const auto callback = [recursion](unsigned* num_entries_out, - const std::string& directory, +bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { + const auto callback = [recursion](unsigned* num_entries_out, const std::string& directory, const std::string& virtual_name) -> bool { std::string new_path = directory + DIR_SEP_CHR + virtual_name; @@ -551,53 +506,53 @@ bool DeleteDirRecursively(const std::string &directory, unsigned int recursion) } // Create directory and copy contents (does not overwrite existing files) -void CopyDir(const std::string &source_path, const std::string &dest_path) -{ +void CopyDir(const std::string& source_path, const std::string& dest_path) { #ifndef _WIN32 - if (source_path == dest_path) return; - if (!FileUtil::Exists(source_path)) return; - if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path); - - DIR *dirp = opendir(source_path.c_str()); - if (!dirp) return; + if (source_path == dest_path) + return; + if (!FileUtil::Exists(source_path)) + return; + if (!FileUtil::Exists(dest_path)) + FileUtil::CreateFullPath(dest_path); + + DIR* dirp = opendir(source_path.c_str()); + if (!dirp) + return; while (struct dirent* result = readdir(dirp)) { const std::string virtualName(result->d_name); // check for "." and ".." if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || - ((virtualName[0] == '.') && (virtualName[1] == '.') && - (virtualName[2] == '\0'))) + ((virtualName[0] == '.') && (virtualName[1] == '.') && (virtualName[2] == '\0'))) continue; std::string source, dest; source = source_path + virtualName; dest = dest_path + virtualName; - if (IsDirectory(source)) - { + if (IsDirectory(source)) { source += '/'; dest += '/'; - if (!FileUtil::Exists(dest)) FileUtil::CreateFullPath(dest); + if (!FileUtil::Exists(dest)) + FileUtil::CreateFullPath(dest); CopyDir(source, dest); - } - else if (!FileUtil::Exists(dest)) FileUtil::Copy(source, dest); + } else if (!FileUtil::Exists(dest)) + FileUtil::Copy(source, dest); } closedir(dirp); #endif } // Returns the current directory -std::string GetCurrentDir() -{ - // Get the current working directory (getcwd uses malloc) +std::string GetCurrentDir() { +// Get the current working directory (getcwd uses malloc) #ifdef _WIN32 - wchar_t *dir; + wchar_t* dir; if (!(dir = _wgetcwd(nullptr, 0))) { #else - char *dir; + char* dir; if (!(dir = getcwd(nullptr, 0))) { #endif - LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", - GetLastErrorMsg()); + LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s", GetLastErrorMsg()); return nullptr; } #ifdef _WIN32 @@ -610,8 +565,7 @@ std::string GetCurrentDir() } // Sets the current directory to the given directory -bool SetCurrentDir(const std::string &directory) -{ +bool SetCurrentDir(const std::string& directory) { #ifdef _WIN32 return _wchdir(Common::UTF8ToUTF16W(directory).c_str()) == 0; #else @@ -620,8 +574,7 @@ bool SetCurrentDir(const std::string &directory) } #if defined(__APPLE__) -std::string GetBundleDirectory() -{ +std::string GetBundleDirectory() { CFURLRef BundleRef; char AppBundlePath[MAXPATHLEN]; // Get the main bundle for the app @@ -636,11 +589,9 @@ std::string GetBundleDirectory() #endif #ifdef _WIN32 -std::string& GetExeDirectory() -{ +std::string& GetExeDirectory() { static std::string exe_path; - if (exe_path.empty()) - { + if (exe_path.empty()) { wchar_t wchar_exe_path[2048]; GetModuleFileNameW(nullptr, wchar_exe_path, 2048); exe_path = Common::UTF16ToUTF8(wchar_exe_path); @@ -660,7 +611,8 @@ static const std::string& GetHomeDirectory() { home_path = envvar; } else { auto pw = getpwuid(getuid()); - ASSERT_MSG(pw, "$HOME isn’t defined, and the current user can’t be found in /etc/passwd."); + ASSERT_MSG(pw, + "$HOME isn’t defined, and the current user can’t be found in /etc/passwd."); home_path = pw->pw_dir; } } @@ -699,11 +651,10 @@ static const std::string GetUserDirectory(const std::string& envvar) { } #endif -std::string GetSysDirectory() -{ +std::string GetSysDirectory() { std::string sysDir; -#if defined (__APPLE__) +#if defined(__APPLE__) sysDir = GetBundleDirectory(); sysDir += DIR_SEP; sysDir += SYSDATA_DIR; @@ -718,123 +669,114 @@ std::string GetSysDirectory() // Returns a string with a Citra data dir or file in the user's home // directory. To be used in "multi-user" mode (that is, installed). -const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath) -{ +const std::string& GetUserPath(const unsigned int DirIDX, const std::string& newPath) { static std::string paths[NUM_PATH_INDICES]; // Set up all paths and files on the first run - if (paths[D_USER_IDX].empty()) - { + if (paths[D_USER_IDX].empty()) { #ifdef _WIN32 - paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; + paths[D_USER_IDX] = GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP; paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; - paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; + paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; #else if (FileUtil::Exists(ROOT_DIR DIR_SEP USERDATA_DIR)) { - paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; + paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; - paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; + paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; } else { - std::string data_dir = GetUserDirectory("XDG_DATA_HOME"); + std::string data_dir = GetUserDirectory("XDG_DATA_HOME"); std::string config_dir = GetUserDirectory("XDG_CONFIG_HOME"); - std::string cache_dir = GetUserDirectory("XDG_CACHE_HOME"); + std::string cache_dir = GetUserDirectory("XDG_CACHE_HOME"); - paths[D_USER_IDX] = data_dir + DIR_SEP EMU_DATA_DIR DIR_SEP; + paths[D_USER_IDX] = data_dir + DIR_SEP EMU_DATA_DIR DIR_SEP; paths[D_CONFIG_IDX] = config_dir + DIR_SEP EMU_DATA_DIR DIR_SEP; - paths[D_CACHE_IDX] = cache_dir + DIR_SEP EMU_DATA_DIR DIR_SEP; + paths[D_CACHE_IDX] = cache_dir + DIR_SEP EMU_DATA_DIR DIR_SEP; } #endif - paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; - paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; - paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; - paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; - paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; - paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; - paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; - paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; - paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; - paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; - paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; + paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; + paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; + paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; + paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; + paths[D_SYSDATA_IDX] = paths[D_USER_IDX] + SYSDATA_DIR DIR_SEP; + paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; + paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; + paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; + paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; + paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; - paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; } - if (!newPath.empty()) - { - if (!FileUtil::IsDirectory(newPath)) - { + if (!newPath.empty()) { + if (!FileUtil::IsDirectory(newPath)) { LOG_ERROR(Common_Filesystem, "Invalid path specified %s", newPath.c_str()); return paths[DirIDX]; - } - else - { + } else { paths[DirIDX] = newPath; } - switch (DirIDX) - { + switch (DirIDX) { case D_ROOT_IDX: - paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; - paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP; - paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF; + paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; + paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP; + paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF; break; case D_USER_IDX: - paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; - paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; - paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; - paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; - paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; - paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; - paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; - paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; - paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; - paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; - paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; - paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; - paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; - paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP; - paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; + paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; + paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; + paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; + paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; + paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; + paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; + paths[D_NAND_IDX] = paths[D_USER_IDX] + NAND_DIR DIR_SEP; + paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; + paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; + paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; + paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; + paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; + paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP; + paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; - paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; break; case D_CONFIG_IDX: - paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; + paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; - paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; + paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; break; case D_DUMP_IDX: - paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; - paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; - paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; + paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; + paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; + paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; break; case D_LOGS_IDX: - paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; + paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; } } return paths[DirIDX]; } -size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename) -{ +size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) { return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size()); } -size_t ReadFileToString(bool text_file, const char *filename, std::string &str) -{ +size_t ReadFileToString(bool text_file, const char* filename, std::string& str) { IOFile file(filename, text_file ? "r" : "rb"); if (!file) @@ -886,42 +828,36 @@ void SplitFilename83(const std::string& filename, std::array& short_nam } } -IOFile::IOFile() -{ +IOFile::IOFile() { } -IOFile::IOFile(const std::string& filename, const char openmode[]) -{ +IOFile::IOFile(const std::string& filename, const char openmode[]) { Open(filename, openmode); } -IOFile::~IOFile() -{ +IOFile::~IOFile() { Close(); } -IOFile::IOFile(IOFile&& other) -{ +IOFile::IOFile(IOFile&& other) { Swap(other); } -IOFile& IOFile::operator=(IOFile&& other) -{ +IOFile& IOFile::operator=(IOFile&& other) { Swap(other); return *this; } -void IOFile::Swap(IOFile& other) -{ +void IOFile::Swap(IOFile& other) { std::swap(m_file, other.m_file); std::swap(m_good, other.m_good); } -bool IOFile::Open(const std::string& filename, const char openmode[]) -{ +bool IOFile::Open(const std::string& filename, const char openmode[]) { Close(); #ifdef _WIN32 - _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), Common::UTF8ToUTF16W(openmode).c_str()); + _wfopen_s(&m_file, Common::UTF8ToUTF16W(filename).c_str(), + Common::UTF8ToUTF16W(openmode).c_str()); #else m_file = fopen(filename.c_str(), openmode); #endif @@ -930,8 +866,7 @@ bool IOFile::Open(const std::string& filename, const char openmode[]) return m_good; } -bool IOFile::Close() -{ +bool IOFile::Close() { if (!IsOpen() || 0 != std::fclose(m_file)) m_good = false; @@ -939,50 +874,46 @@ bool IOFile::Close() return m_good; } -u64 IOFile::GetSize() const -{ +u64 IOFile::GetSize() const { if (IsOpen()) return FileUtil::GetSize(m_file); return 0; } -bool IOFile::Seek(s64 off, int origin) -{ +bool IOFile::Seek(s64 off, int origin) { if (!IsOpen() || 0 != fseeko(m_file, off, origin)) m_good = false; return m_good; } -u64 IOFile::Tell() const -{ +u64 IOFile::Tell() const { if (IsOpen()) return ftello(m_file); return -1; } -bool IOFile::Flush() -{ +bool IOFile::Flush() { if (!IsOpen() || 0 != std::fflush(m_file)) m_good = false; return m_good; } -bool IOFile::Resize(u64 size) -{ - if (!IsOpen() || 0 != +bool IOFile::Resize(u64 size) { + if (!IsOpen() || + 0 != #ifdef _WIN32 - // ector: _chsize sucks, not 64-bit safe - // F|RES: changed to _chsize_s. i think it is 64-bit safe - _chsize_s(_fileno(m_file), size) + // ector: _chsize sucks, not 64-bit safe + // F|RES: changed to _chsize_s. i think it is 64-bit safe + _chsize_s(_fileno(m_file), size) #else - // TODO: handle 64bit and growing - ftruncate(fileno(m_file), size) + // TODO: handle 64bit and growing + ftruncate(fileno(m_file), size) #endif - ) + ) m_good = false; return m_good; diff --git a/src/common/file_util.h b/src/common/file_util.h index 7ad7ee829..b15021a63 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -5,9 +5,9 @@ #pragma once #include +#include #include #include -#include #include #include #include @@ -51,75 +51,75 @@ enum { NUM_PATH_INDICES }; -namespace FileUtil -{ +namespace FileUtil { // FileSystem tree node/ -struct FSTEntry -{ +struct FSTEntry { bool isDirectory; - u64 size; // file length or number of entries from children - std::string physicalName; // name on disk - std::string virtualName; // name in FST names table + u64 size; // file length or number of entries from children + std::string physicalName; // name on disk + std::string virtualName; // name in FST names table std::vector children; }; // Returns true if file filename exists -bool Exists(const std::string &filename); +bool Exists(const std::string& filename); // Returns true if filename is a directory -bool IsDirectory(const std::string &filename); +bool IsDirectory(const std::string& filename); // Returns the size of filename (64bit) -u64 GetSize(const std::string &filename); +u64 GetSize(const std::string& filename); // Overloaded GetSize, accepts file descriptor u64 GetSize(const int fd); // Overloaded GetSize, accepts FILE* -u64 GetSize(FILE *f); +u64 GetSize(FILE* f); // Returns true if successful, or path already exists. -bool CreateDir(const std::string &filename); +bool CreateDir(const std::string& filename); // Creates the full path of fullPath returns true on success -bool CreateFullPath(const std::string &fullPath); +bool CreateFullPath(const std::string& fullPath); // Deletes a given filename, return true on success // Doesn't supports deleting a directory -bool Delete(const std::string &filename); +bool Delete(const std::string& filename); // Deletes a directory filename, returns true on success -bool DeleteDir(const std::string &filename); +bool DeleteDir(const std::string& filename); // renames file srcFilename to destFilename, returns true on success -bool Rename(const std::string &srcFilename, const std::string &destFilename); +bool Rename(const std::string& srcFilename, const std::string& destFilename); // copies file srcFilename to destFilename, returns true on success -bool Copy(const std::string &srcFilename, const std::string &destFilename); +bool Copy(const std::string& srcFilename, const std::string& destFilename); // creates an empty file filename, returns true on success -bool CreateEmptyFile(const std::string &filename); +bool CreateEmptyFile(const std::string& filename); /** - * @param num_entries_out to be assigned by the callable with the number of iterated directory entries, never null + * @param num_entries_out to be assigned by the callable with the number of iterated directory + * entries, never null * @param directory the path to the enclosing directory * @param virtual_name the entry name, without any preceding directory info * @return whether handling the entry succeeded */ -using DirectoryEntryCallable = std::function; +using DirectoryEntryCallable = std::function; /** * Scans a directory, calling the callback for each file/directory contained within. * If the callback returns failure, scanning halts and this function returns failure as well - * @param num_entries_out assigned by the function with the number of iterated directory entries, can be null + * @param num_entries_out assigned by the function with the number of iterated directory entries, + * can be null * @param directory the directory to scan * @param callback The callback which will be called for each entry * @return whether scanning the directory succeeded */ -bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directory, DirectoryEntryCallable callback); +bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, + DirectoryEntryCallable callback); /** * Scans the directory tree, storing the results. @@ -128,23 +128,24 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo * @param recursion Number of children directories to read before giving up. * @return the total number of files/directories found */ -unsigned ScanDirectoryTree(const std::string &directory, FSTEntry& parent_entry, unsigned int recursion = 0); +unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, + unsigned int recursion = 0); // deletes the given directory and anything under it. Returns true on success. -bool DeleteDirRecursively(const std::string &directory, unsigned int recursion = 256); +bool DeleteDirRecursively(const std::string& directory, unsigned int recursion = 256); // Returns the current directory std::string GetCurrentDir(); // Create directory and copy contents (does not overwrite existing files) -void CopyDir(const std::string &source_path, const std::string &dest_path); +void CopyDir(const std::string& source_path, const std::string& dest_path); // Set the current directory to given directory -bool SetCurrentDir(const std::string &directory); +bool SetCurrentDir(const std::string& directory); // Returns a pointer to a string with a Citra data dir in the user's home // directory. To be used in "multi-user" mode (that is, installed). -const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath=""); +const std::string& GetUserPath(const unsigned int DirIDX, const std::string& newPath = ""); // Returns the path to where the sys file are std::string GetSysDirectory(); @@ -154,11 +155,11 @@ std::string GetBundleDirectory(); #endif #ifdef _WIN32 -std::string &GetExeDirectory(); +std::string& GetExeDirectory(); #endif -size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename); -size_t ReadFileToString(bool text_file, const char *filename, std::string &str); +size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename); +size_t ReadFileToString(bool text_file, const char* filename, std::string& str); /** * Splits the filename into 8.3 format @@ -173,8 +174,7 @@ void SplitFilename83(const std::string& filename, std::array& short_nam // simple wrapper for cstdlib file functions to // hopefully will make error checking easier // and make forgetting an fclose() harder -class IOFile : public NonCopyable -{ +class IOFile : public NonCopyable { public: IOFile(); IOFile(const std::string& filename, const char openmode[]); @@ -190,11 +190,12 @@ public: bool Close(); template - size_t ReadArray(T* data, size_t length) - { - static_assert(std::is_standard_layout(), "Given array does not consist of standard layout objects"); + size_t ReadArray(T* data, size_t length) { + static_assert(std::is_standard_layout(), + "Given array does not consist of standard layout objects"); #if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER) - static_assert(std::is_trivially_copyable(), "Given array does not consist of trivially copyable objects"); + static_assert(std::is_trivially_copyable(), + "Given array does not consist of trivially copyable objects"); #endif if (!IsOpen()) { @@ -210,11 +211,12 @@ public: } template - size_t WriteArray(const T* data, size_t length) - { - static_assert(std::is_standard_layout(), "Given array does not consist of standard layout objects"); + size_t WriteArray(const T* data, size_t length) { + static_assert(std::is_standard_layout(), + "Given array does not consist of standard layout objects"); #if (__GNUC__ >= 5) || defined(__clang__) || defined(_MSC_VER) - static_assert(std::is_trivially_copyable(), "Given array does not consist of trivially copyable objects"); + static_assert(std::is_trivially_copyable(), + "Given array does not consist of trivially copyable objects"); #endif if (!IsOpen()) { @@ -229,27 +231,31 @@ public: return items_written; } - size_t ReadBytes(void* data, size_t length) - { + size_t ReadBytes(void* data, size_t length) { return ReadArray(reinterpret_cast(data), length); } - size_t WriteBytes(const void* data, size_t length) - { + size_t WriteBytes(const void* data, size_t length) { return WriteArray(reinterpret_cast(data), length); } - template + template size_t WriteObject(const T& object) { static_assert(!std::is_pointer::value, "Given object is a pointer"); return WriteArray(&object, 1); } - bool IsOpen() const { return nullptr != m_file; } + bool IsOpen() const { + return nullptr != m_file; + } // m_good is set to false when a read, write or other function fails - bool IsGood() const { return m_good; } - explicit operator bool() const { return IsGood(); } + bool IsGood() const { + return m_good; + } + explicit operator bool() const { + return IsGood(); + } bool Seek(s64 off, int origin); u64 Tell() const; @@ -258,19 +264,21 @@ public: bool Flush(); // clear error state - void Clear() { m_good = true; std::clearerr(m_file); } + void Clear() { + m_good = true; + std::clearerr(m_file); + } private: std::FILE* m_file = nullptr; bool m_good = true; }; -} // namespace +} // namespace // To deal with Windows being dumb at unicode: template -void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) -{ +void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode) { #ifdef _MSC_VER fstream.open(Common::UTF8ToTStr(filename).c_str(), openmode); #else diff --git a/src/common/hash.cpp b/src/common/hash.cpp index c49c2f60e..a46c92553 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -36,7 +36,7 @@ static FORCE_INLINE u64 fmix64(u64 k) { // platforms (MurmurHash3_x64_128). It was taken from: // https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp void MurmurHash3_128(const void* key, int len, u32 seed, void* out) { - const u8 * data = (const u8*)key; + const u8* data = (const u8*)key; const int nblocks = len / 16; u64 h1 = seed; @@ -47,52 +47,84 @@ void MurmurHash3_128(const void* key, int len, u32 seed, void* out) { // Body - const u64 * blocks = (const u64 *)(data); + const u64* blocks = (const u64*)(data); for (int i = 0; i < nblocks; i++) { - u64 k1 = getblock64(blocks,i*2+0); - u64 k2 = getblock64(blocks,i*2+1); - - k1 *= c1; k1 = _rotl64(k1,31); k1 *= c2; h1 ^= k1; - - h1 = _rotl64(h1,27); h1 += h2; h1 = h1*5+0x52dce729; - - k2 *= c2; k2 = _rotl64(k2,33); k2 *= c1; h2 ^= k2; - - h2 = _rotl64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5; + u64 k1 = getblock64(blocks, i * 2 + 0); + u64 k2 = getblock64(blocks, i * 2 + 1); + + k1 *= c1; + k1 = _rotl64(k1, 31); + k1 *= c2; + h1 ^= k1; + + h1 = _rotl64(h1, 27); + h1 += h2; + h1 = h1 * 5 + 0x52dce729; + + k2 *= c2; + k2 = _rotl64(k2, 33); + k2 *= c1; + h2 ^= k2; + + h2 = _rotl64(h2, 31); + h2 += h1; + h2 = h2 * 5 + 0x38495ab5; } // Tail - const u8 * tail = (const u8*)(data + nblocks*16); + const u8* tail = (const u8*)(data + nblocks * 16); u64 k1 = 0; u64 k2 = 0; switch (len & 15) { - case 15: k2 ^= ((u64)tail[14]) << 48; - case 14: k2 ^= ((u64)tail[13]) << 40; - case 13: k2 ^= ((u64)tail[12]) << 32; - case 12: k2 ^= ((u64)tail[11]) << 24; - case 11: k2 ^= ((u64)tail[10]) << 16; - case 10: k2 ^= ((u64)tail[ 9]) << 8; - case 9: k2 ^= ((u64)tail[ 8]) << 0; - k2 *= c2; k2 = _rotl64(k2,33); k2 *= c1; h2 ^= k2; - - case 8: k1 ^= ((u64)tail[ 7]) << 56; - case 7: k1 ^= ((u64)tail[ 6]) << 48; - case 6: k1 ^= ((u64)tail[ 5]) << 40; - case 5: k1 ^= ((u64)tail[ 4]) << 32; - case 4: k1 ^= ((u64)tail[ 3]) << 24; - case 3: k1 ^= ((u64)tail[ 2]) << 16; - case 2: k1 ^= ((u64)tail[ 1]) << 8; - case 1: k1 ^= ((u64)tail[ 0]) << 0; - k1 *= c1; k1 = _rotl64(k1,31); k1 *= c2; h1 ^= k1; + case 15: + k2 ^= ((u64)tail[14]) << 48; + case 14: + k2 ^= ((u64)tail[13]) << 40; + case 13: + k2 ^= ((u64)tail[12]) << 32; + case 12: + k2 ^= ((u64)tail[11]) << 24; + case 11: + k2 ^= ((u64)tail[10]) << 16; + case 10: + k2 ^= ((u64)tail[9]) << 8; + case 9: + k2 ^= ((u64)tail[8]) << 0; + k2 *= c2; + k2 = _rotl64(k2, 33); + k2 *= c1; + h2 ^= k2; + + case 8: + k1 ^= ((u64)tail[7]) << 56; + case 7: + k1 ^= ((u64)tail[6]) << 48; + case 6: + k1 ^= ((u64)tail[5]) << 40; + case 5: + k1 ^= ((u64)tail[4]) << 32; + case 4: + k1 ^= ((u64)tail[3]) << 24; + case 3: + k1 ^= ((u64)tail[2]) << 16; + case 2: + k1 ^= ((u64)tail[1]) << 8; + case 1: + k1 ^= ((u64)tail[0]) << 0; + k1 *= c1; + k1 = _rotl64(k1, 31); + k1 *= c2; + h1 ^= k1; }; // Finalization - h1 ^= len; h2 ^= len; + h1 ^= len; + h2 ^= len; h1 += h2; h2 += h1; diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp index ad311d66b..e882f5f52 100644 --- a/src/common/key_map.cpp +++ b/src/common/key_map.cpp @@ -13,11 +13,25 @@ namespace KeyMap { // and map it directly to EmuWindow::ButtonPressed. // It should go the analog input way like circle pad does. const std::array mapping_targets = {{ - Service::HID::PAD_A, Service::HID::PAD_B, Service::HID::PAD_X, Service::HID::PAD_Y, - Service::HID::PAD_L, Service::HID::PAD_R, Service::HID::PAD_ZL, Service::HID::PAD_ZR, - Service::HID::PAD_START, Service::HID::PAD_SELECT, Service::HID::PAD_NONE, - Service::HID::PAD_UP, Service::HID::PAD_DOWN, Service::HID::PAD_LEFT, Service::HID::PAD_RIGHT, - Service::HID::PAD_C_UP, Service::HID::PAD_C_DOWN, Service::HID::PAD_C_LEFT, Service::HID::PAD_C_RIGHT, + Service::HID::PAD_A, + Service::HID::PAD_B, + Service::HID::PAD_X, + Service::HID::PAD_Y, + Service::HID::PAD_L, + Service::HID::PAD_R, + Service::HID::PAD_ZL, + Service::HID::PAD_ZR, + Service::HID::PAD_START, + Service::HID::PAD_SELECT, + Service::HID::PAD_NONE, + Service::HID::PAD_UP, + Service::HID::PAD_DOWN, + Service::HID::PAD_LEFT, + Service::HID::PAD_RIGHT, + Service::HID::PAD_C_UP, + Service::HID::PAD_C_DOWN, + Service::HID::PAD_C_LEFT, + Service::HID::PAD_C_RIGHT, IndirectTarget::CirclePadUp, IndirectTarget::CirclePadDown, @@ -49,7 +63,8 @@ static void UpdateCirclePad(EmuWindow& emu_window) { --y; float modifier = circle_pad_modifier ? Settings::values.pad_circle_modifier_scale : 1.0; - emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF), y * modifier * (x == 0 ? 1.0 : SQRT_HALF)); + emu_window.CirclePadUpdated(x * modifier * (y == 0 ? 1.0 : SQRT_HALF), + y * modifier * (x == 0 ? 1.0 : SQRT_HALF)); } int NewDeviceId() { @@ -103,7 +118,7 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key) { } } -void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) { +void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key) { auto target = key_map.find(key); if (target == key_map.end()) return; @@ -135,5 +150,4 @@ void ReleaseKey(EmuWindow& emu_window,HostDeviceKey key) { } } } - } diff --git a/src/common/key_map.h b/src/common/key_map.h index b62f017c6..040794578 100644 --- a/src/common/key_map.h +++ b/src/common/key_map.h @@ -55,14 +55,12 @@ struct HostDeviceKey { int key_code; int device_id; ///< Uniquely identifies a host device - bool operator<(const HostDeviceKey &other) const { - return std::tie(key_code, device_id) < - std::tie(other.key_code, other.device_id); + bool operator<(const HostDeviceKey& other) const { + return std::tie(key_code, device_id) < std::tie(other.key_code, other.device_id); } - bool operator==(const HostDeviceKey &other) const { - return std::tie(key_code, device_id) == - std::tie(other.key_code, other.device_id); + bool operator==(const HostDeviceKey& other) const { + return std::tie(key_code, device_id) == std::tie(other.key_code, other.device_id); } }; @@ -92,5 +90,4 @@ void PressKey(EmuWindow& emu_window, HostDeviceKey key); * Maps a key release action and call the corresponding function in EmuWindow */ void ReleaseKey(EmuWindow& emu_window, HostDeviceKey key); - } diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h index 48529cf42..94c695163 100644 --- a/src/common/linear_disk_cache.h +++ b/src/common/linear_disk_cache.h @@ -4,31 +4,30 @@ #pragma once -#include "common/common_types.h" #include +#include "common/common_types.h" // defined in Version.cpp -extern const char *scm_rev_git_str; +extern const char* scm_rev_git_str; // On disk format: -//header{ +// header{ // u32 'DCAC'; // u32 version; // svn_rev // u16 sizeof(key_type); // u16 sizeof(value_type); //} -//key_value_pair{ +// key_value_pair{ // u32 value_size; // key_type key; // value_type[value_size] value; //} template -class LinearDiskCacheReader -{ +class LinearDiskCacheReader { public: - virtual void Read(const K &key, const V *value, u32 value_size) = 0; + virtual void Read(const K& key, const V* value, u32 value_size) = 0; }; // Dead simple unsorted key-value store with append functionality. @@ -44,12 +43,10 @@ public: // K : the key type // V : value array type template -class LinearDiskCache -{ +class LinearDiskCache { public: // return number of read entries - u32 OpenAndRead(const char *filename, LinearDiskCacheReader &reader) - { + u32 OpenAndRead(const char* filename, LinearDiskCacheReader& reader) { using std::ios_base; // close any currently opened file @@ -65,20 +62,19 @@ public: std::fstream::pos_type start_pos = m_file.tellg(); std::streamoff file_size = end_pos - start_pos; - if (m_file.is_open() && ValidateHeader()) - { + if (m_file.is_open() && ValidateHeader()) { // good header, read some key/value pairs K key; - V *value = nullptr; + V* value = nullptr; u32 value_size; u32 entry_number; std::fstream::pos_type last_pos = m_file.tellg(); - while (Read(&value_size)) - { - std::streamoff next_extent = (last_pos - start_pos) + sizeof(value_size) + value_size; + while (Read(&value_size)) { + std::streamoff next_extent = + (last_pos - start_pos) + sizeof(value_size) + value_size; if (next_extent > file_size) break; @@ -86,15 +82,10 @@ public: value = new V[value_size]; // read key/value and pass to reader - if (Read(&key) && - Read(value, value_size) && - Read(&entry_number) && - entry_number == m_num_entries+1) - { + if (Read(&key) && Read(value, value_size) && Read(&entry_number) && + entry_number == m_num_entries + 1) { reader.Read(key, value, value_size); - } - else - { + } else { break; } @@ -116,13 +107,11 @@ public: return 0; } - void Sync() - { + void Sync() { m_file.flush(); } - void Close() - { + void Close() { if (m_file.is_open()) m_file.close(); // clear any error flags @@ -130,9 +119,9 @@ public: } // Appends a key-value pair to the store. - void Append(const K &key, const V *value, u32 value_size) - { - // TODO: Should do a check that we don't already have "key"? (I think each caller does that already.) + void Append(const K& key, const V* value, u32 value_size) { + // TODO: Should do a check that we don't already have "key"? (I think each caller does that + // already.) Write(&value_size); Write(&key); Write(value, value_size); @@ -141,38 +130,29 @@ public: } private: - void WriteHeader() - { + void WriteHeader() { Write(&m_header); } - bool ValidateHeader() - { + bool ValidateHeader() { char file_header[sizeof(Header)]; - return (Read(file_header, sizeof(Header)) - && !memcmp((const char*)&m_header, file_header, sizeof(Header))); + return (Read(file_header, sizeof(Header)) && + !memcmp((const char*)&m_header, file_header, sizeof(Header))); } template - bool Write(const D *data, u32 count = 1) - { + bool Write(const D* data, u32 count = 1) { return m_file.write((const char*)data, count * sizeof(D)).good(); } template - bool Read(const D *data, u32 count = 1) - { + bool Read(const D* data, u32 count = 1) { return m_file.read((char*)data, count * sizeof(D)).good(); } - struct Header - { - Header() - : id(*(u32*)"DCAC") - , key_t_size(sizeof(K)) - , value_t_size(sizeof(V)) - { + struct Header { + Header() : id(*(u32*)"DCAC"), key_t_size(sizeof(K)), value_t_size(sizeof(V)) { memcpy(ver, scm_rev_git_str, 40); } diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 0b2fabec9..b3d6598e4 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -16,73 +16,79 @@ namespace Log { /// Macro listing all log classes. Code should define CLS and SUB as desired before invoking this. -#define ALL_LOG_CLASSES() \ - CLS(Log) \ - CLS(Common) \ - SUB(Common, Filesystem) \ - SUB(Common, Memory) \ - CLS(Core) \ - SUB(Core, ARM11) \ - SUB(Core, Timing) \ - CLS(Config) \ - CLS(Debug) \ - SUB(Debug, Emulated) \ - SUB(Debug, GPU) \ - SUB(Debug, Breakpoint) \ - SUB(Debug, GDBStub) \ - CLS(Kernel) \ - SUB(Kernel, SVC) \ - CLS(Service) \ - SUB(Service, SRV) \ - SUB(Service, FRD) \ - SUB(Service, FS) \ - SUB(Service, ERR) \ - SUB(Service, APT) \ - SUB(Service, GSP) \ - SUB(Service, AC) \ - SUB(Service, AM) \ - SUB(Service, PTM) \ - SUB(Service, LDR) \ - SUB(Service, NDM) \ - SUB(Service, NIM) \ - SUB(Service, NWM) \ - SUB(Service, CAM) \ - SUB(Service, CECD) \ - SUB(Service, CFG) \ - SUB(Service, DSP) \ - SUB(Service, DLP) \ - SUB(Service, HID) \ - SUB(Service, SOC) \ - SUB(Service, IR) \ - SUB(Service, Y2R) \ - CLS(HW) \ - SUB(HW, Memory) \ - SUB(HW, LCD) \ - SUB(HW, GPU) \ - CLS(Frontend) \ - CLS(Render) \ - SUB(Render, Software) \ - SUB(Render, OpenGL) \ - CLS(Audio) \ - SUB(Audio, DSP) \ - SUB(Audio, Sink) \ - CLS(Loader) +#define ALL_LOG_CLASSES() \ + CLS(Log) \ + CLS(Common) \ + SUB(Common, Filesystem) \ + SUB(Common, Memory) \ + CLS(Core) \ + SUB(Core, ARM11) \ + SUB(Core, Timing) \ + CLS(Config) \ + CLS(Debug) \ + SUB(Debug, Emulated) \ + SUB(Debug, GPU) \ + SUB(Debug, Breakpoint) \ + SUB(Debug, GDBStub) \ + CLS(Kernel) \ + SUB(Kernel, SVC) \ + CLS(Service) \ + SUB(Service, SRV) \ + SUB(Service, FRD) \ + SUB(Service, FS) \ + SUB(Service, ERR) \ + SUB(Service, APT) \ + SUB(Service, GSP) \ + SUB(Service, AC) \ + SUB(Service, AM) \ + SUB(Service, PTM) \ + SUB(Service, LDR) \ + SUB(Service, NDM) \ + SUB(Service, NIM) \ + SUB(Service, NWM) \ + SUB(Service, CAM) \ + SUB(Service, CECD) \ + SUB(Service, CFG) \ + SUB(Service, DSP) \ + SUB(Service, DLP) \ + SUB(Service, HID) \ + SUB(Service, SOC) \ + SUB(Service, IR) \ + SUB(Service, Y2R) \ + CLS(HW) \ + SUB(HW, Memory) \ + SUB(HW, LCD) \ + SUB(HW, GPU) \ + CLS(Frontend) \ + CLS(Render) \ + SUB(Render, Software) \ + SUB(Render, OpenGL) \ + CLS(Audio) \ + SUB(Audio, DSP) \ + SUB(Audio, Sink) \ + CLS(Loader) // GetClassName is a macro defined by Windows.h, grrr... const char* GetLogClassName(Class log_class) { switch (log_class) { -#define CLS(x) case Class::x: return #x; -#define SUB(x, y) case Class::x##_##y: return #x "." #y; +#define CLS(x) \ + case Class::x: \ + return #x; +#define SUB(x, y) \ + case Class::x##_##y: \ + return #x "." #y; ALL_LOG_CLASSES() #undef CLS #undef SUB - case Class::Count: - UNREACHABLE(); + case Class::Count: + UNREACHABLE(); } } const char* GetLevelName(Level log_level) { -#define LVL(x) case Level::x: return #x +#define LVL(x) \ + case Level::x: \ + return #x switch (log_level) { LVL(Trace); LVL(Debug); @@ -90,15 +96,14 @@ const char* GetLevelName(Level log_level) { LVL(Warning); LVL(Error); LVL(Critical); - case Level::Count: - UNREACHABLE(); + case Level::Count: + UNREACHABLE(); } #undef LVL } -Entry CreateEntry(Class log_class, Level log_level, - const char* filename, unsigned int line_nr, const char* function, - const char* format, va_list args) { +Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, + const char* function, const char* format, va_list args) { using std::chrono::steady_clock; using std::chrono::duration_cast; @@ -111,7 +116,8 @@ Entry CreateEntry(Class log_class, Level log_level, entry.log_class = log_class; entry.log_level = log_level; - snprintf(formatting_buffer.data(), formatting_buffer.size(), "%s:%s:%u", filename, function, line_nr); + snprintf(formatting_buffer.data(), formatting_buffer.size(), "%s:%s:%u", filename, function, + line_nr); entry.location = std::string(formatting_buffer.data()); vsnprintf(formatting_buffer.data(), formatting_buffer.size(), format, args); @@ -126,19 +132,16 @@ void SetFilter(Filter* new_filter) { filter = new_filter; } -void LogMessage(Class log_class, Level log_level, - const char* filename, unsigned int line_nr, const char* function, - const char* format, ...) { +void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_nr, + const char* function, const char* format, ...) { if (filter != nullptr && !filter->CheckMessage(log_class, log_level)) return; va_list args; va_start(args, format); - Entry entry = CreateEntry(log_class, log_level, - filename, line_nr, function, format, args); + Entry entry = CreateEntry(log_class, log_level, filename, line_nr, function, format, args); va_end(args); PrintColoredMessage(entry); } - } diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index 795d42ebd..3fe88e4f6 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h @@ -44,10 +44,8 @@ const char* GetLogClassName(Class log_class); const char* GetLevelName(Level log_level); /// Creates a log entry by formatting the given source location, and message. -Entry CreateEntry(Class log_class, Level log_level, - const char* filename, unsigned int line_nr, const char* function, - const char* format, va_list args); +Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr, + const char* function, const char* format, va_list args); void SetFilter(Filter* filter); - } diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 55cc8888a..186e0b621 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -4,8 +4,8 @@ #include -#include "common/logging/filter.h" #include "common/logging/backend.h" +#include "common/logging/filter.h" #include "common/string_util.h" namespace Log { @@ -63,11 +63,11 @@ static Class GetClassByName(const It begin, const It end) { } bool Filter::ParseFilterRule(const std::string::const_iterator begin, - const std::string::const_iterator end) { + const std::string::const_iterator end) { auto level_separator = std::find(begin, end, ':'); if (level_separator == end) { LOG_ERROR(Log, "Invalid log filter. Must specify a log level after `:`: %s", - std::string(begin, end).c_str()); + std::string(begin, end).c_str()); return false; } @@ -95,5 +95,4 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin, bool Filter::CheckMessage(Class log_class, Level level) const { return static_cast(level) >= static_cast(class_levels[static_cast(log_class)]); } - } diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index a2b4eca43..db526fead 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h @@ -42,7 +42,8 @@ public: * - `Service.FS:Trace` -- Sets the level of the Service.FS class to Trace. */ void ParseFilterString(const std::string& filter_str); - bool ParseFilterRule(const std::string::const_iterator start, const std::string::const_iterator end); + bool ParseFilterRule(const std::string::const_iterator start, + const std::string::const_iterator end); /// Matches class/level combination against the filter, returning true if it passed. bool CheckMessage(Class log_class, Level level) const; @@ -50,5 +51,4 @@ public: private: std::array class_levels; }; - } diff --git a/src/common/logging/log.h b/src/common/logging/log.h index c6910b1c7..a4b4750de 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -28,71 +28,73 @@ typedef u8 ClassType; /** * Specifies the sub-system that generated the log message. * - * @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in backend.cpp. + * @note If you add a new entry here, also add a corresponding one to `ALL_LOG_CLASSES` in + * backend.cpp. */ enum class Class : ClassType { - Log, ///< Messages about the log system itself - Common, ///< Library routines - Common_Filesystem, ///< Filesystem interface library - Common_Memory, ///< Memory mapping and management functions - Core, ///< LLE emulation core - Core_ARM11, ///< ARM11 CPU core - Core_Timing, ///< CoreTiming functions - Config, ///< Emulator configuration (including commandline) - Debug, ///< Debugging tools - Debug_Emulated, ///< Debug messages from the emulated programs - Debug_GPU, ///< GPU debugging tools - Debug_Breakpoint, ///< Logging breakpoints and watchpoints - Debug_GDBStub, ///< GDB Stub - Kernel, ///< The HLE implementation of the CTR kernel - Kernel_SVC, ///< Kernel system calls - Service, ///< HLE implementation of system services. Each major service - /// should have its own subclass. - Service_SRV, ///< The SRV (Service Directory) implementation - Service_FRD, ///< The FRD (Friends) service - Service_FS, ///< The FS (Filesystem) service implementation - Service_ERR, ///< The ERR (Error) port implementation - Service_APT, ///< The APT (Applets) service - Service_GSP, ///< The GSP (GPU control) service - Service_AC, ///< The AC (WiFi status) service - Service_AM, ///< The AM (Application manager) service - Service_PTM, ///< The PTM (Power status & misc.) service - Service_LDR, ///< The LDR (3ds dll loader) service - Service_NDM, ///< The NDM (Network daemon manager) service - Service_NIM, ///< The NIM (Network interface manager) service - Service_NWM, ///< The NWM (Network wlan manager) service - Service_CAM, ///< The CAM (Camera) service - Service_CECD, ///< The CECD (StreetPass) service - Service_CFG, ///< The CFG (Configuration) service - Service_DSP, ///< The DSP (DSP control) service - Service_DLP, ///< The DLP (Download Play) service - Service_HID, ///< The HID (Human interface device) service - Service_SOC, ///< The SOC (Socket) service - Service_IR, ///< The IR service - Service_Y2R, ///< The Y2R (YUV to RGB conversion) service - HW, ///< Low-level hardware emulation - HW_Memory, ///< Memory-map and address translation - HW_LCD, ///< LCD register emulation - HW_GPU, ///< GPU control emulation - Frontend, ///< Emulator UI - Render, ///< Emulator video output and hardware acceleration - Render_Software, ///< Software renderer backend - Render_OpenGL, ///< OpenGL backend - Audio, ///< Audio emulation - Audio_DSP, ///< The HLE implementation of the DSP - Audio_Sink, ///< Emulator audio output backend - Loader, ///< ROM loader + Log, ///< Messages about the log system itself + Common, ///< Library routines + Common_Filesystem, ///< Filesystem interface library + Common_Memory, ///< Memory mapping and management functions + Core, ///< LLE emulation core + Core_ARM11, ///< ARM11 CPU core + Core_Timing, ///< CoreTiming functions + Config, ///< Emulator configuration (including commandline) + Debug, ///< Debugging tools + Debug_Emulated, ///< Debug messages from the emulated programs + Debug_GPU, ///< GPU debugging tools + Debug_Breakpoint, ///< Logging breakpoints and watchpoints + Debug_GDBStub, ///< GDB Stub + Kernel, ///< The HLE implementation of the CTR kernel + Kernel_SVC, ///< Kernel system calls + Service, ///< HLE implementation of system services. Each major service + /// should have its own subclass. + Service_SRV, ///< The SRV (Service Directory) implementation + Service_FRD, ///< The FRD (Friends) service + Service_FS, ///< The FS (Filesystem) service implementation + Service_ERR, ///< The ERR (Error) port implementation + Service_APT, ///< The APT (Applets) service + Service_GSP, ///< The GSP (GPU control) service + Service_AC, ///< The AC (WiFi status) service + Service_AM, ///< The AM (Application manager) service + Service_PTM, ///< The PTM (Power status & misc.) service + Service_LDR, ///< The LDR (3ds dll loader) service + Service_NDM, ///< The NDM (Network daemon manager) service + Service_NIM, ///< The NIM (Network interface manager) service + Service_NWM, ///< The NWM (Network wlan manager) service + Service_CAM, ///< The CAM (Camera) service + Service_CECD, ///< The CECD (StreetPass) service + Service_CFG, ///< The CFG (Configuration) service + Service_DSP, ///< The DSP (DSP control) service + Service_DLP, ///< The DLP (Download Play) service + Service_HID, ///< The HID (Human interface device) service + Service_SOC, ///< The SOC (Socket) service + Service_IR, ///< The IR service + Service_Y2R, ///< The Y2R (YUV to RGB conversion) service + HW, ///< Low-level hardware emulation + HW_Memory, ///< Memory-map and address translation + HW_LCD, ///< LCD register emulation + HW_GPU, ///< GPU control emulation + Frontend, ///< Emulator UI + Render, ///< Emulator video output and hardware acceleration + Render_Software, ///< Software renderer backend + Render_OpenGL, ///< OpenGL backend + Audio, ///< Audio emulation + Audio_DSP, ///< The HLE implementation of the DSP + Audio_Sink, ///< Emulator audio output backend + Loader, ///< ROM loader Count ///< Total number of logging classes }; /// Logs a message to the global logger. -void LogMessage(Class log_class, Level log_level, - const char* filename, unsigned int line_nr, const char* function, +void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_nr, + const char* function, #ifdef _MSC_VER - _Printf_format_string_ + _Printf_format_string_ #endif - const char* format, ...) + const char* format, + ...) #ifdef __GNUC__ __attribute__((format(printf, 6, 7))) #endif @@ -100,17 +102,23 @@ void LogMessage(Class log_class, Level log_level, } // namespace Log -#define LOG_GENERIC(log_class, log_level, ...) \ +#define LOG_GENERIC(log_class, log_level, ...) \ ::Log::LogMessage(log_class, log_level, __FILE__, __LINE__, __func__, __VA_ARGS__) #ifdef _DEBUG -#define LOG_TRACE( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__) +#define LOG_TRACE(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Trace, __VA_ARGS__) #else -#define LOG_TRACE( log_class, ...) (void(0)) +#define LOG_TRACE(log_class, ...) (void(0)) #endif -#define LOG_DEBUG( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__) -#define LOG_INFO( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__) -#define LOG_WARNING( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__) -#define LOG_ERROR( log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) -#define LOG_CRITICAL(log_class, ...) LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) +#define LOG_DEBUG(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Debug, __VA_ARGS__) +#define LOG_INFO(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Info, __VA_ARGS__) +#define LOG_WARNING(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Warning, __VA_ARGS__) +#define LOG_ERROR(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) +#define LOG_CRITICAL(log_class, ...) \ + LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index de195b0f7..955358553 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -6,8 +6,8 @@ #include #ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include +#define WIN32_LEAN_AND_MEAN +#include #endif #include "common/logging/backend.h" @@ -44,15 +44,14 @@ const char* TrimSourcePath(const char* path, const char* root) { } void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len) { - unsigned int time_seconds = static_cast(entry.timestamp.count() / 1000000); + unsigned int time_seconds = static_cast(entry.timestamp.count() / 1000000); unsigned int time_fractional = static_cast(entry.timestamp.count() % 1000000); const char* class_name = GetLogClassName(entry.log_class); const char* level_name = GetLevelName(entry.log_level); - snprintf(out_text, text_len, "[%4u.%06u] %s <%s> %s: %s", - time_seconds, time_fractional, class_name, level_name, - TrimSourcePath(entry.location.c_str()), entry.message.c_str()); + snprintf(out_text, text_len, "[%4u.%06u] %s <%s> %s: %s", time_seconds, time_fractional, + class_name, level_name, TrimSourcePath(entry.location.c_str()), entry.message.c_str()); } void PrintMessage(const Entry& entry) { @@ -72,38 +71,50 @@ void PrintColoredMessage(const Entry& entry) { WORD color = 0; switch (entry.log_level) { case Level::Trace: // Grey - color = FOREGROUND_INTENSITY; break; + color = FOREGROUND_INTENSITY; + break; case Level::Debug: // Cyan - color = FOREGROUND_GREEN | FOREGROUND_BLUE; break; + color = FOREGROUND_GREEN | FOREGROUND_BLUE; + break; case Level::Info: // Bright gray - color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break; + color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; + break; case Level::Warning: // Bright yellow - color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; break; + color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; + break; case Level::Error: // Bright red - color = FOREGROUND_RED | FOREGROUND_INTENSITY; break; + color = FOREGROUND_RED | FOREGROUND_INTENSITY; + break; case Level::Critical: // Bright magenta - color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break; + color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; + break; case Level::Count: UNREACHABLE(); } SetConsoleTextAttribute(console_handle, color); #else -# define ESC "\x1b" +#define ESC "\x1b" const char* color = ""; switch (entry.log_level) { case Level::Trace: // Grey - color = ESC "[1;30m"; break; + color = ESC "[1;30m"; + break; case Level::Debug: // Cyan - color = ESC "[0;36m"; break; + color = ESC "[0;36m"; + break; case Level::Info: // Bright gray - color = ESC "[0;37m"; break; + color = ESC "[0;37m"; + break; case Level::Warning: // Bright yellow - color = ESC "[1;33m"; break; + color = ESC "[1;33m"; + break; case Level::Error: // Bright red - color = ESC "[1;31m"; break; + color = ESC "[1;31m"; + break; case Level::Critical: // Bright magenta - color = ESC "[1;35m"; break; + color = ESC "[1;35m"; + break; case Level::Count: UNREACHABLE(); } @@ -117,8 +128,7 @@ void PrintColoredMessage(const Entry& entry) { SetConsoleTextAttribute(console_handle, original_info.wAttributes); #else fputs(ESC "[0m", stderr); -# undef ESC +#undef ESC #endif } - } diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h index 5b82f043f..0da102bc6 100644 --- a/src/common/logging/text_formatter.h +++ b/src/common/logging/text_formatter.h @@ -28,5 +28,4 @@ void FormatLogMessage(const Entry& entry, char* out_text, size_t text_len); void PrintMessage(const Entry& entry); /// Prints the same message as `PrintMessage`, but colored acoording to the severity level. void PrintColoredMessage(const Entry& entry); - } diff --git a/src/common/math_util.h b/src/common/math_util.h index d44b06e74..696bd43ea 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -8,33 +8,38 @@ #include #include -namespace MathUtil -{ +namespace MathUtil { -inline bool IntervalsIntersect(unsigned start0, unsigned length0, unsigned start1, unsigned length1) { +inline bool IntervalsIntersect(unsigned start0, unsigned length0, unsigned start1, + unsigned length1) { return (std::max(start0, start1) < std::min(start0 + length0, start1 + length1)); } -template -inline T Clamp(const T val, const T& min, const T& max) -{ +template +inline T Clamp(const T val, const T& min, const T& max) { return std::max(min, std::min(max, val)); } -template -struct Rectangle -{ +template +struct Rectangle { T left; T top; T right; T bottom; - Rectangle() {} + Rectangle() { + } - Rectangle(T left, T top, T right, T bottom) : left(left), top(top), right(right), bottom(bottom) {} + Rectangle(T left, T top, T right, T bottom) + : left(left), top(top), right(right), bottom(bottom) { + } - T GetWidth() const { return std::abs(static_cast::type>(right - left)); } - T GetHeight() const { return std::abs(static_cast::type>(bottom - top)); } + T GetWidth() const { + return std::abs(static_cast::type>(right - left)); + } + T GetHeight() const { + return std::abs(static_cast::type>(bottom - top)); + } }; -} // namespace MathUtil +} // namespace MathUtil diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 07c7f79c8..7d352f00f 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -2,31 +2,29 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - -#include "common/logging/log.h" #include "common/memory_util.h" +#include "common/logging/log.h" #ifdef _WIN32 - #include - #include - #include "common/common_funcs.h" - #include "common/string_util.h" +#include +#include +#include "common/common_funcs.h" +#include "common/string_util.h" #else - #include - #include +#include +#include #endif #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) #include -#define PAGE_MASK (getpagesize() - 1) +#define PAGE_MASK (getpagesize() - 1) #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) #endif // This is purposely not a full wrapper for virtualalloc/mmap, but it // provides exactly the primitive operations that Dolphin needs. -void* AllocateExecutableMemory(size_t size, bool low) -{ +void* AllocateExecutableMemory(size_t size, bool low) { #if defined(_WIN32) void* ptr = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else @@ -39,31 +37,27 @@ void* AllocateExecutableMemory(size_t size, bool low) // effect of discarding already mapped pages that happen to be in the // requested virtual memory range (such as the emulated RAM, sometimes). if (low && (!map_hint)) - map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */ + map_hint = (char*)round_page(512 * 1024 * 1024); /* 0.5 GB rounded up to the next page */ #endif - void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_ANON | MAP_PRIVATE + void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE #if defined(ARCHITECTURE_X64) && defined(MAP_32BIT) - | (low ? MAP_32BIT : 0) + | (low ? MAP_32BIT : 0) #endif - , -1, 0); + , + -1, 0); #endif /* defined(_WIN32) */ #ifdef _WIN32 - if (ptr == nullptr) - { + if (ptr == nullptr) { #else - if (ptr == MAP_FAILED) - { + if (ptr == MAP_FAILED) { ptr = nullptr; #endif LOG_ERROR(Common_Memory, "Failed to allocate executable memory"); } #if !defined(_WIN32) && defined(ARCHITECTURE_X64) && !defined(MAP_32BIT) - else - { - if (low) - { + else { + if (low) { map_hint += size; map_hint = (char*)round_page(map_hint); /* round up to the next page */ } @@ -78,13 +72,11 @@ void* AllocateExecutableMemory(size_t size, bool low) return ptr; } -void* AllocateMemoryPages(size_t size) -{ +void* AllocateMemoryPages(size_t size) { #ifdef _WIN32 void* ptr = VirtualAlloc(nullptr, size, MEM_COMMIT, PAGE_READWRITE); #else - void* ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); + void* ptr = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (ptr == MAP_FAILED) ptr = nullptr; @@ -96,10 +88,9 @@ void* AllocateMemoryPages(size_t size) return ptr; } -void* AllocateAlignedMemory(size_t size,size_t alignment) -{ +void* AllocateAlignedMemory(size_t size, size_t alignment) { #ifdef _WIN32 - void* ptr = _aligned_malloc(size,alignment); + void* ptr = _aligned_malloc(size, alignment); #else void* ptr = nullptr; #ifdef ANDROID @@ -116,10 +107,8 @@ void* AllocateAlignedMemory(size_t size,size_t alignment) return ptr; } -void FreeMemoryPages(void* ptr, size_t size) -{ - if (ptr) - { +void FreeMemoryPages(void* ptr, size_t size) { + if (ptr) { #ifdef _WIN32 if (!VirtualFree(ptr, 0, MEM_RELEASE)) LOG_ERROR(Common_Memory, "FreeMemoryPages failed!\n%s", GetLastErrorMsg()); @@ -129,20 +118,17 @@ void FreeMemoryPages(void* ptr, size_t size) } } -void FreeAlignedMemory(void* ptr) -{ - if (ptr) - { +void FreeAlignedMemory(void* ptr) { + if (ptr) { #ifdef _WIN32 - _aligned_free(ptr); + _aligned_free(ptr); #else - free(ptr); + free(ptr); #endif } } -void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) -{ +void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) { #ifdef _WIN32 DWORD oldValue; if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue)) @@ -152,19 +138,19 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute) #endif } -void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) -{ +void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute) { #ifdef _WIN32 DWORD oldValue; - if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue)) + if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, + &oldValue)) LOG_ERROR(Common_Memory, "UnWriteProtectMemory failed!\n%s", GetLastErrorMsg()); #else - mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); + mprotect(ptr, size, + allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ); #endif } -std::string MemUsage() -{ +std::string MemUsage() { #ifdef _WIN32 #pragma comment(lib, "psapi") DWORD processID = GetCurrentProcessId(); @@ -175,10 +161,12 @@ std::string MemUsage() // Print information about the memory usage of the process. hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); - if (nullptr == hProcess) return "MemUsage Error"; + if (nullptr == hProcess) + return "MemUsage Error"; if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) - Ret = Common::StringFromFormat("%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); + Ret = Common::StringFromFormat( + "%s K", Common::ThousandSeparate(pmc.WorkingSetSize / 1024, 7).c_str()); CloseHandle(hProcess); return Ret; diff --git a/src/common/memory_util.h b/src/common/memory_util.h index 9bf37c44f..76ca5a30c 100644 --- a/src/common/memory_util.h +++ b/src/common/memory_util.h @@ -10,10 +10,12 @@ void* AllocateExecutableMemory(size_t size, bool low = true); void* AllocateMemoryPages(size_t size); void FreeMemoryPages(void* ptr, size_t size); -void* AllocateAlignedMemory(size_t size,size_t alignment); +void* AllocateAlignedMemory(size_t size, size_t alignment); void FreeAlignedMemory(void* ptr); void WriteProtectMemory(void* ptr, size_t size, bool executable = false); void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false); std::string MemUsage(); -inline int GetPageSize() { return 4096; } +inline int GetPageSize() { + return 4096; +} diff --git a/src/common/microprofile.h b/src/common/microprofile.h index 670a58fe5..54e7f3cc4 100644 --- a/src/common/microprofile.h +++ b/src/common/microprofile.h @@ -13,7 +13,7 @@ #define MICROPROFILE_WEBSERVER 0 #define MICROPROFILE_GPU_TIMERS 0 // TODO: Implement timer queries when we upgrade to OpenGL 3.3 #define MICROPROFILE_CONTEXT_SWITCH_TRACE 0 -#define MICROPROFILE_PER_THREAD_BUFFER_SIZE (2048<<13) // 16 MB +#define MICROPROFILE_PER_THREAD_BUFFER_SIZE (2048 << 13) // 16 MB #ifdef _WIN32 // This isn't defined by the standard library in MSVC2015 diff --git a/src/common/misc.cpp b/src/common/misc.cpp index d2a049b63..5938e6289 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -12,23 +12,21 @@ #endif // Neither Android nor OS X support TLS -#if defined(__APPLE__) || (ANDROID && __clang__) +#if defined(__APPLE__) || (ANDROID && __clang__) #define __thread #endif // Generic function to get last error message. // Call directly after the command or use the error num. // This function might change the error code. -const char* GetLastErrorMsg() -{ +const char* GetLastErrorMsg() { static const size_t buff_size = 255; #ifdef _WIN32 static __declspec(thread) char err_str[buff_size] = {}; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - err_str, buff_size, nullptr); + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err_str, buff_size, nullptr); #else static __thread char err_str[buff_size] = {}; diff --git a/src/common/platform.h b/src/common/platform.h index 9ba4db11b..c62fb7c8f 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -28,7 +28,7 @@ // Platform detection #if defined(ARCHITECTURE_x86_64) || defined(__aarch64__) - #define EMU_ARCH_BITS 64 +#define EMU_ARCH_BITS 64 #elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) - #define EMU_ARCH_BITS 32 +#define EMU_ARCH_BITS 32 #endif diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index 49eb3f40c..992ec25b2 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -14,7 +14,7 @@ namespace Common { namespace Profiling { ProfilingManager::ProfilingManager() - : last_frame_end(Clock::now()), this_frame_start(Clock::now()) { + : last_frame_end(Clock::now()), this_frame_start(Clock::now()) { } void ProfilingManager::BeginFrame() { @@ -31,7 +31,7 @@ void ProfilingManager::FinishFrame() { } TimingResultsAggregator::TimingResultsAggregator(size_t window_size) - : max_window_size(window_size), window_size(0) { + : max_window_size(window_size), window_size(0) { interframe_times.resize(window_size, Duration::zero()); frame_times.resize(window_size, Duration::zero()); } diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 08f09a8c8..73b2a262e 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -4,20 +4,25 @@ #pragma once -#include "common/common_funcs.h" #include +#include "common/common_funcs.h" namespace detail { - template - struct ScopeExitHelper { - explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} - ~ScopeExitHelper() { func(); } +template +struct ScopeExitHelper { + explicit ScopeExitHelper(Func&& func) : func(std::move(func)) { + } + ~ScopeExitHelper() { + func(); + } - Func func; - }; + Func func; +}; - template - ScopeExitHelper ScopeExit(Func&& func) { return ScopeExitHelper(std::move(func)); } +template +ScopeExitHelper ScopeExit(Func&& func) { + return ScopeExitHelper(std::move(func)); +} } /** diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index f0aa072db..9ccd6f135 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -14,11 +14,11 @@ #include "common/string_util.h" #ifdef _MSC_VER - #include - #include - #include "common/common_funcs.h" +#include +#include +#include "common/common_funcs.h" #else - #include +#include #endif namespace Common { @@ -36,9 +36,8 @@ std::string ToUpper(std::string str) { } // faster than sscanf -bool AsciiToHex(const char* _szValue, u32& result) -{ - char *endptr = nullptr; +bool AsciiToHex(const char* _szValue, u32& result) { + char* endptr = nullptr; const u32 value = strtoul(_szValue, &endptr, 16); if (!endptr || *endptr) @@ -48,8 +47,7 @@ bool AsciiToHex(const char* _szValue, u32& result) return true; } -bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args) -{ +bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args) { int writtenCount; #ifdef _MSC_VER @@ -84,22 +82,18 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar writtenCount = vsnprintf(out, outsize, format, args); #endif - if (writtenCount > 0 && writtenCount < outsize) - { + if (writtenCount > 0 && writtenCount < outsize) { out[writtenCount] = '\0'; return true; - } - else - { + } else { out[outsize - 1] = '\0'; return false; } } -std::string StringFromFormat(const char* format, ...) -{ +std::string StringFromFormat(const char* format, ...) { va_list args; - char *buf = nullptr; + char* buf = nullptr; #ifdef _WIN32 int required = 0; @@ -124,21 +118,17 @@ std::string StringFromFormat(const char* format, ...) } // For Debugging. Read out an u8 array. -std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces) -{ +std::string ArrayToString(const u8* data, u32 size, int line_len, bool spaces) { std::ostringstream oss; oss << std::setfill('0') << std::hex; - for (int line = 0; size; ++data, --size) - { + for (int line = 0; size; ++data, --size) { oss << std::setw(2) << (int)*data; - if (line_len == ++line) - { + if (line_len == ++line) { oss << '\n'; line = 0; - } - else if (spaces) + } else if (spaces) oss << ' '; } @@ -146,8 +136,7 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces) } // Turns " hej " into "hej". Also handles tabs. -std::string StripSpaces(const std::string &str) -{ +std::string StripSpaces(const std::string& str) { const size_t s = str.find_first_not_of(" \t\r\n"); if (str.npos != s) @@ -159,17 +148,15 @@ std::string StripSpaces(const std::string &str) // "\"hello\"" is turned to "hello" // This one assumes that the string has already been space stripped in both // ends, as done by StripSpaces above, for example. -std::string StripQuotes(const std::string& s) -{ +std::string StripQuotes(const std::string& s) { if (s.size() && '\"' == s[0] && '\"' == *s.rbegin()) return s.substr(1, s.size() - 2); else return s; } -bool TryParse(const std::string &str, u32 *const output) -{ - char *endptr = nullptr; +bool TryParse(const std::string& str, u32* const output) { + char* endptr = nullptr; // Reset errno to a value other than ERANGE errno = 0; @@ -183,8 +170,7 @@ bool TryParse(const std::string &str, u32 *const output) return false; #if ULONG_MAX > UINT_MAX - if (value >= 0x100000000ull - && value <= 0xFFFFFFFF00000000ull) + if (value >= 0x100000000ull && value <= 0xFFFFFFFF00000000ull) return false; #endif @@ -192,8 +178,7 @@ bool TryParse(const std::string &str, u32 *const output) return true; } -bool TryParse(const std::string &str, bool *const output) -{ +bool TryParse(const std::string& str, bool* const output) { if ("1" == str || "true" == ToLower(str)) *output = true; else if ("0" == str || "false" == ToLower(str)) @@ -204,22 +189,21 @@ bool TryParse(const std::string &str, bool *const output) return true; } -std::string StringFromBool(bool value) -{ +std::string StringFromBool(bool value) { return value ? "True" : "False"; } -bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension) -{ +bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, + std::string* _pExtension) { if (full_path.empty()) return false; size_t dir_end = full_path.find_last_of("/" - // windows needs the : included for something like just "C:" to be considered a directory +// windows needs the : included for something like just "C:" to be considered a directory #ifdef _WIN32 - ":" + ":" #endif - ); + ); if (std::string::npos == dir_end) dir_end = 0; else @@ -241,8 +225,8 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ return true; } -void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename) -{ +void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, + const std::string& _Filename) { _CompleteFilename = _Path; // check for seperator @@ -253,8 +237,7 @@ void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _P _CompleteFilename += _Filename; } -void SplitString(const std::string& str, const char delim, std::vector& output) -{ +void SplitString(const std::string& str, const char delim, std::vector& output) { std::istringstream iss(str); output.resize(1); @@ -264,8 +247,7 @@ void SplitString(const std::string& str, const char delim, std::vector= 1900 // Workaround for missing char16_t/char32_t instantiations in MSVC2015 std::wstring_convert, __int16> convert; @@ -307,8 +286,7 @@ std::string UTF16ToUTF8(const std::u16string& input) #endif } -std::u16string UTF8ToUTF16(const std::string& input) -{ +std::u16string UTF8ToUTF16(const std::string& input) { #if _MSC_VER >= 1900 // Workaround for missing char16_t/char32_t instantiations in MSVC2015 std::wstring_convert, __int16> convert; @@ -320,57 +298,56 @@ std::u16string UTF8ToUTF16(const std::string& input) #endif } -static std::wstring CPToUTF16(u32 code_page, const std::string& input) -{ - auto const size = MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); +static std::wstring CPToUTF16(u32 code_page, const std::string& input) { + auto const size = + MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); std::wstring output; output.resize(size); - if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), &output[0], static_cast(output.size()))) + if (size == 0 || + size != MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), + &output[0], static_cast(output.size()))) output.clear(); return output; } -std::string UTF16ToUTF8(const std::wstring& input) -{ - auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), nullptr, 0, nullptr, nullptr); +std::string UTF16ToUTF8(const std::wstring& input) { + auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), + nullptr, 0, nullptr, nullptr); std::string output; output.resize(size); - if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), &output[0], static_cast(output.size()), nullptr, nullptr)) + if (size == 0 || + size != WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), + &output[0], static_cast(output.size()), nullptr, nullptr)) output.clear(); return output; } -std::wstring UTF8ToUTF16W(const std::string &input) -{ +std::wstring UTF8ToUTF16W(const std::string& input) { return CPToUTF16(CP_UTF8, input); } -std::string SHIFTJISToUTF8(const std::string& input) -{ +std::string SHIFTJISToUTF8(const std::string& input) { return UTF16ToUTF8(CPToUTF16(932, input)); } -std::string CP1252ToUTF8(const std::string& input) -{ +std::string CP1252ToUTF8(const std::string& input) { return UTF16ToUTF8(CPToUTF16(1252, input)); } #else template -static std::string CodeToUTF8(const char* fromcode, const std::basic_string& input) -{ +static std::string CodeToUTF8(const char* fromcode, const std::basic_string& input) { std::string result; iconv_t const conv_desc = iconv_open("UTF-8", fromcode); - if ((iconv_t)(-1) == conv_desc) - { + if ((iconv_t)(-1) == conv_desc) { LOG_ERROR(Common, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); iconv_close(conv_desc); return {}; @@ -388,24 +365,18 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& auto dst_buffer = &out_buffer[0]; size_t dst_bytes = out_buffer.size(); - while (0 != src_bytes) - { - size_t const iconv_result = iconv(conv_desc, (char**)(&src_buffer), &src_bytes, - &dst_buffer, &dst_bytes); + while (0 != src_bytes) { + size_t const iconv_result = + iconv(conv_desc, (char**)(&src_buffer), &src_bytes, &dst_buffer, &dst_bytes); - if (static_cast(-1) == iconv_result) - { - if (EILSEQ == errno || EINVAL == errno) - { + if (static_cast(-1) == iconv_result) { + if (EILSEQ == errno || EINVAL == errno) { // Try to skip the bad character - if (0 != src_bytes) - { + if (0 != src_bytes) { --src_bytes; ++src_buffer; } - } - else - { + } else { LOG_ERROR(Common, "iconv failure [%s]: %s", fromcode, strerror(errno)); break; } @@ -420,13 +391,11 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& return result; } -std::u16string UTF8ToUTF16(const std::string& input) -{ +std::u16string UTF8ToUTF16(const std::string& input) { std::u16string result; iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); - if ((iconv_t)(-1) == conv_desc) - { + if ((iconv_t)(-1) == conv_desc) { LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); iconv_close(conv_desc); return {}; @@ -444,24 +413,18 @@ std::u16string UTF8ToUTF16(const std::string& input) char* dst_buffer = (char*)(&out_buffer[0]); size_t dst_bytes = out_buffer.size(); - while (0 != src_bytes) - { - size_t const iconv_result = iconv(conv_desc, &src_buffer, &src_bytes, - &dst_buffer, &dst_bytes); + while (0 != src_bytes) { + size_t const iconv_result = + iconv(conv_desc, &src_buffer, &src_bytes, &dst_buffer, &dst_bytes); - if (static_cast(-1) == iconv_result) - { - if (EILSEQ == errno || EINVAL == errno) - { + if (static_cast(-1) == iconv_result) { + if (EILSEQ == errno || EINVAL == errno) { // Try to skip the bad character - if (0 != src_bytes) - { + if (0 != src_bytes) { --src_bytes; ++src_buffer; } - } - else - { + } else { LOG_ERROR(Common, "iconv failure [UTF-8]: %s", strerror(errno)); break; } @@ -476,32 +439,28 @@ std::u16string UTF8ToUTF16(const std::string& input) return result; } -std::string UTF16ToUTF8(const std::u16string& input) -{ +std::string UTF16ToUTF8(const std::u16string& input) { return CodeToUTF8("UTF-16LE", input); } -std::string CP1252ToUTF8(const std::string& input) -{ - //return CodeToUTF8("CP1252//TRANSLIT", input); - //return CodeToUTF8("CP1252//IGNORE", input); +std::string CP1252ToUTF8(const std::string& input) { + // return CodeToUTF8("CP1252//TRANSLIT", input); + // return CodeToUTF8("CP1252//IGNORE", input); return CodeToUTF8("CP1252", input); } -std::string SHIFTJISToUTF8(const std::string& input) -{ - //return CodeToUTF8("CP932", input); +std::string SHIFTJISToUTF8(const std::string& input) { + // return CodeToUTF8("CP932", input); return CodeToUTF8("SJIS", input); } #endif -std::string StringFromFixedZeroTerminatedBuffer(const char * buffer, size_t max_len) { +std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len) { size_t len = 0; while (len < max_len && buffer[len] != '\0') ++len; return std::string(buffer, len); } - } diff --git a/src/common/string_util.h b/src/common/string_util.h index 89d9f133e..6ffd735f4 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -25,9 +25,8 @@ std::string StringFromFormat(const char* format, ...); // Cheap! bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args); -template -inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) -{ +template +inline void CharArrayFromFormat(char (&out)[Count], const char* format, ...) { va_list args; va_start(args, format); CharArrayFromFormatV(out, Count, format, args); @@ -35,15 +34,14 @@ inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...) } // Good -std::string ArrayToString(const u8 *data, u32 size, int line_len = 20, bool spaces = true); +std::string ArrayToString(const u8* data, u32 size, int line_len = 20, bool spaces = true); -std::string StripSpaces(const std::string &s); -std::string StripQuotes(const std::string &s); +std::string StripSpaces(const std::string& s); +std::string StripQuotes(const std::string& s); // Thousand separator. Turns 12345678 into 12,345,678 template -std::string ThousandSeparate(I value, int spaces = 0) -{ +std::string ThousandSeparate(I value, int spaces = 0) { std::ostringstream oss; // std::locale("") seems to be broken on many platforms @@ -57,35 +55,34 @@ std::string ThousandSeparate(I value, int spaces = 0) std::string StringFromBool(bool value); -bool TryParse(const std::string &str, bool *output); -bool TryParse(const std::string &str, u32 *output); +bool TryParse(const std::string& str, bool* output); +bool TryParse(const std::string& str, u32* output); template -static bool TryParse(const std::string &str, N *const output) -{ +static bool TryParse(const std::string& str, N* const output) { std::istringstream iss(str); N tmp = 0; - if (iss >> tmp) - { + if (iss >> tmp) { *output = tmp; return true; - } - else + } else return false; } // TODO: kill this bool AsciiToHex(const char* _szValue, u32& result); -std::string TabsToSpaces(int tab_size, const std::string &in); +std::string TabsToSpaces(int tab_size, const std::string& in); void SplitString(const std::string& str, char delim, std::vector& output); // "C:/Windows/winhelp.exe" to "C:/Windows/", "winhelp", ".exe" -bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension); +bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, + std::string* _pExtension); -void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename); +void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, + const std::string& _Filename); std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest); std::string UTF16ToUTF8(const std::u16string& input); @@ -99,17 +96,21 @@ std::string UTF16ToUTF8(const std::wstring& input); std::wstring UTF8ToUTF16W(const std::string& str); #ifdef _UNICODE -inline std::string TStrToUTF8(const std::wstring& str) -{ return UTF16ToUTF8(str); } +inline std::string TStrToUTF8(const std::wstring& str) { + return UTF16ToUTF8(str); +} -inline std::wstring UTF8ToTStr(const std::string& str) -{ return UTF8ToUTF16W(str); } +inline std::wstring UTF8ToTStr(const std::string& str) { + return UTF8ToUTF16W(str); +} #else -inline std::string TStrToUTF8(const std::string& str) -{ return str; } +inline std::string TStrToUTF8(const std::string& str) { + return str; +} -inline std::string UTF8ToTStr(const std::string& str) -{ return str; } +inline std::string UTF8ToTStr(const std::string& str) { + return str; +} #endif #endif @@ -134,5 +135,4 @@ bool ComparePartialString(InIt begin, InIt end, const char* other) { * NUL-terminated then the string ends at max_len characters. */ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len); - } diff --git a/src/common/swap.h b/src/common/swap.h index 1749bd7a4..1794144fb 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -18,11 +18,11 @@ #pragma once #if defined(_MSC_VER) - #include +#include #elif defined(__linux__) - #include +#include #elif defined(__FreeBSD__) - #include +#include #endif #include @@ -61,38 +61,73 @@ namespace Common { #ifdef _MSC_VER -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);} +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 _M_ARM -inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;} -inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;} -inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);} +inline u16 swap16(u16 _data) { + u32 data = _data; + __asm__("rev16 %0, %1\n" : "=l"(data) : "l"(data)); + return (u16)data; +} +inline u32 swap32(u32 _data) { + __asm__("rev %0, %1\n" : "=l"(_data) : "l"(_data)); + return _data; +} +inline u64 swap64(u64 _data) { + return ((u64)swap32(_data) << 32) | swap32(_data >> 32); +} #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);} +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 (_data >> 8) | (_data << 8);} -inline __attribute__((always_inline)) u32 swap32(u32 _data) -{return __builtin_bswap32(_data);} -inline __attribute__((always_inline)) u64 swap64(u64 _data) -{return __builtin_bswap64(_data);} +inline __attribute__((always_inline)) u16 swap16(u16 _data) { + return (_data >> 8) | (_data << 8); +} +inline __attribute__((always_inline)) u32 swap32(u32 _data) { + return __builtin_bswap32(_data); +} +inline __attribute__((always_inline)) u64 swap64(u64 _data) { + return __builtin_bswap64(_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);} +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);} +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 float swapf(float f) { - static_assert(sizeof(u32) == sizeof(float), - "float must be the same size as uint32_t."); + static_assert(sizeof(u32) == sizeof(float), "float must be the same size as uint32_t."); u32 value; std::memcpy(&value, &f, sizeof(u32)); @@ -104,8 +139,7 @@ inline float swapf(float f) { } inline double swapd(double f) { - static_assert(sizeof(u64) == sizeof(double), - "double must be the same size as uint64_t."); + static_assert(sizeof(u64) == sizeof(double), "double must be the same size as uint64_t."); u64 value; std::memcpy(&value, &f, sizeof(u64)); @@ -116,8 +150,7 @@ inline double swapd(double f) { return f; } -} // Namespace Common - +} // Namespace Common template struct swap_struct_t { @@ -129,251 +162,272 @@ protected: static T swap(T v) { return F::swap(v); } + public: T const swap() const { return swap(value); - } swap_struct_t() = default; - swap_struct_t(const T &v): value(swap(v)) {} + swap_struct_t(const T& v) : value(swap(v)) { + } template - swapped_t& operator=(const S &source) { + swapped_t& operator=(const S& source) { value = swap((T)source); return *this; } - operator s8() const { return (s8)swap(); } - operator u8() const { return (u8)swap(); } - operator s16() const { return (s16)swap(); } - operator u16() const { return (u16)swap(); } - operator s32() const { return (s32)swap(); } - operator u32() const { return (u32)swap(); } - operator s64() const { return (s64)swap(); } - operator u64() const { return (u64)swap(); } - operator float() const { return (float)swap(); } - operator double() const { return (double)swap(); } + operator s8() const { + return (s8)swap(); + } + operator u8() const { + return (u8)swap(); + } + operator s16() const { + return (s16)swap(); + } + operator u16() const { + return (u16)swap(); + } + operator s32() const { + return (s32)swap(); + } + operator u32() const { + return (u32)swap(); + } + operator s64() const { + return (s64)swap(); + } + operator u64() const { + return (u64)swap(); + } + operator float() const { + return (float)swap(); + } + operator double() const { + return (double)swap(); + } // +v - swapped_t operator +() const { + swapped_t operator+() const { return +swap(); } // -v - swapped_t operator -() const { + swapped_t operator-() const { return -swap(); } // v / 5 - swapped_t operator/(const swapped_t &i) const { + swapped_t operator/(const swapped_t& i) const { return swap() / i.swap(); } template - swapped_t operator/(const S &i) const { + swapped_t operator/(const S& i) const { return swap() / i; } // v * 5 - swapped_t operator*(const swapped_t &i) const { + swapped_t operator*(const swapped_t& i) const { return swap() * i.swap(); } template - swapped_t operator*(const S &i) const { + swapped_t operator*(const S& i) const { return swap() * i; } // v + 5 - swapped_t operator+(const swapped_t &i) const { + swapped_t operator+(const swapped_t& i) const { return swap() + i.swap(); } template - swapped_t operator+(const S &i) const { + swapped_t operator+(const S& i) const { return swap() + (T)i; } // v - 5 - swapped_t operator-(const swapped_t &i) const { + swapped_t operator-(const swapped_t& i) const { return swap() - i.swap(); } template - swapped_t operator-(const S &i) const { + swapped_t operator-(const S& i) const { return swap() - (T)i; } // v += 5 - swapped_t& operator+=(const swapped_t &i) { + swapped_t& operator+=(const swapped_t& i) { value = swap(swap() + i.swap()); return *this; } template - swapped_t& operator+=(const S &i) { + swapped_t& operator+=(const S& i) { value = swap(swap() + (T)i); return *this; } // v -= 5 - swapped_t& operator-=(const swapped_t &i) { + swapped_t& operator-=(const swapped_t& i) { value = swap(swap() - i.swap()); return *this; } template - swapped_t& operator-=(const S &i) { + swapped_t& operator-=(const S& i) { value = swap(swap() - (T)i); return *this; } // ++v swapped_t& operator++() { - value = swap(swap()+1); + value = swap(swap() + 1); return *this; } // --v - swapped_t& operator--() { - value = swap(swap()-1); + swapped_t& operator--() { + value = swap(swap() - 1); return *this; } // v++ swapped_t operator++(int) { swapped_t old = *this; - value = swap(swap()+1); + value = swap(swap() + 1); return old; } // v-- swapped_t operator--(int) { swapped_t old = *this; - value = swap(swap()-1); + value = swap(swap() - 1); return old; } // Comparaison // v == i - bool operator==(const swapped_t &i) const { + bool operator==(const swapped_t& i) const { return swap() == i.swap(); } template - bool operator==(const S &i) const { + bool operator==(const S& i) const { return swap() == i; } // v != i - bool operator!=(const swapped_t &i) const { + bool operator!=(const swapped_t& i) const { return swap() != i.swap(); } template - bool operator!=(const S &i) const { + bool operator!=(const S& i) const { return swap() != i; } // v > i - bool operator>(const swapped_t &i) const { + bool operator>(const swapped_t& i) const { return swap() > i.swap(); } template - bool operator>(const S &i) const { + bool operator>(const S& i) const { return swap() > i; } // v < i - bool operator<(const swapped_t &i) const { + bool operator<(const swapped_t& i) const { return swap() < i.swap(); } template - bool operator<(const S &i) const { + bool operator<(const S& i) const { return swap() < i; } // v >= i - bool operator>=(const swapped_t &i) const { + bool operator>=(const swapped_t& i) const { return swap() >= i.swap(); } template - bool operator>=(const S &i) const { + bool operator>=(const S& i) const { return swap() >= i; } // v <= i - bool operator<=(const swapped_t &i) const { + bool operator<=(const swapped_t& i) const { return swap() <= i.swap(); } template - bool operator<=(const S &i) const { + bool operator<=(const S& i) const { return swap() <= i; } // logical - swapped_t operator !() const { + swapped_t operator!() const { return !swap(); } // bitmath - swapped_t operator ~() const { + swapped_t operator~() const { return ~swap(); } - swapped_t operator &(const swapped_t &b) const { + swapped_t operator&(const swapped_t& b) const { return swap() & b.swap(); } template - swapped_t operator &(const S &b) const { + swapped_t operator&(const S& b) const { return swap() & b; } - swapped_t& operator &=(const swapped_t &b) { + swapped_t& operator&=(const swapped_t& b) { value = swap(swap() & b.swap()); return *this; } template - swapped_t& operator &=(const S b) { + swapped_t& operator&=(const S b) { value = swap(swap() & b); return *this; } - swapped_t operator |(const swapped_t &b) const { + swapped_t operator|(const swapped_t& b) const { return swap() | b.swap(); } template - swapped_t operator |(const S &b) const { + swapped_t operator|(const S& b) const { return swap() | b; } - swapped_t& operator |=(const swapped_t &b) { + swapped_t& operator|=(const swapped_t& b) { value = swap(swap() | b.swap()); return *this; } template - swapped_t& operator |=(const S &b) { + swapped_t& operator|=(const S& b) { value = swap(swap() | b); return *this; } - swapped_t operator ^(const swapped_t &b) const { + swapped_t operator^(const swapped_t& b) const { return swap() ^ b.swap(); } template - swapped_t operator ^(const S &b) const { + swapped_t operator^(const S& b) const { return swap() ^ b; } - swapped_t& operator ^=(const swapped_t &b) { + swapped_t& operator^=(const swapped_t& b) { value = swap(swap() ^ b.swap()); return *this; } template - swapped_t& operator ^=(const S &b) { + swapped_t& operator^=(const S& b) { value = swap(swap() ^ b); return *this; } template - swapped_t operator <<(const S &b) const { + swapped_t operator<<(const S& b) const { return swap() << b; } template - swapped_t& operator <<=(const S &b) const { + swapped_t& operator<<=(const S& b) const { value = swap(swap() << b); return *this; } template - swapped_t operator >>(const S &b) const { + swapped_t operator>>(const S& b) const { return swap() >> b; } template - swapped_t& operator >>=(const S &b) const { + swapped_t& operator>>=(const S& b) const { value = swap(swap() >> b); return *this; } @@ -381,129 +435,126 @@ public: // Member /** todo **/ - // Arithmetics template - friend S operator+(const S &p, const swapped_t v); + friend S operator+(const S& p, const swapped_t v); template - friend S operator-(const S &p, const swapped_t v); + friend S operator-(const S& p, const swapped_t v); template - friend S operator/(const S &p, const swapped_t v); + friend S operator/(const S& p, const swapped_t v); template - friend S operator*(const S &p, const swapped_t v); + friend S operator*(const S& p, const swapped_t v); template - friend S operator%(const S &p, const swapped_t v); + friend S operator%(const S& p, const swapped_t v); // Arithmetics + assignements template - friend S operator+=(const S &p, const swapped_t v); + friend S operator+=(const S& p, const swapped_t v); template - friend S operator-=(const S &p, const swapped_t v); + friend S operator-=(const S& p, const swapped_t v); // Bitmath template - friend S operator&(const S &p, const swapped_t v); + friend S operator&(const S& p, const swapped_t v); // Comparison template - friend bool operator<(const S &p, const swapped_t v); + friend bool operator<(const S& p, const swapped_t v); template - friend bool operator>(const S &p, const swapped_t v); + friend bool operator>(const S& p, const swapped_t v); template - friend bool operator<=(const S &p, const swapped_t v); + friend bool operator<=(const S& p, const swapped_t v); template - friend bool operator>=(const S &p, const swapped_t v); + friend bool operator>=(const S& p, const swapped_t v); template - friend bool operator!=(const S &p, const swapped_t v); + friend bool operator!=(const S& p, const swapped_t v); template - friend bool operator==(const S &p, const swapped_t v); + friend bool operator==(const S& p, const swapped_t v); }; - // Arithmetics template -S operator+(const S &i, const swap_struct_t v) { +S operator+(const S& i, const swap_struct_t v) { return i + v.swap(); } template -S operator-(const S &i, const swap_struct_t v) { +S operator-(const S& i, const swap_struct_t v) { return i - v.swap(); } template -S operator/(const S &i, const swap_struct_t v) { +S operator/(const S& i, const swap_struct_t v) { return i / v.swap(); } template -S operator*(const S &i, const swap_struct_t v) { +S operator*(const S& i, const swap_struct_t v) { return i * v.swap(); } template -S operator%(const S &i, const swap_struct_t v) { +S operator%(const S& i, const swap_struct_t v) { return i % v.swap(); } // Arithmetics + assignements template -S &operator+=(S &i, const swap_struct_t v) { +S& operator+=(S& i, const swap_struct_t v) { i += v.swap(); return i; } template -S &operator-=(S &i, const swap_struct_t v) { +S& operator-=(S& i, const swap_struct_t v) { i -= v.swap(); return i; } // Logical template -S operator&(const S &i, const swap_struct_t v) { +S operator&(const S& i, const swap_struct_t v) { return i & v.swap(); } template -S operator&(const swap_struct_t v, const S &i) { +S operator&(const swap_struct_t v, const S& i) { return (S)(v.swap() & i); } - // Comparaison template -bool operator<(const S &p, const swap_struct_t v) { +bool operator<(const S& p, const swap_struct_t v) { return p < v.swap(); } template -bool operator>(const S &p, const swap_struct_t v) { +bool operator>(const S& p, const swap_struct_t v) { return p > v.swap(); } template -bool operator<=(const S &p, const swap_struct_t v) { +bool operator<=(const S& p, const swap_struct_t v) { return p <= v.swap(); } template -bool operator>=(const S &p, const swap_struct_t v) { +bool operator>=(const S& p, const swap_struct_t v) { return p >= v.swap(); } template -bool operator!=(const S &p, const swap_struct_t v) { +bool operator!=(const S& p, const swap_struct_t v) { return p != v.swap(); } template -bool operator==(const S &p, const swap_struct_t v) { +bool operator==(const S& p, const swap_struct_t v) { return p == v.swap(); } @@ -554,30 +605,30 @@ typedef s64 s64_le; typedef float float_le; typedef double double_le; -typedef swap_struct_t > u64_be; -typedef swap_struct_t > s64_be; +typedef swap_struct_t> u64_be; +typedef swap_struct_t> s64_be; -typedef swap_struct_t > u32_be; -typedef swap_struct_t > s32_be; +typedef swap_struct_t> u32_be; +typedef swap_struct_t> s32_be; -typedef swap_struct_t > u16_be; -typedef swap_struct_t > s16_be; +typedef swap_struct_t> u16_be; +typedef swap_struct_t> s16_be; -typedef swap_struct_t > float_be; -typedef swap_struct_t > double_be; +typedef swap_struct_t> float_be; +typedef swap_struct_t> double_be; #else -typedef swap_struct_t > u64_le; -typedef swap_struct_t > s64_le; +typedef swap_struct_t> u64_le; +typedef swap_struct_t> s64_le; -typedef swap_struct_t > u32_le; -typedef swap_struct_t > s32_le; +typedef swap_struct_t> u32_le; +typedef swap_struct_t> s32_le; -typedef swap_struct_t > u16_le; -typedef swap_struct_t< s16, swap_16_t > s16_le; +typedef swap_struct_t> u16_le; +typedef swap_struct_t> s16_le; -typedef swap_struct_t > float_le; -typedef swap_struct_t > double_le; +typedef swap_struct_t> float_le; +typedef swap_struct_t> double_le; typedef u32 u32_be; typedef u16 u16_be; diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp index db8340043..c4d16af85 100644 --- a/src/common/symbols.cpp +++ b/src/common/symbols.cpp @@ -6,49 +6,41 @@ TSymbolsMap g_symbols; -namespace Symbols -{ - bool HasSymbol(u32 address) - { - return g_symbols.find(address) != g_symbols.end(); - } +namespace Symbols { +bool HasSymbol(u32 address) { + return g_symbols.find(address) != g_symbols.end(); +} + +void Add(u32 address, const std::string& name, u32 size, u32 type) { + if (!HasSymbol(address)) { + TSymbol symbol; + symbol.address = address; + symbol.name = name; + symbol.size = size; + symbol.type = type; - void Add(u32 address, const std::string& name, u32 size, u32 type) - { - if (!HasSymbol(address)) - { - TSymbol symbol; - symbol.address = address; - symbol.name = name; - symbol.size = size; - symbol.type = type; - - g_symbols.emplace(address, symbol); - } + g_symbols.emplace(address, symbol); } +} - TSymbol GetSymbol(u32 address) - { - const auto iter = g_symbols.find(address); +TSymbol GetSymbol(u32 address) { + const auto iter = g_symbols.find(address); - if (iter != g_symbols.end()) - return iter->second; + if (iter != g_symbols.end()) + return iter->second; - return {}; - } + return {}; +} - const std::string GetName(u32 address) - { - return GetSymbol(address).name; - } +const std::string GetName(u32 address) { + return GetSymbol(address).name; +} - void Remove(u32 address) - { - g_symbols.erase(address); - } +void Remove(u32 address) { + g_symbols.erase(address); +} - void Clear() - { - g_symbols.clear(); - } +void Clear() { + g_symbols.clear(); +} } diff --git a/src/common/symbols.h b/src/common/symbols.h index 5ed16009c..6044c9db6 100644 --- a/src/common/symbols.h +++ b/src/common/symbols.h @@ -10,25 +10,22 @@ #include "common/common_types.h" -struct TSymbol -{ - u32 address = 0; +struct TSymbol { + u32 address = 0; std::string name; - u32 size = 0; - u32 type = 0; + u32 size = 0; + u32 type = 0; }; typedef std::map TSymbolsMap; typedef std::pair TSymbolsPair; -namespace Symbols -{ - bool HasSymbol(u32 address); +namespace Symbols { +bool HasSymbol(u32 address); - void Add(u32 address, const std::string& name, u32 size, u32 type); - TSymbol GetSymbol(u32 address); - const std::string GetName(u32 address); - void Remove(u32 address); - void Clear(); +void Add(u32 address, const std::string& name, u32 size, u32 type); +TSymbol GetSymbol(u32 address); +const std::string GetName(u32 address); +void Remove(u32 address); +void Clear(); } - diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h index 07105a198..8dc4ddeac 100644 --- a/src/common/synchronized_wrapper.h +++ b/src/common/synchronized_wrapper.h @@ -12,14 +12,14 @@ namespace Common { /** * Wraps an object, only allowing access to it via a locking reference wrapper. Good to ensure no * one forgets to lock a mutex before acessing an object. To access the wrapped object construct a - * SyncronizedRef on this wrapper. Inspired by Rust's Mutex type (http://doc.rust-lang.org/std/sync/struct.Mutex.html). + * SyncronizedRef on this wrapper. Inspired by Rust's Mutex type + * (http://doc.rust-lang.org/std/sync/struct.Mutex.html). */ template class SynchronizedWrapper { public: template - SynchronizedWrapper(Args&&... args) : - data(std::forward(args)...) { + SynchronizedWrapper(Args&&... args) : data(std::forward(args)...) { } private: @@ -58,11 +58,19 @@ public: return *this; } - T& operator*() { return wrapper->data; } - const T& operator*() const { return wrapper->data; } + T& operator*() { + return wrapper->data; + } + const T& operator*() const { + return wrapper->data; + } - T* operator->() { return &wrapper->data; } - const T* operator->() const { return &wrapper->data; } + T* operator->() { + return &wrapper->data; + } + const T* operator->() const { + return &wrapper->data; + } private: SynchronizedWrapper* wrapper; diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 7bbf080bc..bee607ce9 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -5,27 +5,25 @@ #include "common/thread.h" #ifdef __APPLE__ - #include +#include #elif defined(_WIN32) - #include +#include #else - #if defined(BSD4_4) || defined(__OpenBSD__) - #include - #else - #include - #endif - #include +#if defined(BSD4_4) || defined(__OpenBSD__) +#include +#else +#include +#endif +#include #endif #ifndef _WIN32 - #include +#include #endif -namespace Common -{ +namespace Common { -int CurrentThreadId() -{ +int CurrentThreadId() { #ifdef _MSC_VER return GetCurrentThreadId(); #elif defined __APPLE__ @@ -37,26 +35,22 @@ int CurrentThreadId() #ifdef _WIN32 // Supporting functions -void SleepCurrentThread(int ms) -{ +void SleepCurrentThread(int ms) { Sleep(ms); } #endif #ifdef _MSC_VER -void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) -{ +void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { SetThreadAffinityMask(thread, mask); } -void SetCurrentThreadAffinity(u32 mask) -{ +void SetCurrentThreadAffinity(u32 mask) { SetThreadAffinityMask(GetCurrentThread(), mask); } -void SwitchCurrentThread() -{ +void SwitchCurrentThread() { SwitchToThread(); } @@ -66,40 +60,34 @@ void SwitchCurrentThread() // This is implemented much nicer in upcoming msvc++, see: // http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx -void SetCurrentThreadName(const char* szThreadName) -{ +void SetCurrentThreadName(const char* szThreadName) { static const DWORD MS_VC_EXCEPTION = 0x406D1388; - #pragma pack(push,8) - struct THREADNAME_INFO - { - DWORD dwType; // must be 0x1000 - LPCSTR szName; // pointer to name (in user addr space) +#pragma pack(push, 8) + struct THREADNAME_INFO { + DWORD dwType; // must be 0x1000 + LPCSTR szName; // pointer to name (in user addr space) DWORD dwThreadID; // thread ID (-1=caller thread) - DWORD dwFlags; // reserved for future use, must be zero + DWORD dwFlags; // reserved for future use, must be zero } info; - #pragma pack(pop) +#pragma pack(pop) info.dwType = 0x1000; info.szName = szThreadName; - info.dwThreadID = -1; //dwThreadID; + info.dwThreadID = -1; // dwThreadID; info.dwFlags = 0; - __try - { - RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info); + __try { + RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); + } __except (EXCEPTION_CONTINUE_EXECUTION) { } - __except(EXCEPTION_CONTINUE_EXECUTION) - {} } #else // !MSVC_VER, so must be POSIX threads -void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) -{ +void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) { #ifdef __APPLE__ - thread_policy_set(pthread_mach_thread_np(thread), - THREAD_AFFINITY_POLICY, (integer_t *)&mask, 1); + thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1); #elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID) cpu_set_t cpu_set; CPU_ZERO(&cpu_set); @@ -112,27 +100,23 @@ void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) #endif } -void SetCurrentThreadAffinity(u32 mask) -{ +void SetCurrentThreadAffinity(u32 mask) { SetThreadAffinity(pthread_self(), mask); } #ifndef _WIN32 -void SleepCurrentThread(int ms) -{ +void SleepCurrentThread(int ms) { usleep(1000 * ms); } -void SwitchCurrentThread() -{ +void SwitchCurrentThread() { usleep(1000 * 1); } #endif // MinGW with the POSIX threading model does not support pthread_setname_np #if !defined(_WIN32) || defined(_MSC_VER) -void SetCurrentThreadName(const char* szThreadName) -{ +void SetCurrentThreadName(const char* szThreadName) { #ifdef __APPLE__ pthread_setname_np(szThreadName); #elif defined(__OpenBSD__) diff --git a/src/common/thread.h b/src/common/thread.h index bbfa8befa..b189dc764 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -4,10 +4,10 @@ #pragma once -#include -#include #include +#include #include +#include #include "common/common_types.h" @@ -17,17 +17,17 @@ // backwards compat support. // WARNING: This only works correctly with POD types. #if defined(__clang__) -# if !__has_feature(cxx_thread_local) -# define thread_local __thread -# endif +#if !__has_feature(cxx_thread_local) +#define thread_local __thread +#endif #elif defined(__GNUC__) -# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) -# define thread_local __thread -# endif +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#define thread_local __thread +#endif #elif defined(_MSC_VER) -# if _MSC_VER < 1900 -# define thread_local __declspec(thread) -# endif +#if _MSC_VER < 1900 +#define thread_local __declspec(thread) +#endif #endif namespace Common { @@ -39,7 +39,8 @@ void SetCurrentThreadAffinity(u32 mask); class Event { public: - Event() : is_set(false) {} + Event() : is_set(false) { + } void Set() { std::lock_guard lk(mutex); @@ -51,13 +52,14 @@ public: void Wait() { std::unique_lock lk(mutex); - condvar.wait(lk, [&]{ return is_set; }); + condvar.wait(lk, [&] { return is_set; }); is_set = false; } void Reset() { std::unique_lock lk(mutex); - // no other action required, since wait loops on the predicate and any lingering signal will get cleared on the first iteration + // no other action required, since wait loops on the predicate and any lingering signal will + // get cleared on the first iteration is_set = false; } @@ -69,7 +71,8 @@ private: class Barrier { public: - explicit Barrier(size_t count_) : count(count_), waiting(0), generation(0) {} + explicit Barrier(size_t count_) : count(count_), waiting(0), generation(0) { + } /// Blocks until all "count" threads have called Sync() void Sync() { @@ -81,7 +84,8 @@ public: waiting = 0; condvar.notify_all(); } else { - condvar.wait(lk, [this, current_generation]{ return current_generation != generation; }); + condvar.wait(lk, + [this, current_generation] { return current_generation != generation; }); } } @@ -94,7 +98,7 @@ private: }; void SleepCurrentThread(int ms); -void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms +void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms // Use this function during a spin-wait to make the current thread // relax while another thread is working. This may be more efficient @@ -103,6 +107,6 @@ inline void YieldCPU() { std::this_thread::yield(); } -void SetCurrentThreadName(const char *name); +void SetCurrentThreadName(const char* name); } // namespace Common diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 12455d7c4..0dcf785b6 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -11,7 +11,7 @@ namespace Common { -template +template struct ThreadQueueList { // TODO(yuriks): If performance proves to be a problem, the std::deques can be replaced with // (dynamically resizable) circular buffers to remove their overhead when @@ -39,7 +39,7 @@ struct ThreadQueueList { } T get_first() { - Queue *cur = first; + Queue* cur = first; while (cur != nullptr) { if (!cur->data.empty()) { return cur->data.front(); @@ -51,7 +51,7 @@ struct ThreadQueueList { } T pop_first() { - Queue *cur = first; + Queue* cur = first; while (cur != nullptr) { if (!cur->data.empty()) { auto tmp = std::move(cur->data.front()); @@ -65,8 +65,8 @@ struct ThreadQueueList { } T pop_first_better(Priority priority) { - Queue *cur = first; - Queue *stop = &queues[priority]; + Queue* cur = first; + Queue* stop = &queues[priority]; while (cur < stop) { if (!cur->data.empty()) { auto tmp = std::move(cur->data.front()); @@ -80,12 +80,12 @@ struct ThreadQueueList { } void push_front(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; cur->data.push_front(thread_id); } void push_back(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; cur->data.push_back(thread_id); } @@ -96,12 +96,12 @@ struct ThreadQueueList { } void remove(Priority priority, const T& thread_id) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; boost::remove_erase(cur->data, thread_id); } void rotate(Priority priority) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; if (cur->data.size() > 1) { cur->data.push_back(std::move(cur->data.front())); @@ -115,7 +115,7 @@ struct ThreadQueueList { } bool empty(Priority priority) const { - const Queue *cur = &queues[priority]; + const Queue* cur = &queues[priority]; return cur->data.empty(); } @@ -139,7 +139,7 @@ private: } void link(Priority priority) { - Queue *cur = &queues[priority]; + Queue* cur = &queues[priority]; for (int i = priority - 1; i >= 0; --i) { if (queues[i].next_nonempty != UnlinkedTag()) { diff --git a/src/common/timer.cpp b/src/common/timer.cpp index b99835ac7..27560eb0b 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp @@ -16,11 +16,9 @@ #include "common/string_util.h" #include "common/timer.h" -namespace Common -{ +namespace Common { -u32 Timer::GetTimeMs() -{ +u32 Timer::GetTimeMs() { #ifdef _WIN32 return timeGetTime(); #else @@ -35,32 +33,27 @@ u32 Timer::GetTimeMs() // -------------------------------------------- // Set initial values for the class -Timer::Timer() - : m_LastTime(0), m_StartTime(0), m_Running(false) -{ +Timer::Timer() : m_LastTime(0), m_StartTime(0), m_Running(false) { Update(); } // Write the starting time -void Timer::Start() -{ +void Timer::Start() { m_StartTime = GetTimeMs(); m_Running = true; } // Stop the timer -void Timer::Stop() -{ +void Timer::Stop() { // Write the final time m_LastTime = GetTimeMs(); m_Running = false; } // Update the last time variable -void Timer::Update() -{ +void Timer::Update() { m_LastTime = GetTimeMs(); - //TODO(ector) - QPF + // TODO(ector) - QPF } // ------------------------------------- @@ -68,34 +61,32 @@ void Timer::Update() // ------------------------------------- // Get the number of milliseconds since the last Update() -u64 Timer::GetTimeDifference() -{ +u64 Timer::GetTimeDifference() { return GetTimeMs() - m_LastTime; } // Add the time difference since the last Update() to the starting time. // This is used to compensate for a paused game. -void Timer::AddTimeDifference() -{ +void Timer::AddTimeDifference() { m_StartTime += GetTimeDifference(); } // Get the time elapsed since the Start() -u64 Timer::GetTimeElapsed() -{ +u64 Timer::GetTimeElapsed() { // If we have not started yet, return 1 (because then I don't // have to change the FPS calculation in CoreRerecording.cpp . - if (m_StartTime == 0) return 1; + if (m_StartTime == 0) + return 1; // Return the final timer time if the timer is stopped - if (!m_Running) return (m_LastTime - m_StartTime); + if (!m_Running) + return (m_LastTime - m_StartTime); return (GetTimeMs() - m_StartTime); } // Get the formatted time elapsed since the Start() -std::string Timer::GetTimeElapsedFormatted() const -{ +std::string Timer::GetTimeElapsedFormatted() const { // If we have not started yet, return zero if (m_StartTime == 0) return "00:00:00:000"; @@ -114,50 +105,46 @@ std::string Timer::GetTimeElapsedFormatted() const // Hours u32 Hours = Minutes / 60; - std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i", - Hours, Minutes % 60, Seconds % 60, Milliseconds % 1000); + std::string TmpStr = StringFromFormat("%02i:%02i:%02i:%03i", Hours, Minutes % 60, Seconds % 60, + Milliseconds % 1000); return TmpStr; } // Get current time -void Timer::IncreaseResolution() -{ +void Timer::IncreaseResolution() { #ifdef _WIN32 timeBeginPeriod(1); #endif } -void Timer::RestoreResolution() -{ +void Timer::RestoreResolution() { #ifdef _WIN32 timeEndPeriod(1); #endif } // Get the number of seconds since January 1 1970 -u64 Timer::GetTimeSinceJan1970() -{ +u64 Timer::GetTimeSinceJan1970() { time_t ltime; time(<ime); - return((u64)ltime); + return ((u64)ltime); } -u64 Timer::GetLocalTimeSinceJan1970() -{ +u64 Timer::GetLocalTimeSinceJan1970() { time_t sysTime, tzDiff, tzDST; - struct tm * gmTime; + struct tm* gmTime; time(&sysTime); // Account for DST where needed gmTime = localtime(&sysTime); - if(gmTime->tm_isdst == 1) + if (gmTime->tm_isdst == 1) tzDST = 3600; else tzDST = 0; // Lazy way to get local time in sec - gmTime = gmtime(&sysTime); + gmTime = gmtime(&sysTime); tzDiff = sysTime - mktime(gmTime); return (u64)(sysTime + tzDiff + tzDST); @@ -165,10 +152,9 @@ u64 Timer::GetLocalTimeSinceJan1970() // Return the current time formatted as Minutes:Seconds:Milliseconds // in the form 00:00:000. -std::string Timer::GetTimeFormatted() -{ +std::string Timer::GetTimeFormatted() { time_t sysTime; - struct tm * gmTime; + struct tm* gmTime; char tmp[13]; time(&sysTime); @@ -176,7 +162,7 @@ std::string Timer::GetTimeFormatted() strftime(tmp, 6, "%M:%S", gmTime); - // Now tack on the milliseconds +// Now tack on the milliseconds #ifdef _WIN32 struct timeb tp; (void)::ftime(&tp); @@ -190,8 +176,7 @@ std::string Timer::GetTimeFormatted() // Returns a timestamp with decimals for precise time comparisons // ---------------- -double Timer::GetDoubleTime() -{ +double Timer::GetDoubleTime() { #ifdef _WIN32 struct timeb tp; (void)::ftime(&tp); diff --git a/src/common/timer.h b/src/common/timer.h index b5f0f2585..78d37426b 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -4,13 +4,11 @@ #pragma once -#include "common/common_types.h" #include +#include "common/common_types.h" -namespace Common -{ -class Timer -{ +namespace Common { +class Timer { public: Timer(); @@ -18,7 +16,8 @@ public: void Stop(); void Update(); - // The time difference is always returned in milliseconds, regardless of alternative internal representation + // The time difference is always returned in milliseconds, regardless of alternative internal + // representation u64 GetTimeDifference(); void AddTimeDifference(); diff --git a/src/common/vector_math.h b/src/common/vector_math.h index cfb9481b6..b2d630829 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -1,7 +1,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. - // Copyright 2014 Tony Wasserka // All rights reserved. // @@ -36,158 +35,178 @@ namespace Math { -template class Vec2; -template class Vec3; -template class Vec4; +template +class Vec2; +template +class Vec3; +template +class Vec4; -template +template static inline Vec2 MakeVec(const T& x, const T& y); -template +template static inline Vec3 MakeVec(const T& x, const T& y, const T& z); -template +template static inline Vec4 MakeVec(const T& x, const T& y, const T& z, const T& w); - -template +template class Vec2 { public: T x; T y; - T* AsArray() { return &x; } + T* AsArray() { + return &x; + } Vec2() = default; - Vec2(const T a[2]) : x(a[0]), y(a[1]) {} - Vec2(const T& _x, const T& _y) : x(_x), y(_y) {} + Vec2(const T a[2]) : x(a[0]), y(a[1]) { + } + Vec2(const T& _x, const T& _y) : x(_x), y(_y) { + } - template + template Vec2 Cast() const { return Vec2((T2)x, (T2)y); } - static Vec2 AssignToAll(const T& f) - { + static Vec2 AssignToAll(const T& f) { return Vec2(f, f); } - void Write(T a[2]) - { - a[0] = x; a[1] = y; + void Write(T a[2]) { + a[0] = x; + a[1] = y; } - Vec2 operator +(const Vec2& other) const - { - return MakeVec(x+other.x, y+other.y); + Vec2 operator+(const Vec2& other) const { + return MakeVec(x + other.x, y + other.y); } - void operator += (const Vec2 &other) - { - x+=other.x; y+=other.y; + void operator+=(const Vec2& other) { + x += other.x; + y += other.y; } - Vec2 operator -(const Vec2& other) const - { - return MakeVec(x-other.x, y-other.y); + Vec2 operator-(const Vec2& other) const { + return MakeVec(x - other.x, y - other.y); } - void operator -= (const Vec2& other) - { - x-=other.x; y-=other.y; + void operator-=(const Vec2& other) { + x -= other.x; + y -= other.y; } - template::value>::type> - Vec2 operator -() const - { - return MakeVec(-x,-y); + template ::value>::type> + Vec2 operator-() const { + return MakeVec(-x, -y); } - Vec2 operator * (const Vec2& other) const - { - return MakeVec(x*other.x, y*other.y); + Vec2 operator*(const Vec2& other) const { + return MakeVec(x * other.x, y * other.y); } - template - Vec2 operator * (const V& f) const - { - return MakeVec(x*f,y*f); + template + Vec2 operator*(const V& f) const { + return MakeVec(x * f, y * f); } - template - void operator *= (const V& f) - { - x*=f; y*=f; + template + void operator*=(const V& f) { + x *= f; + y *= f; } - template - Vec2 operator / (const V& f) const - { - return MakeVec(x/f,y/f); + template + Vec2 operator/(const V& f) const { + return MakeVec(x / f, y / f); } - template - void operator /= (const V& f) - { + template + void operator/=(const V& f) { *this = *this / f; } - T Length2() const - { - return x*x + y*y; + T Length2() const { + return x * x + y * y; } // Only implemented for T=float float Length() const; void SetLength(const float l); Vec2 WithLength(const float l) const; - float Distance2To(Vec2 &other); + float Distance2To(Vec2& other); Vec2 Normalized() const; float Normalize(); // returns the previous length, which is often useful - T& operator [] (int i) //allow vector[1] = 3 (vector.y=3) + T& operator[](int i) // allow vector[1] = 3 (vector.y=3) { return *((&x) + i); } - T operator [] (const int i) const - { + T operator[](const int i) const { return *((&x) + i); } - void SetZero() - { - x=0; y=0; + void SetZero() { + x = 0; + y = 0; } // Common aliases: UV (texel coordinates), ST (texture coordinates) - T& u() { return x; } - T& v() { return y; } - T& s() { return x; } - T& t() { return y; } + T& u() { + return x; + } + T& v() { + return y; + } + T& s() { + return x; + } + T& t() { + return y; + } - const T& u() const { return x; } - const T& v() const { return y; } - const T& s() const { return x; } - const T& t() const { return y; } + const T& u() const { + return x; + } + const T& v() const { + return y; + } + const T& s() const { + return x; + } + const T& t() const { + return y; + } // swizzlers - create a subvector of specific components - const Vec2 yx() const { return Vec2(y, x); } - const Vec2 vu() const { return Vec2(y, x); } - const Vec2 ts() const { return Vec2(y, x); } + const Vec2 yx() const { + return Vec2(y, x); + } + const Vec2 vu() const { + return Vec2(y, x); + } + const Vec2 ts() const { + return Vec2(y, x); + } }; -template -Vec2 operator * (const V& f, const Vec2& vec) -{ - return Vec2(f*vec.x,f*vec.y); +template +Vec2 operator*(const V& f, const Vec2& vec) { + return Vec2(f * vec.x, f * vec.y); } typedef Vec2 Vec2f; -template -class Vec3 -{ +template +class Vec3 { public: T x; T y; T z; - T* AsArray() { return &x; } + T* AsArray() { + return &x; + } Vec3() = default; - Vec3(const T a[3]) : x(a[0]), y(a[1]), z(a[2]) {} - Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) {} + Vec3(const T a[3]) : x(a[0]), y(a[1]), z(a[2]) { + } + Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) { + } - template + template Vec3 Cast() const { return MakeVec((T2)x, (T2)y, (T2)z); } @@ -196,126 +215,161 @@ public: static Vec3 FromRGB(unsigned int rgb); unsigned int ToRGB() const; // alpha bits set to zero - static Vec3 AssignToAll(const T& f) - { + static Vec3 AssignToAll(const T& f) { return MakeVec(f, f, f); } - void Write(T a[3]) - { - a[0] = x; a[1] = y; a[2] = z; + void Write(T a[3]) { + a[0] = x; + a[1] = y; + a[2] = z; } - Vec3 operator +(const Vec3 &other) const - { - return MakeVec(x+other.x, y+other.y, z+other.z); + Vec3 operator+(const Vec3& other) const { + return MakeVec(x + other.x, y + other.y, z + other.z); } - void operator += (const Vec3 &other) - { - x+=other.x; y+=other.y; z+=other.z; + void operator+=(const Vec3& other) { + x += other.x; + y += other.y; + z += other.z; } - Vec3 operator -(const Vec3 &other) const - { - return MakeVec(x-other.x, y-other.y, z-other.z); + Vec3 operator-(const Vec3& other) const { + return MakeVec(x - other.x, y - other.y, z - other.z); } - void operator -= (const Vec3 &other) - { - x-=other.x; y-=other.y; z-=other.z; + void operator-=(const Vec3& other) { + x -= other.x; + y -= other.y; + z -= other.z; } - template::value>::type> - Vec3 operator -() const - { - return MakeVec(-x,-y,-z); + template ::value>::type> + Vec3 operator-() const { + return MakeVec(-x, -y, -z); } - Vec3 operator * (const Vec3 &other) const - { - return MakeVec(x*other.x, y*other.y, z*other.z); + Vec3 operator*(const Vec3& other) const { + return MakeVec(x * other.x, y * other.y, z * other.z); } - template - Vec3 operator * (const V& f) const - { - return MakeVec(x*f,y*f,z*f); + template + Vec3 operator*(const V& f) const { + return MakeVec(x * f, y * f, z * f); } - template - void operator *= (const V& f) - { - x*=f; y*=f; z*=f; + template + void operator*=(const V& f) { + x *= f; + y *= f; + z *= f; } - template - Vec3 operator / (const V& f) const - { - return MakeVec(x/f,y/f,z/f); + template + Vec3 operator/(const V& f) const { + return MakeVec(x / f, y / f, z / f); } - template - void operator /= (const V& f) - { + template + void operator/=(const V& f) { *this = *this / f; } - T Length2() const - { - return x*x + y*y + z*z; + T Length2() const { + return x * x + y * y + z * z; } // Only implemented for T=float float Length() const; void SetLength(const float l); Vec3 WithLength(const float l) const; - float Distance2To(Vec3 &other); + float Distance2To(Vec3& other); Vec3 Normalized() const; float Normalize(); // returns the previous length, which is often useful - T& operator [] (int i) //allow vector[2] = 3 (vector.z=3) + T& operator[](int i) // allow vector[2] = 3 (vector.z=3) { return *((&x) + i); } - T operator [] (const int i) const - { + T operator[](const int i) const { return *((&x) + i); } - void SetZero() - { - x=0; y=0; z=0; + void SetZero() { + x = 0; + y = 0; + z = 0; } // Common aliases: UVW (texel coordinates), RGB (colors), STQ (texture coordinates) - T& u() { return x; } - T& v() { return y; } - T& w() { return z; } + T& u() { + return x; + } + T& v() { + return y; + } + T& w() { + return z; + } - T& r() { return x; } - T& g() { return y; } - T& b() { return z; } + T& r() { + return x; + } + T& g() { + return y; + } + T& b() { + return z; + } - T& s() { return x; } - T& t() { return y; } - T& q() { return z; } + T& s() { + return x; + } + T& t() { + return y; + } + T& q() { + return z; + } - const T& u() const { return x; } - const T& v() const { return y; } - const T& w() const { return z; } + const T& u() const { + return x; + } + const T& v() const { + return y; + } + const T& w() const { + return z; + } - const T& r() const { return x; } - const T& g() const { return y; } - const T& b() const { return z; } + const T& r() const { + return x; + } + const T& g() const { + return y; + } + const T& b() const { + return z; + } - const T& s() const { return x; } - const T& t() const { return y; } - const T& q() const { return z; } + const T& s() const { + return x; + } + const T& t() const { + return y; + } + const T& q() const { + return z; + } - // swizzlers - create a subvector of specific components - // e.g. Vec2 uv() { return Vec2(x,y); } - // _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all component names (x<->r) and permutations (xy<->yx) -#define _DEFINE_SWIZZLER2(a, b, name) const Vec2 name() const { return Vec2(a, b); } -#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ - _DEFINE_SWIZZLER2(a, b, a##b); \ - _DEFINE_SWIZZLER2(a, b, a2##b2); \ - _DEFINE_SWIZZLER2(a, b, a3##b3); \ - _DEFINE_SWIZZLER2(a, b, a4##b4); \ - _DEFINE_SWIZZLER2(b, a, b##a); \ - _DEFINE_SWIZZLER2(b, a, b2##a2); \ - _DEFINE_SWIZZLER2(b, a, b3##a3); \ +// swizzlers - create a subvector of specific components +// e.g. Vec2 uv() { return Vec2(x,y); } +// _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all +// component names (x<->r) and permutations (xy<->yx) +#define _DEFINE_SWIZZLER2(a, b, name) \ + const Vec2 name() const { \ + return Vec2(a, b); \ + } +#define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ + _DEFINE_SWIZZLER2(a, b, a##b); \ + _DEFINE_SWIZZLER2(a, b, a2##b2); \ + _DEFINE_SWIZZLER2(a, b, a3##b3); \ + _DEFINE_SWIZZLER2(a, b, a4##b4); \ + _DEFINE_SWIZZLER2(b, a, b##a); \ + _DEFINE_SWIZZLER2(b, a, b2##a2); \ + _DEFINE_SWIZZLER2(b, a, b3##a3); \ _DEFINE_SWIZZLER2(b, a, b4##a4) DEFINE_SWIZZLER2(x, y, r, g, u, v, s, t); @@ -325,41 +379,42 @@ public: #undef _DEFINE_SWIZZLER2 }; -template -Vec3 operator * (const V& f, const Vec3& vec) -{ - return Vec3(f*vec.x,f*vec.y,f*vec.z); +template +Vec3 operator*(const V& f, const Vec3& vec) { + return Vec3(f * vec.x, f * vec.y, f * vec.z); } -template<> +template <> inline float Vec3::Length() const { return std::sqrt(x * x + y * y + z * z); } -template<> +template <> inline Vec3 Vec3::Normalized() const { return *this / Length(); } - typedef Vec3 Vec3f; -template -class Vec4 -{ +template +class Vec4 { public: T x; T y; T z; T w; - T* AsArray() { return &x; } + T* AsArray() { + return &x; + } Vec4() = default; - Vec4(const T a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3]) {} - Vec4(const T& _x, const T& _y, const T& _z, const T& _w) : x(_x), y(_y), z(_z), w(_w) {} + Vec4(const T a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3]) { + } + Vec4(const T& _x, const T& _y, const T& _z, const T& _w) : x(_x), y(_y), z(_z), w(_w) { + } - template + template Vec4 Cast() const { return Vec4((T2)x, (T2)y, (T2)z, (T2)w); } @@ -372,81 +427,79 @@ public: return Vec4(f, f, f, f); } - void Write(T a[4]) - { - a[0] = x; a[1] = y; a[2] = z; a[3] = w; + void Write(T a[4]) { + a[0] = x; + a[1] = y; + a[2] = z; + a[3] = w; } - Vec4 operator +(const Vec4& other) const - { - return MakeVec(x+other.x, y+other.y, z+other.z, w+other.w); + Vec4 operator+(const Vec4& other) const { + return MakeVec(x + other.x, y + other.y, z + other.z, w + other.w); } - void operator += (const Vec4& other) - { - x+=other.x; y+=other.y; z+=other.z; w+=other.w; + void operator+=(const Vec4& other) { + x += other.x; + y += other.y; + z += other.z; + w += other.w; } - Vec4 operator -(const Vec4 &other) const - { - return MakeVec(x-other.x, y-other.y, z-other.z, w-other.w); + Vec4 operator-(const Vec4& other) const { + return MakeVec(x - other.x, y - other.y, z - other.z, w - other.w); } - void operator -= (const Vec4 &other) - { - x-=other.x; y-=other.y; z-=other.z; w-=other.w; + void operator-=(const Vec4& other) { + x -= other.x; + y -= other.y; + z -= other.z; + w -= other.w; } - template::value>::type> - Vec4 operator -() const - { - return MakeVec(-x,-y,-z,-w); + template ::value>::type> + Vec4 operator-() const { + return MakeVec(-x, -y, -z, -w); } - Vec4 operator * (const Vec4 &other) const - { - return MakeVec(x*other.x, y*other.y, z*other.z, w*other.w); + Vec4 operator*(const Vec4& other) const { + return MakeVec(x * other.x, y * other.y, z * other.z, w * other.w); } - template - Vec4 operator * (const V& f) const - { - return MakeVec(x*f,y*f,z*f,w*f); + template + Vec4 operator*(const V& f) const { + return MakeVec(x * f, y * f, z * f, w * f); } - template - void operator *= (const V& f) - { - x*=f; y*=f; z*=f; w*=f; + template + void operator*=(const V& f) { + x *= f; + y *= f; + z *= f; + w *= f; } - template - Vec4 operator / (const V& f) const - { - return MakeVec(x/f,y/f,z/f,w/f); + template + Vec4 operator/(const V& f) const { + return MakeVec(x / f, y / f, z / f, w / f); } - template - void operator /= (const V& f) - { + template + void operator/=(const V& f) { *this = *this / f; } - T Length2() const - { - return x*x + y*y + z*z + w*w; + T Length2() const { + return x * x + y * y + z * z + w * w; } // Only implemented for T=float float Length() const; void SetLength(const float l); Vec4 WithLength(const float l) const; - float Distance2To(Vec4 &other); + float Distance2To(Vec4& other); Vec4 Normalized() const; float Normalize(); // returns the previous length, which is often useful - T& operator [] (int i) //allow vector[2] = 3 (vector.z=3) + T& operator[](int i) // allow vector[2] = 3 (vector.z=3) { return *((&x) + i); } - T operator [] (const int i) const - { + T operator[](const int i) const { return *((&x) + i); } - void SetZero() - { + void SetZero() { x = 0; y = 0; z = 0; @@ -454,30 +507,50 @@ public: } // Common alias: RGBA (colors) - T& r() { return x; } - T& g() { return y; } - T& b() { return z; } - T& a() { return w; } - - const T& r() const { return x; } - const T& g() const { return y; } - const T& b() const { return z; } - const T& a() const { return w; } - - // Swizzlers - Create a subvector of specific components - // e.g. Vec2 uv() { return Vec2(x,y); } - - // _DEFINE_SWIZZLER2 defines a single such function - // DEFINE_SWIZZLER2_COMP1 defines one-component functions for all component names (x<->r) - // DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and permutations (xy<->yx) -#define _DEFINE_SWIZZLER2(a, b, name) const Vec2 name() const { return Vec2(a, b); } -#define DEFINE_SWIZZLER2_COMP1(a, a2) \ - _DEFINE_SWIZZLER2(a, a, a##a); \ + T& r() { + return x; + } + T& g() { + return y; + } + T& b() { + return z; + } + T& a() { + return w; + } + + const T& r() const { + return x; + } + const T& g() const { + return y; + } + const T& b() const { + return z; + } + const T& a() const { + return w; + } + +// Swizzlers - Create a subvector of specific components +// e.g. Vec2 uv() { return Vec2(x,y); } + +// _DEFINE_SWIZZLER2 defines a single such function +// DEFINE_SWIZZLER2_COMP1 defines one-component functions for all component names (x<->r) +// DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and +// permutations (xy<->yx) +#define _DEFINE_SWIZZLER2(a, b, name) \ + const Vec2 name() const { \ + return Vec2(a, b); \ + } +#define DEFINE_SWIZZLER2_COMP1(a, a2) \ + _DEFINE_SWIZZLER2(a, a, a##a); \ _DEFINE_SWIZZLER2(a, a, a2##a2) -#define DEFINE_SWIZZLER2_COMP2(a, b, a2, b2) \ - _DEFINE_SWIZZLER2(a, b, a##b); \ - _DEFINE_SWIZZLER2(a, b, a2##b2); \ - _DEFINE_SWIZZLER2(b, a, b##a); \ +#define DEFINE_SWIZZLER2_COMP2(a, b, a2, b2) \ + _DEFINE_SWIZZLER2(a, b, a##b); \ + _DEFINE_SWIZZLER2(a, b, a2##b2); \ + _DEFINE_SWIZZLER2(b, a, b##a); \ _DEFINE_SWIZZLER2(b, a, b2##a2) DEFINE_SWIZZLER2_COMP2(x, y, r, g); @@ -494,22 +567,25 @@ public: #undef DEFINE_SWIZZLER2_COMP2 #undef _DEFINE_SWIZZLER2 -#define _DEFINE_SWIZZLER3(a, b, c, name) const Vec3 name() const { return Vec3(a, b, c); } -#define DEFINE_SWIZZLER3_COMP1(a, a2) \ - _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ +#define _DEFINE_SWIZZLER3(a, b, c, name) \ + const Vec3 name() const { \ + return Vec3(a, b, c); \ + } +#define DEFINE_SWIZZLER3_COMP1(a, a2) \ + _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ _DEFINE_SWIZZLER3(a, a, a, a2##a2##a2) -#define DEFINE_SWIZZLER3_COMP3(a, b, c, a2, b2, c2) \ - _DEFINE_SWIZZLER3(a, b, c, a##b##c); \ - _DEFINE_SWIZZLER3(a, c, b, a##c##b); \ - _DEFINE_SWIZZLER3(b, a, c, b##a##c); \ - _DEFINE_SWIZZLER3(b, c, a, b##c##a); \ - _DEFINE_SWIZZLER3(c, a, b, c##a##b); \ - _DEFINE_SWIZZLER3(c, b, a, c##b##a); \ - _DEFINE_SWIZZLER3(a, b, c, a2##b2##c2); \ - _DEFINE_SWIZZLER3(a, c, b, a2##c2##b2); \ - _DEFINE_SWIZZLER3(b, a, c, b2##a2##c2); \ - _DEFINE_SWIZZLER3(b, c, a, b2##c2##a2); \ - _DEFINE_SWIZZLER3(c, a, b, c2##a2##b2); \ +#define DEFINE_SWIZZLER3_COMP3(a, b, c, a2, b2, c2) \ + _DEFINE_SWIZZLER3(a, b, c, a##b##c); \ + _DEFINE_SWIZZLER3(a, c, b, a##c##b); \ + _DEFINE_SWIZZLER3(b, a, c, b##a##c); \ + _DEFINE_SWIZZLER3(b, c, a, b##c##a); \ + _DEFINE_SWIZZLER3(c, a, b, c##a##b); \ + _DEFINE_SWIZZLER3(c, b, a, c##b##a); \ + _DEFINE_SWIZZLER3(a, b, c, a2##b2##c2); \ + _DEFINE_SWIZZLER3(a, c, b, a2##c2##b2); \ + _DEFINE_SWIZZLER3(b, a, c, b2##a2##c2); \ + _DEFINE_SWIZZLER3(b, c, a, b2##c2##a2); \ + _DEFINE_SWIZZLER3(c, a, b, c2##a2##b2); \ _DEFINE_SWIZZLER3(c, b, a, c2##b2##a2) DEFINE_SWIZZLER3_COMP3(x, y, z, r, g, b); @@ -525,123 +601,104 @@ public: #undef _DEFINE_SWIZZLER3 }; - -template -Vec4 operator * (const V& f, const Vec4& vec) -{ - return MakeVec(f*vec.x,f*vec.y,f*vec.z,f*vec.w); +template +Vec4 operator*(const V& f, const Vec4& vec) { + return MakeVec(f * vec.x, f * vec.y, f * vec.z, f * vec.w); } typedef Vec4 Vec4f; - -template -static inline decltype(T{}*T{}+T{}*T{}) Dot(const Vec2& a, const Vec2& b) -{ - return a.x*b.x + a.y*b.y; +template +static inline decltype(T{} * T{} + T{} * T{}) Dot(const Vec2& a, const Vec2& b) { + return a.x * b.x + a.y * b.y; } -template -static inline decltype(T{}*T{}+T{}*T{}) Dot(const Vec3& a, const Vec3& b) -{ - return a.x*b.x + a.y*b.y + a.z*b.z; +template +static inline decltype(T{} * T{} + T{} * T{}) Dot(const Vec3& a, const Vec3& b) { + return a.x * b.x + a.y * b.y + a.z * b.z; } -template -static inline decltype(T{}*T{}+T{}*T{}) Dot(const Vec4& a, const Vec4& b) -{ - return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w; +template +static inline decltype(T{} * T{} + T{} * T{}) Dot(const Vec4& a, const Vec4& b) { + return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; } -template -static inline Vec3 Cross(const Vec3& a, const Vec3& b) -{ - return MakeVec(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); +template +static inline Vec3 Cross(const Vec3& a, const Vec3& b) { + return MakeVec(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } // linear interpolation via float: 0.0=begin, 1.0=end -template -static inline decltype(X{}*float{}+X{}*float{}) Lerp(const X& begin, const X& end, const float t) -{ - return begin*(1.f-t) + end*t; +template +static inline decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, + const float t) { + return begin * (1.f - t) + end * t; } // linear interpolation via int: 0=begin, base=end -template -static inline decltype((X{}*int{}+X{}*int{}) / base) LerpInt(const X& begin, const X& end, const int t) -{ - return (begin*(base-t) + end*t) / base; +template +static inline decltype((X{} * int{} + X{} * int{}) / base) LerpInt(const X& begin, const X& end, + const int t) { + return (begin * (base - t) + end * t) / base; } // Utility vector factories -template -static inline Vec2 MakeVec(const T& x, const T& y) -{ +template +static inline Vec2 MakeVec(const T& x, const T& y) { return Vec2{x, y}; } -template -static inline Vec3 MakeVec(const T& x, const T& y, const T& z) -{ +template +static inline Vec3 MakeVec(const T& x, const T& y, const T& z) { return Vec3{x, y, z}; } -template -static inline Vec4 MakeVec(const T& x, const T& y, const Vec2& zw) -{ +template +static inline Vec4 MakeVec(const T& x, const T& y, const Vec2& zw) { return MakeVec(x, y, zw[0], zw[1]); } -template -static inline Vec3 MakeVec(const Vec2& xy, const T& z) -{ +template +static inline Vec3 MakeVec(const Vec2& xy, const T& z) { return MakeVec(xy[0], xy[1], z); } -template -static inline Vec3 MakeVec(const T& x, const Vec2& yz) -{ +template +static inline Vec3 MakeVec(const T& x, const Vec2& yz) { return MakeVec(x, yz[0], yz[1]); } -template -static inline Vec4 MakeVec(const T& x, const T& y, const T& z, const T& w) -{ +template +static inline Vec4 MakeVec(const T& x, const T& y, const T& z, const T& w) { return Vec4{x, y, z, w}; } -template -static inline Vec4 MakeVec(const Vec2& xy, const T& z, const T& w) -{ +template +static inline Vec4 MakeVec(const Vec2& xy, const T& z, const T& w) { return MakeVec(xy[0], xy[1], z, w); } -template -static inline Vec4 MakeVec(const T& x, const Vec2& yz, const T& w) -{ +template +static inline Vec4 MakeVec(const T& x, const Vec2& yz, const T& w) { return MakeVec(x, yz[0], yz[1], w); } // NOTE: This has priority over "Vec2> MakeVec(const Vec2& x, const Vec2& y)". // Even if someone wanted to use an odd object like Vec2>, the compiler would error // out soon enough due to misuse of the returned structure. -template -static inline Vec4 MakeVec(const Vec2& xy, const Vec2& zw) -{ +template +static inline Vec4 MakeVec(const Vec2& xy, const Vec2& zw) { return MakeVec(xy[0], xy[1], zw[0], zw[1]); } -template -static inline Vec4 MakeVec(const Vec3& xyz, const T& w) -{ +template +static inline Vec4 MakeVec(const Vec3& xyz, const T& w) { return MakeVec(xyz[0], xyz[1], xyz[2], w); } -template -static inline Vec4 MakeVec(const T& x, const Vec3& yzw) -{ +template +static inline Vec4 MakeVec(const T& x, const Vec3& yzw) { return MakeVec(x, yzw[0], yzw[1], yzw[2]); } - } // namespace diff --git a/src/common/x64/abi.cpp b/src/common/x64/abi.cpp index 955eb86ce..504b9c940 100644 --- a/src/common/x64/abi.cpp +++ b/src/common/x64/abi.cpp @@ -22,7 +22,8 @@ using namespace Gen; // Shared code between Win64 and Unix64 -void XEmitter::ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp) { +void XEmitter::ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, + size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp) { size_t shadow = 0; #if defined(_WIN32) shadow = 0x20; @@ -49,17 +50,19 @@ void XEmitter::ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_ *xmm_offsetp = subtraction - xmm_base_subtraction; } -size_t XEmitter::ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size) { +size_t XEmitter::ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, + size_t needed_frame_size) { size_t shadow, subtraction, xmm_offset; - ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, &xmm_offset); + ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, + &xmm_offset); - for (int r : mask & ABI_ALL_GPRS) + for (int r : mask& ABI_ALL_GPRS) PUSH((X64Reg)r); if (subtraction) SUB(64, R(RSP), subtraction >= 0x80 ? Imm32((u32)subtraction) : Imm8((u8)subtraction)); - for (int x : mask & ABI_ALL_FPRS) { + for (int x : mask& ABI_ALL_FPRS) { MOVAPD(MDisp(RSP, (int)xmm_offset), (X64Reg)(x - 16)); xmm_offset += 16; } @@ -67,12 +70,14 @@ size_t XEmitter::ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_align return shadow; } -void XEmitter::ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size) { +void XEmitter::ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, + size_t needed_frame_size) { size_t shadow, subtraction, xmm_offset; - ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, &xmm_offset); + ABI_CalculateFrameSize(mask, rsp_alignment, needed_frame_size, &shadow, &subtraction, + &xmm_offset); - for (int x : mask & ABI_ALL_FPRS) { - MOVAPD((X64Reg) (x - 16), MDisp(RSP, (int)xmm_offset)); + for (int x : mask& ABI_ALL_FPRS) { + MOVAPD((X64Reg)(x - 16), MDisp(RSP, (int)xmm_offset)); xmm_offset += 16; } @@ -86,10 +91,9 @@ void XEmitter::ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignmen } // Common functions -void XEmitter::ABI_CallFunction(const void *func) { +void XEmitter::ABI_CallFunction(const void* func) { u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -98,11 +102,10 @@ void XEmitter::ABI_CallFunction(const void *func) { } } -void XEmitter::ABI_CallFunctionC16(const void *func, u16 param1) { +void XEmitter::ABI_CallFunctionC16(const void* func, u16 param1) { MOV(32, R(ABI_PARAM1), Imm32((u32)param1)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -111,25 +114,23 @@ void XEmitter::ABI_CallFunctionC16(const void *func, u16 param1) { } } -void XEmitter::ABI_CallFunctionCC16(const void *func, u32 param1, u16 param2) { +void XEmitter::ABI_CallFunctionCC16(const void* func, u32 param1, u16 param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32((u32)param2)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { - // Far call - MOV(64, R(RAX), ImmPtr(func)); - CALLptr(R(RAX)); + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { + // Far call + MOV(64, R(RAX), ImmPtr(func)); + CALLptr(R(RAX)); } else { CALL(func); } } -void XEmitter::ABI_CallFunctionC(const void *func, u32 param1) { +void XEmitter::ABI_CallFunctionC(const void* func, u32 param1) { MOV(32, R(ABI_PARAM1), Imm32(param1)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -138,12 +139,11 @@ void XEmitter::ABI_CallFunctionC(const void *func, u32 param1) { } } -void XEmitter::ABI_CallFunctionCC(const void *func, u32 param1, u32 param2) { +void XEmitter::ABI_CallFunctionCC(const void* func, u32 param1, u32 param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -152,13 +152,12 @@ void XEmitter::ABI_CallFunctionCC(const void *func, u32 param1, u32 param2) { } } -void XEmitter::ABI_CallFunctionCCC(const void *func, u32 param1, u32 param2, u32 param3) { +void XEmitter::ABI_CallFunctionCCC(const void* func, u32 param1, u32 param2, u32 param3) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -167,13 +166,12 @@ void XEmitter::ABI_CallFunctionCCC(const void *func, u32 param1, u32 param2, u32 } } -void XEmitter::ABI_CallFunctionCCP(const void *func, u32 param1, u32 param2, void *param3) { +void XEmitter::ABI_CallFunctionCCP(const void* func, u32 param1, u32 param2, void* param3) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(64, R(ABI_PARAM3), ImmPtr(param3)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -182,14 +180,14 @@ void XEmitter::ABI_CallFunctionCCP(const void *func, u32 param1, u32 param2, voi } } -void XEmitter::ABI_CallFunctionCCCP(const void *func, u32 param1, u32 param2, u32 param3, void *param4) { +void XEmitter::ABI_CallFunctionCCCP(const void* func, u32 param1, u32 param2, u32 param3, + void* param4) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); MOV(64, R(ABI_PARAM4), ImmPtr(param4)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -198,11 +196,10 @@ void XEmitter::ABI_CallFunctionCCCP(const void *func, u32 param1, u32 param2, u3 } } -void XEmitter::ABI_CallFunctionP(const void *func, void *param1) { +void XEmitter::ABI_CallFunctionP(const void* func, void* param1) { MOV(64, R(ABI_PARAM1), ImmPtr(param1)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -211,13 +208,12 @@ void XEmitter::ABI_CallFunctionP(const void *func, void *param1) { } } -void XEmitter::ABI_CallFunctionPA(const void *func, void *param1, const Gen::OpArg &arg2) { +void XEmitter::ABI_CallFunctionPA(const void* func, void* param1, const Gen::OpArg& arg2) { MOV(64, R(ABI_PARAM1), ImmPtr(param1)); if (!arg2.IsSimpleReg(ABI_PARAM2)) MOV(32, R(ABI_PARAM2), arg2); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -226,15 +222,15 @@ void XEmitter::ABI_CallFunctionPA(const void *func, void *param1, const Gen::OpA } } -void XEmitter::ABI_CallFunctionPAA(const void *func, void *param1, const Gen::OpArg &arg2, const Gen::OpArg &arg3) { +void XEmitter::ABI_CallFunctionPAA(const void* func, void* param1, const Gen::OpArg& arg2, + const Gen::OpArg& arg3) { MOV(64, R(ABI_PARAM1), ImmPtr(param1)); if (!arg2.IsSimpleReg(ABI_PARAM2)) MOV(32, R(ABI_PARAM2), arg2); if (!arg3.IsSimpleReg(ABI_PARAM3)) MOV(32, R(ABI_PARAM3), arg3); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -243,13 +239,12 @@ void XEmitter::ABI_CallFunctionPAA(const void *func, void *param1, const Gen::Op } } -void XEmitter::ABI_CallFunctionPPC(const void *func, void *param1, void *param2, u32 param3) { +void XEmitter::ABI_CallFunctionPPC(const void* func, void* param1, void* param2, u32 param3) { MOV(64, R(ABI_PARAM1), ImmPtr(param1)); MOV(64, R(ABI_PARAM2), ImmPtr(param2)); MOV(32, R(ABI_PARAM3), Imm32(param3)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -259,12 +254,11 @@ void XEmitter::ABI_CallFunctionPPC(const void *func, void *param1, void *param2, } // Pass a register as a parameter. -void XEmitter::ABI_CallFunctionR(const void *func, X64Reg reg1) { +void XEmitter::ABI_CallFunctionR(const void* func, X64Reg reg1) { if (reg1 != ABI_PARAM1) MOV(32, R(ABI_PARAM1), R(reg1)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -274,7 +268,7 @@ void XEmitter::ABI_CallFunctionR(const void *func, X64Reg reg1) { } // Pass two registers as parameters. -void XEmitter::ABI_CallFunctionRR(const void *func, X64Reg reg1, X64Reg reg2) { +void XEmitter::ABI_CallFunctionRR(const void* func, X64Reg reg1, X64Reg reg2) { if (reg2 != ABI_PARAM1) { if (reg1 != ABI_PARAM1) MOV(64, R(ABI_PARAM1), R(reg1)); @@ -287,8 +281,7 @@ void XEmitter::ABI_CallFunctionRR(const void *func, X64Reg reg1, X64Reg reg2) { MOV(64, R(ABI_PARAM1), R(reg1)); } u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -297,14 +290,12 @@ void XEmitter::ABI_CallFunctionRR(const void *func, X64Reg reg1, X64Reg reg2) { } } -void XEmitter::ABI_CallFunctionAC(const void *func, const Gen::OpArg &arg1, u32 param2) -{ +void XEmitter::ABI_CallFunctionAC(const void* func, const Gen::OpArg& arg1, u32 param2) { if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); MOV(32, R(ABI_PARAM2), Imm32(param2)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -313,15 +304,14 @@ void XEmitter::ABI_CallFunctionAC(const void *func, const Gen::OpArg &arg1, u32 } } -void XEmitter::ABI_CallFunctionACC(const void *func, const Gen::OpArg &arg1, u32 param2, u32 param3) -{ +void XEmitter::ABI_CallFunctionACC(const void* func, const Gen::OpArg& arg1, u32 param2, + u32 param3) { if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(64, R(ABI_PARAM3), Imm64(param3)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -330,13 +320,11 @@ void XEmitter::ABI_CallFunctionACC(const void *func, const Gen::OpArg &arg1, u32 } } -void XEmitter::ABI_CallFunctionA(const void *func, const Gen::OpArg &arg1) -{ +void XEmitter::ABI_CallFunctionA(const void* func, const Gen::OpArg& arg1) { if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); @@ -345,15 +333,14 @@ void XEmitter::ABI_CallFunctionA(const void *func, const Gen::OpArg &arg1) } } -void XEmitter::ABI_CallFunctionAA(const void *func, const Gen::OpArg &arg1, const Gen::OpArg &arg2) -{ +void XEmitter::ABI_CallFunctionAA(const void* func, const Gen::OpArg& arg1, + const Gen::OpArg& arg2) { if (!arg1.IsSimpleReg(ABI_PARAM1)) MOV(32, R(ABI_PARAM1), arg1); if (!arg2.IsSimpleReg(ABI_PARAM2)) MOV(32, R(ABI_PARAM2), arg2); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) { // Far call MOV(64, R(RAX), ImmPtr(func)); CALLptr(R(RAX)); diff --git a/src/common/x64/abi.h b/src/common/x64/abi.h index de6d62fdd..eaaf81d89 100644 --- a/src/common/x64/abi.h +++ b/src/common/x64/abi.h @@ -12,7 +12,8 @@ // Windows 64-bit // * 4-reg "fastcall" variant, very new-skool stack handling -// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_ +// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself +// calls_ // * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space. // Scratch: RAX RCX RDX R8 R9 R10 R11 // Callee-save: RBX RSI RDI RBP R12 R13 R14 R15 @@ -35,10 +36,10 @@ #define ABI_PARAM4 R9 // xmm0-xmm15 use the upper 16 bits in the functions that push/pop registers. -#define ABI_ALL_CALLER_SAVED \ - (BitSet32 { RAX, RCX, RDX, R8, R9, R10, R11, \ - XMM0+16, XMM1+16, XMM2+16, XMM3+16, XMM4+16, XMM5+16 }) -#else //64-bit Unix / OS X +#define ABI_ALL_CALLER_SAVED \ + (BitSet32{RAX, RCX, RDX, R8, R9, R10, R11, XMM0 + 16, XMM1 + 16, XMM2 + 16, XMM3 + 16, \ + XMM4 + 16, XMM5 + 16}) +#else // 64-bit Unix / OS X #define ABI_PARAM1 RDI #define ABI_PARAM2 RSI @@ -49,9 +50,7 @@ // TODO: Avoid pushing all 16 XMM registers when possible. Most functions we call probably // don't actually clobber them. -#define ABI_ALL_CALLER_SAVED \ - (BitSet32 { RAX, RCX, RDX, RDI, RSI, R8, R9, R10, R11 } | \ - ABI_ALL_FPRS) +#define ABI_ALL_CALLER_SAVED (BitSet32{RAX, RCX, RDX, RDI, RSI, R8, R9, R10, R11} | ABI_ALL_FPRS) #endif // WIN32 #define ABI_ALL_CALLEE_SAVED (~ABI_ALL_CALLER_SAVED) diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index d9c430c67..19f1a4030 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp @@ -15,8 +15,8 @@ namespace Common { #ifndef _MSC_VER #ifdef __FreeBSD__ -#include #include +#include #endif static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { @@ -26,15 +26,9 @@ static inline void __cpuidex(int info[4], int function_id, int subfunction_id) { #else info[0] = function_id; // eax info[2] = subfunction_id; // ecx - __asm__( - "cpuid" - : "=a" (info[0]), - "=b" (info[1]), - "=c" (info[2]), - "=d" (info[3]) - : "a" (function_id), - "c" (subfunction_id) - ); + __asm__("cpuid" + : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]), "=d"(info[3]) + : "a"(function_id), "c"(subfunction_id)); #endif } @@ -88,14 +82,22 @@ static CPUCaps Detect() { if (max_std_fn >= 1) { __cpuid(cpu_id, 0x00000001); - if ((cpu_id[3] >> 25) & 1) caps.sse = true; - if ((cpu_id[3] >> 26) & 1) caps.sse2 = true; - if ((cpu_id[2]) & 1) caps.sse3 = true; - if ((cpu_id[2] >> 9) & 1) caps.ssse3 = true; - if ((cpu_id[2] >> 19) & 1) caps.sse4_1 = true; - if ((cpu_id[2] >> 20) & 1) caps.sse4_2 = true; - if ((cpu_id[2] >> 22) & 1) caps.movbe = true; - if ((cpu_id[2] >> 25) & 1) caps.aes = true; + if ((cpu_id[3] >> 25) & 1) + caps.sse = true; + if ((cpu_id[3] >> 26) & 1) + caps.sse2 = true; + if ((cpu_id[2]) & 1) + caps.sse3 = true; + if ((cpu_id[2] >> 9) & 1) + caps.ssse3 = true; + if ((cpu_id[2] >> 19) & 1) + caps.sse4_1 = true; + if ((cpu_id[2] >> 20) & 1) + caps.sse4_2 = true; + if ((cpu_id[2] >> 22) & 1) + caps.movbe = true; + if ((cpu_id[2] >> 25) & 1) + caps.aes = true; if ((cpu_id[3] >> 24) & 1) { caps.fxsave_fxrstor = true; @@ -140,10 +142,14 @@ static CPUCaps Detect() { if (max_ex_fn >= 0x80000001) { // Check for more features __cpuid(cpu_id, 0x80000001); - if (cpu_id[2] & 1) caps.lahf_sahf_64 = true; - if ((cpu_id[2] >> 5) & 1) caps.lzcnt = true; - if ((cpu_id[2] >> 16) & 1) caps.fma4 = true; - if ((cpu_id[3] >> 29) & 1) caps.long_mode = true; + if (cpu_id[2] & 1) + caps.lahf_sahf_64 = true; + if ((cpu_id[2] >> 5) & 1) + caps.lzcnt = true; + if ((cpu_id[2] >> 16) & 1) + caps.fma4 = true; + if ((cpu_id[3] >> 29) & 1) + caps.long_mode = true; } return caps; @@ -162,24 +168,38 @@ std::string GetCPUCapsString() { sum += caps.brand_string; sum += ")"; - if (caps.sse) sum += ", SSE"; + if (caps.sse) + sum += ", SSE"; if (caps.sse2) { sum += ", SSE2"; - if (!caps.flush_to_zero) sum += " (without DAZ)"; + if (!caps.flush_to_zero) + sum += " (without DAZ)"; } - if (caps.sse3) sum += ", SSE3"; - if (caps.ssse3) sum += ", SSSE3"; - if (caps.sse4_1) sum += ", SSE4.1"; - if (caps.sse4_2) sum += ", SSE4.2"; - if (caps.avx) sum += ", AVX"; - if (caps.avx2) sum += ", AVX2"; - if (caps.bmi1) sum += ", BMI1"; - if (caps.bmi2) sum += ", BMI2"; - if (caps.fma) sum += ", FMA"; - if (caps.aes) sum += ", AES"; - if (caps.movbe) sum += ", MOVBE"; - if (caps.long_mode) sum += ", 64-bit support"; + if (caps.sse3) + sum += ", SSE3"; + if (caps.ssse3) + sum += ", SSSE3"; + if (caps.sse4_1) + sum += ", SSE4.1"; + if (caps.sse4_2) + sum += ", SSE4.2"; + if (caps.avx) + sum += ", AVX"; + if (caps.avx2) + sum += ", AVX2"; + if (caps.bmi1) + sum += ", BMI1"; + if (caps.bmi2) + sum += ", BMI2"; + if (caps.fma) + sum += ", FMA"; + if (caps.aes) + sum += ", AES"; + if (caps.movbe) + sum += ", MOVBE"; + if (caps.long_mode) + sum += ", 64-bit support"; return sum; } diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp index 5662f7f86..1a9fd6a6b 100644 --- a/src/common/x64/emitter.cpp +++ b/src/common/x64/emitter.cpp @@ -26,179 +26,162 @@ #include "cpu_detect.h" #include "emitter.h" -namespace Gen -{ +namespace Gen { -struct NormalOpDef -{ +struct NormalOpDef { u8 toRm8, toRm32, fromRm8, fromRm32, imm8, imm32, simm8, eaximm8, eaximm32, ext; }; // 0xCC is code for invalid combination of immediates -static const NormalOpDef normalops[11] = -{ - {0x00, 0x01, 0x02, 0x03, 0x80, 0x81, 0x83, 0x04, 0x05, 0}, //ADD - {0x10, 0x11, 0x12, 0x13, 0x80, 0x81, 0x83, 0x14, 0x15, 2}, //ADC +static const NormalOpDef normalops[11] = { + {0x00, 0x01, 0x02, 0x03, 0x80, 0x81, 0x83, 0x04, 0x05, 0}, // ADD + {0x10, 0x11, 0x12, 0x13, 0x80, 0x81, 0x83, 0x14, 0x15, 2}, // ADC - {0x28, 0x29, 0x2A, 0x2B, 0x80, 0x81, 0x83, 0x2C, 0x2D, 5}, //SUB - {0x18, 0x19, 0x1A, 0x1B, 0x80, 0x81, 0x83, 0x1C, 0x1D, 3}, //SBB + {0x28, 0x29, 0x2A, 0x2B, 0x80, 0x81, 0x83, 0x2C, 0x2D, 5}, // SUB + {0x18, 0x19, 0x1A, 0x1B, 0x80, 0x81, 0x83, 0x1C, 0x1D, 3}, // SBB - {0x20, 0x21, 0x22, 0x23, 0x80, 0x81, 0x83, 0x24, 0x25, 4}, //AND - {0x08, 0x09, 0x0A, 0x0B, 0x80, 0x81, 0x83, 0x0C, 0x0D, 1}, //OR + {0x20, 0x21, 0x22, 0x23, 0x80, 0x81, 0x83, 0x24, 0x25, 4}, // AND + {0x08, 0x09, 0x0A, 0x0B, 0x80, 0x81, 0x83, 0x0C, 0x0D, 1}, // OR - {0x30, 0x31, 0x32, 0x33, 0x80, 0x81, 0x83, 0x34, 0x35, 6}, //XOR - {0x88, 0x89, 0x8A, 0x8B, 0xC6, 0xC7, 0xCC, 0xCC, 0xCC, 0}, //MOV + {0x30, 0x31, 0x32, 0x33, 0x80, 0x81, 0x83, 0x34, 0x35, 6}, // XOR + {0x88, 0x89, 0x8A, 0x8B, 0xC6, 0xC7, 0xCC, 0xCC, 0xCC, 0}, // MOV - {0x84, 0x85, 0x84, 0x85, 0xF6, 0xF7, 0xCC, 0xA8, 0xA9, 0}, //TEST (to == from) - {0x38, 0x39, 0x3A, 0x3B, 0x80, 0x81, 0x83, 0x3C, 0x3D, 7}, //CMP + {0x84, 0x85, 0x84, 0x85, 0xF6, 0xF7, 0xCC, 0xA8, 0xA9, 0}, // TEST (to == from) + {0x38, 0x39, 0x3A, 0x3B, 0x80, 0x81, 0x83, 0x3C, 0x3D, 7}, // CMP - {0x86, 0x87, 0x86, 0x87, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 7}, //XCHG + {0x86, 0x87, 0x86, 0x87, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 7}, // XCHG }; -enum NormalSSEOps -{ - sseCMP = 0xC2, - sseADD = 0x58, //ADD - sseSUB = 0x5C, //SUB - sseAND = 0x54, //AND - sseANDN = 0x55, //ANDN - sseOR = 0x56, - sseXOR = 0x57, - sseMUL = 0x59, //MUL - sseDIV = 0x5E, //DIV - sseMIN = 0x5D, //MIN - sseMAX = 0x5F, //MAX - sseCOMIS = 0x2F, //COMIS - sseUCOMIS = 0x2E, //UCOMIS - sseSQRT = 0x51, //SQRT - sseRSQRT = 0x52, //RSQRT (NO DOUBLE PRECISION!!!) - sseRCP = 0x53, //RCP - sseMOVAPfromRM = 0x28, //MOVAP from RM - sseMOVAPtoRM = 0x29, //MOVAP to RM - sseMOVUPfromRM = 0x10, //MOVUP from RM - sseMOVUPtoRM = 0x11, //MOVUP to RM - sseMOVLPfromRM= 0x12, - sseMOVLPtoRM = 0x13, - sseMOVHPfromRM= 0x16, - sseMOVHPtoRM = 0x17, - sseMOVHLPS = 0x12, - sseMOVLHPS = 0x16, +enum NormalSSEOps { + sseCMP = 0xC2, + sseADD = 0x58, // ADD + sseSUB = 0x5C, // SUB + sseAND = 0x54, // AND + sseANDN = 0x55, // ANDN + sseOR = 0x56, + sseXOR = 0x57, + sseMUL = 0x59, // MUL + sseDIV = 0x5E, // DIV + sseMIN = 0x5D, // MIN + sseMAX = 0x5F, // MAX + sseCOMIS = 0x2F, // COMIS + sseUCOMIS = 0x2E, // UCOMIS + sseSQRT = 0x51, // SQRT + sseRSQRT = 0x52, // RSQRT (NO DOUBLE PRECISION!!!) + sseRCP = 0x53, // RCP + sseMOVAPfromRM = 0x28, // MOVAP from RM + sseMOVAPtoRM = 0x29, // MOVAP to RM + sseMOVUPfromRM = 0x10, // MOVUP from RM + sseMOVUPtoRM = 0x11, // MOVUP to RM + sseMOVLPfromRM = 0x12, + sseMOVLPtoRM = 0x13, + sseMOVHPfromRM = 0x16, + sseMOVHPtoRM = 0x17, + sseMOVHLPS = 0x12, + sseMOVLHPS = 0x16, sseMOVDQfromRM = 0x6F, - sseMOVDQtoRM = 0x7F, - sseMASKMOVDQU = 0xF7, - sseLDDQU = 0xF0, - sseSHUF = 0xC6, - sseMOVNTDQ = 0xE7, - sseMOVNTP = 0x2B, - sseHADD = 0x7C, + sseMOVDQtoRM = 0x7F, + sseMASKMOVDQU = 0xF7, + sseLDDQU = 0xF0, + sseSHUF = 0xC6, + sseMOVNTDQ = 0xE7, + sseMOVNTP = 0x2B, + sseHADD = 0x7C, }; - -void XEmitter::SetCodePtr(u8 *ptr) -{ +void XEmitter::SetCodePtr(u8* ptr) { code = ptr; } -const u8 *XEmitter::GetCodePtr() const -{ +const u8* XEmitter::GetCodePtr() const { return code; } -u8 *XEmitter::GetWritableCodePtr() -{ +u8* XEmitter::GetWritableCodePtr() { return code; } -void XEmitter::Write8(u8 value) -{ +void XEmitter::Write8(u8 value) { *code++ = value; } -void XEmitter::Write16(u16 value) -{ +void XEmitter::Write16(u16 value) { std::memcpy(code, &value, sizeof(u16)); code += sizeof(u16); } -void XEmitter::Write32(u32 value) -{ +void XEmitter::Write32(u32 value) { std::memcpy(code, &value, sizeof(u32)); code += sizeof(u32); } -void XEmitter::Write64(u64 value) -{ +void XEmitter::Write64(u64 value) { std::memcpy(code, &value, sizeof(u64)); code += sizeof(u64); } -void XEmitter::ReserveCodeSpace(int bytes) -{ +void XEmitter::ReserveCodeSpace(int bytes) { for (int i = 0; i < bytes; i++) *code++ = 0xCC; } -const u8 *XEmitter::AlignCode4() -{ +const u8* XEmitter::AlignCode4() { int c = int((u64)code & 3); if (c) - ReserveCodeSpace(4-c); + ReserveCodeSpace(4 - c); return code; } -const u8 *XEmitter::AlignCode16() -{ +const u8* XEmitter::AlignCode16() { int c = int((u64)code & 15); if (c) - ReserveCodeSpace(16-c); + ReserveCodeSpace(16 - c); return code; } -const u8 *XEmitter::AlignCodePage() -{ +const u8* XEmitter::AlignCodePage() { int c = int((u64)code & 4095); if (c) - ReserveCodeSpace(4096-c); + ReserveCodeSpace(4096 - c); return code; } // This operation modifies flags; check to see the flags are locked. // If the flags are locked, we should immediately and loudly fail before // causing a subtle JIT bug. -void XEmitter::CheckFlags() -{ +void XEmitter::CheckFlags() { ASSERT_MSG(!flags_locked, "Attempt to modify flags while flags locked!"); } -void XEmitter::WriteModRM(int mod, int reg, int rm) -{ +void XEmitter::WriteModRM(int mod, int reg, int rm) { Write8((u8)((mod << 6) | ((reg & 7) << 3) | (rm & 7))); } -void XEmitter::WriteSIB(int scale, int index, int base) -{ +void XEmitter::WriteSIB(int scale, int index, int base) { Write8((u8)((scale << 6) | ((index & 7) << 3) | (base & 7))); } -void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const -{ - if (customOp == -1) customOp = operandReg; +void OpArg::WriteRex(XEmitter* emit, int opBits, int bits, int customOp) const { + if (customOp == -1) + customOp = operandReg; #ifdef ARCHITECTURE_x86_64 u8 op = 0x40; // REX.W (whether operation is a 64-bit operation) - if (opBits == 64) op |= 8; + if (opBits == 64) + op |= 8; // REX.R (whether ModR/M reg field refers to R8-R15. - if (customOp & 8) op |= 4; + if (customOp & 8) + op |= 4; // REX.X (whether ModR/M SIB index field refers to R8-R15) - if (indexReg & 8) op |= 2; + if (indexReg & 8) + op |= 2; // REX.B (whether ModR/M rm or SIB base or opcode reg field refers to R8-R15) - if (offsetOrBaseReg & 8) op |= 1; + if (offsetOrBaseReg & 8) + op |= 1; // Write REX if wr have REX bits to write, or if the operation accesses // SIL, DIL, BPL, or SPL. - if (op != 0x40 || - (scale == SCALE_NONE && bits == 8 && (offsetOrBaseReg & 0x10c) == 4) || - (opBits == 8 && (customOp & 0x10c) == 4)) - { + if (op != 0x40 || (scale == SCALE_NONE && bits == 8 && (offsetOrBaseReg & 0x10c) == 4) || + (opBits == 8 && (customOp & 0x10c) == 4)) { emit->Write8(op); // Check the operation doesn't access AH, BH, CH, or DH. DEBUG_ASSERT((offsetOrBaseReg & 0x100) == 0); @@ -214,8 +197,8 @@ void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const #endif } -void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp, int mmmmm, int W) const -{ +void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp, int mmmmm, + int W) const { int R = !(regOp1 & 8); int X = !(indexReg & 8); int B = !(offsetOrBaseReg & 8); @@ -223,14 +206,11 @@ void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp int vvvv = (regOp2 == X64Reg::INVALID_REG) ? 0xf : (regOp2 ^ 0xf); // do we need any VEX fields that only appear in the three-byte form? - if (X == 1 && B == 1 && W == 0 && mmmmm == 1) - { + if (X == 1 && B == 1 && W == 0 && mmmmm == 1) { u8 RvvvvLpp = (R << 7) | (vvvv << 3) | (L << 2) | pp; emit->Write8(0xC5); emit->Write8(RvvvvLpp); - } - else - { + } else { u8 RXBmmmmm = (R << 7) | (X << 6) | (B << 5) | mmmmm; u8 WvvvvLpp = (W << 7) | (vvvv << 3) | (L << 2) | pp; emit->Write8(0xC4); @@ -239,31 +219,27 @@ void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp } } -void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, - bool warn_64bit_offset) const -{ +void OpArg::WriteRest(XEmitter* emit, int extraBytes, X64Reg _operandReg, + bool warn_64bit_offset) const { if (_operandReg == INVALID_REG) - _operandReg = (X64Reg)this->operandReg; + _operandReg = (X64Reg) this->operandReg; int mod = 0; int ireg = indexReg; bool SIB = false; int _offsetOrBaseReg = this->offsetOrBaseReg; - if (scale == SCALE_RIP) //Also, on 32-bit, just an immediate address + if (scale == SCALE_RIP) // Also, on 32-bit, just an immediate address { // Oh, RIP addressing. _offsetOrBaseReg = 5; emit->WriteModRM(0, _operandReg, _offsetOrBaseReg); - //TODO : add some checks +// TODO : add some checks #ifdef ARCHITECTURE_x86_64 u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes; s64 distance = (s64)offset - (s64)ripAddr; - ASSERT_MSG( - (distance < 0x80000000LL && - distance >= -0x80000000LL) || - !warn_64bit_offset, - "WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")", - ripAddr, offset); + ASSERT_MSG((distance < 0x80000000LL && distance >= -0x80000000LL) || !warn_64bit_offset, + "WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")", ripAddr, + offset); s32 offs = (s32)distance; emit->Write32((u32)offs); #else @@ -272,66 +248,49 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, return; } - if (scale == 0) - { + if (scale == 0) { // Oh, no memory, Just a reg. - mod = 3; //11 - } - else if (scale >= 1) - { - //Ah good, no scaling. - if (scale == SCALE_ATREG && !((_offsetOrBaseReg & 7) == 4 || (_offsetOrBaseReg & 7) == 5)) - { - //Okay, we're good. No SIB necessary. + mod = 3; // 11 + } else if (scale >= 1) { + // Ah good, no scaling. + if (scale == SCALE_ATREG && !((_offsetOrBaseReg & 7) == 4 || (_offsetOrBaseReg & 7) == 5)) { + // Okay, we're good. No SIB necessary. int ioff = (int)offset; - if (ioff == 0) - { + if (ioff == 0) { mod = 0; + } else if (ioff < -128 || ioff > 127) { + mod = 2; // 32-bit displacement + } else { + mod = 1; // 8-bit displacement } - else if (ioff<-128 || ioff>127) - { - mod = 2; //32-bit displacement - } - else - { - mod = 1; //8-bit displacement - } - } - else if (scale >= SCALE_NOBASE_2 && scale <= SCALE_NOBASE_8) - { + } else if (scale >= SCALE_NOBASE_2 && scale <= SCALE_NOBASE_8) { SIB = true; mod = 0; _offsetOrBaseReg = 5; - } - else //if (scale != SCALE_ATREG) + } else // if (scale != SCALE_ATREG) { - if ((_offsetOrBaseReg & 7) == 4) //this would occupy the SIB encoding :( + if ((_offsetOrBaseReg & 7) == 4) // this would occupy the SIB encoding :( { - //So we have to fake it with SIB encoding :( + // So we have to fake it with SIB encoding :( SIB = true; } - if (scale >= SCALE_1 && scale < SCALE_ATREG) - { + if (scale >= SCALE_1 && scale < SCALE_ATREG) { SIB = true; } - if (scale == SCALE_ATREG && ((_offsetOrBaseReg & 7) == 4)) - { + if (scale == SCALE_ATREG && ((_offsetOrBaseReg & 7) == 4)) { SIB = true; ireg = _offsetOrBaseReg; } - //Okay, we're fine. Just disp encoding. - //We need displacement. Which size? + // Okay, we're fine. Just disp encoding. + // We need displacement. Which size? int ioff = (int)(s64)offset; - if (ioff < -128 || ioff > 127) - { - mod = 2; //32-bit displacement - } - else - { - mod = 1; //8-bit displacement + if (ioff < -128 || ioff > 127) { + mod = 2; // 32-bit displacement + } else { + mod = 1; // 8-bit displacement } } } @@ -343,36 +302,55 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, oreg = 4; // TODO(ector): WTF is this if about? I don't remember writing it :-) - //if (RIP) + // if (RIP) // oreg = 5; - emit->WriteModRM(mod, _operandReg&7, oreg&7); + emit->WriteModRM(mod, _operandReg & 7, oreg & 7); - if (SIB) - { - //SIB byte + if (SIB) { + // SIB byte int ss; - switch (scale) - { - case SCALE_NONE: _offsetOrBaseReg = 4; ss = 0; break; //RSP - case SCALE_1: ss = 0; break; - case SCALE_2: ss = 1; break; - case SCALE_4: ss = 2; break; - case SCALE_8: ss = 3; break; - case SCALE_NOBASE_2: ss = 1; break; - case SCALE_NOBASE_4: ss = 2; break; - case SCALE_NOBASE_8: ss = 3; break; - case SCALE_ATREG: ss = 0; break; - default: ASSERT_MSG(0, "Invalid scale for SIB byte"); ss = 0; break; + switch (scale) { + case SCALE_NONE: + _offsetOrBaseReg = 4; + ss = 0; + break; // RSP + case SCALE_1: + ss = 0; + break; + case SCALE_2: + ss = 1; + break; + case SCALE_4: + ss = 2; + break; + case SCALE_8: + ss = 3; + break; + case SCALE_NOBASE_2: + ss = 1; + break; + case SCALE_NOBASE_4: + ss = 2; + break; + case SCALE_NOBASE_8: + ss = 3; + break; + case SCALE_ATREG: + ss = 0; + break; + default: + ASSERT_MSG(0, "Invalid scale for SIB byte"); + ss = 0; + break; } - emit->Write8((u8)((ss << 6) | ((ireg&7)<<3) | (_offsetOrBaseReg&7))); + emit->Write8((u8)((ss << 6) | ((ireg & 7) << 3) | (_offsetOrBaseReg & 7))); } - if (mod == 1) //8-bit disp + if (mod == 1) // 8-bit disp { emit->Write8((u8)(s8)(s32)offset); - } - else if (mod == 2 || (scale >= SCALE_NOBASE_2 && scale <= SCALE_NOBASE_8)) //32-bit disp + } else if (mod == 2 || (scale >= SCALE_NOBASE_2 && scale <= SCALE_NOBASE_8)) // 32-bit disp { emit->Write32((u32)offset); } @@ -382,8 +360,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, // R = register# upper bit // X = scale amnt upper bit // B = base register# upper bit -void XEmitter::Rex(int w, int r, int x, int b) -{ +void XEmitter::Rex(int w, int r, int x, int b) { w = w ? 1 : 0; r = r ? 1 : 0; x = x ? 1 : 0; @@ -393,70 +370,60 @@ void XEmitter::Rex(int w, int r, int x, int b) Write8(rx); } -void XEmitter::JMP(const u8* addr, bool force5Bytes) -{ +void XEmitter::JMP(const u8* addr, bool force5Bytes) { u64 fn = (u64)addr; - if (!force5Bytes) - { + if (!force5Bytes) { s64 distance = (s64)(fn - ((u64)code + 2)); ASSERT_MSG(distance >= -0x80 && distance < 0x80, - "Jump target too far away, needs force5Bytes = true"); - //8 bits will do + "Jump target too far away, needs force5Bytes = true"); + // 8 bits will do Write8(0xEB); Write8((u8)(s8)distance); - } - else - { + } else { s64 distance = (s64)(fn - ((u64)code + 5)); - ASSERT_MSG( - distance >= -0x80000000LL && distance < 0x80000000LL, - "Jump target too far away, needs indirect register"); + ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); Write8(0xE9); Write32((u32)(s32)distance); } } -void XEmitter::JMPptr(const OpArg& arg2) -{ +void XEmitter::JMPptr(const OpArg& arg2) { OpArg arg = arg2; - if (arg.IsImm()) ASSERT_MSG(0, "JMPptr - Imm argument"); + if (arg.IsImm()) + ASSERT_MSG(0, "JMPptr - Imm argument"); arg.operandReg = 4; arg.WriteRex(this, 0, 0); Write8(0xFF); arg.WriteRest(this); } -//Can be used to trap other processors, before overwriting their code +// Can be used to trap other processors, before overwriting their code // not used in dolphin -void XEmitter::JMPself() -{ +void XEmitter::JMPself() { Write8(0xEB); Write8(0xFE); } -void XEmitter::CALLptr(OpArg arg) -{ - if (arg.IsImm()) ASSERT_MSG(0, "CALLptr - Imm argument"); +void XEmitter::CALLptr(OpArg arg) { + if (arg.IsImm()) + ASSERT_MSG(0, "CALLptr - Imm argument"); arg.operandReg = 2; arg.WriteRex(this, 0, 0); Write8(0xFF); arg.WriteRest(this); } -void XEmitter::CALL(const void* fnptr) -{ +void XEmitter::CALL(const void* fnptr) { u64 distance = u64(fnptr) - (u64(code) + 5); - ASSERT_MSG( - distance < 0x0000000080000000ULL || - distance >= 0xFFFFFFFF80000000ULL, - "CALL out of range (%p calls %p)", code, fnptr); + ASSERT_MSG(distance < 0x0000000080000000ULL || distance >= 0xFFFFFFFF80000000ULL, + "CALL out of range (%p calls %p)", code, fnptr); Write8(0xE8); Write32(u32(distance)); } -FixupBranch XEmitter::CALL() -{ +FixupBranch XEmitter::CALL() { FixupBranch branch; branch.type = 1; branch.ptr = code + 5; @@ -467,38 +434,30 @@ FixupBranch XEmitter::CALL() return branch; } -FixupBranch XEmitter::J(bool force5bytes) -{ +FixupBranch XEmitter::J(bool force5bytes) { FixupBranch branch; branch.type = force5bytes ? 1 : 0; branch.ptr = code + (force5bytes ? 5 : 2); - if (!force5bytes) - { - //8 bits will do + if (!force5bytes) { + // 8 bits will do Write8(0xEB); Write8(0); - } - else - { + } else { Write8(0xE9); Write32(0); } return branch; } -FixupBranch XEmitter::J_CC(CCFlags conditionCode, bool force5bytes) -{ +FixupBranch XEmitter::J_CC(CCFlags conditionCode, bool force5bytes) { FixupBranch branch; branch.type = force5bytes ? 1 : 0; branch.ptr = code + (force5bytes ? 6 : 2); - if (!force5bytes) - { - //8 bits will do + if (!force5bytes) { + // 8 bits will do Write8(0x70 + conditionCode); Write8(0); - } - else - { + } else { Write8(0x0F); Write8(0x80 + conditionCode); Write32(0); @@ -506,198 +465,268 @@ FixupBranch XEmitter::J_CC(CCFlags conditionCode, bool force5bytes) return branch; } -void XEmitter::J_CC(CCFlags conditionCode, const u8* addr, bool force5bytes) -{ +void XEmitter::J_CC(CCFlags conditionCode, const u8* addr, bool force5bytes) { u64 fn = (u64)addr; s64 distance = (s64)(fn - ((u64)code + 2)); - if (distance < -0x80 || distance >= 0x80 || force5bytes) - { + if (distance < -0x80 || distance >= 0x80 || force5bytes) { distance = (s64)(fn - ((u64)code + 6)); - ASSERT_MSG( - distance >= -0x80000000LL && distance < 0x80000000LL, - "Jump target too far away, needs indirect register"); + ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); Write8(0x0F); Write8(0x80 + conditionCode); Write32((u32)(s32)distance); - } - else - { + } else { Write8(0x70 + conditionCode); Write8((u8)(s8)distance); } } -void XEmitter::SetJumpTarget(const FixupBranch& branch) -{ - if (branch.type == 0) - { +void XEmitter::SetJumpTarget(const FixupBranch& branch) { + if (branch.type == 0) { s64 distance = (s64)(code - branch.ptr); - ASSERT_MSG(distance >= -0x80 && distance < 0x80, "Jump target too far away, needs force5Bytes = true"); + ASSERT_MSG(distance >= -0x80 && distance < 0x80, + "Jump target too far away, needs force5Bytes = true"); branch.ptr[-1] = (u8)(s8)distance; - } - else if (branch.type == 1) - { + } else if (branch.type == 1) { s64 distance = (s64)(code - branch.ptr); - ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target too far away, needs indirect register"); + ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); ((s32*)branch.ptr)[-1] = (s32)distance; } } -void XEmitter::SetJumpTarget(const FixupBranch& branch, const u8* target) -{ - if (branch.type == 0) - { +void XEmitter::SetJumpTarget(const FixupBranch& branch, const u8* target) { + if (branch.type == 0) { s64 distance = (s64)(target - branch.ptr); - ASSERT_MSG(distance >= -0x80 && distance < 0x80, "Jump target too far away, needs force5Bytes = true"); + ASSERT_MSG(distance >= -0x80 && distance < 0x80, + "Jump target too far away, needs force5Bytes = true"); branch.ptr[-1] = (u8)(s8)distance; - } - else if (branch.type == 1) - { + } else if (branch.type == 1) { s64 distance = (s64)(target - branch.ptr); - ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, "Jump target too far away, needs indirect register"); + ASSERT_MSG(distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); ((s32*)branch.ptr)[-1] = (s32)distance; } } -//Single byte opcodes -//There is no PUSHAD/POPAD in 64-bit mode. -void XEmitter::INT3() {Write8(0xCC);} -void XEmitter::RET() {Write8(0xC3);} -void XEmitter::RET_FAST() {Write8(0xF3); Write8(0xC3);} //two-byte return (rep ret) - recommended by AMD optimization manual for the case of jumping to a ret +// Single byte opcodes +// There is no PUSHAD/POPAD in 64-bit mode. +void XEmitter::INT3() { + Write8(0xCC); +} +void XEmitter::RET() { + Write8(0xC3); +} +void XEmitter::RET_FAST() { + Write8(0xF3); + Write8(0xC3); +} // two-byte return (rep ret) - recommended by AMD optimization manual for the case of jumping to a + // ret // The first sign of decadence: optimized NOPs. -void XEmitter::NOP(size_t size) -{ +void XEmitter::NOP(size_t size) { DEBUG_ASSERT((int)size > 0); - while (true) - { - switch (size) - { + while (true) { + switch (size) { case 0: return; case 1: Write8(0x90); return; case 2: - Write8(0x66); Write8(0x90); + Write8(0x66); + Write8(0x90); return; case 3: - Write8(0x0F); Write8(0x1F); Write8(0x00); + Write8(0x0F); + Write8(0x1F); + Write8(0x00); return; case 4: - Write8(0x0F); Write8(0x1F); Write8(0x40); Write8(0x00); + Write8(0x0F); + Write8(0x1F); + Write8(0x40); + Write8(0x00); return; case 5: - Write8(0x0F); Write8(0x1F); Write8(0x44); Write8(0x00); + Write8(0x0F); + Write8(0x1F); + Write8(0x44); + Write8(0x00); Write8(0x00); return; case 6: - Write8(0x66); Write8(0x0F); Write8(0x1F); Write8(0x44); - Write8(0x00); Write8(0x00); + Write8(0x66); + Write8(0x0F); + Write8(0x1F); + Write8(0x44); + Write8(0x00); + Write8(0x00); return; case 7: - Write8(0x0F); Write8(0x1F); Write8(0x80); Write8(0x00); - Write8(0x00); Write8(0x00); Write8(0x00); + Write8(0x0F); + Write8(0x1F); + Write8(0x80); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); return; case 8: - Write8(0x0F); Write8(0x1F); Write8(0x84); Write8(0x00); - Write8(0x00); Write8(0x00); Write8(0x00); Write8(0x00); + Write8(0x0F); + Write8(0x1F); + Write8(0x84); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); return; case 9: - Write8(0x66); Write8(0x0F); Write8(0x1F); Write8(0x84); - Write8(0x00); Write8(0x00); Write8(0x00); Write8(0x00); + Write8(0x66); + Write8(0x0F); + Write8(0x1F); + Write8(0x84); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); Write8(0x00); return; case 10: - Write8(0x66); Write8(0x66); Write8(0x0F); Write8(0x1F); - Write8(0x84); Write8(0x00); Write8(0x00); Write8(0x00); - Write8(0x00); Write8(0x00); + Write8(0x66); + Write8(0x66); + Write8(0x0F); + Write8(0x1F); + Write8(0x84); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); return; default: // Even though x86 instructions are allowed to be up to 15 bytes long, // AMD advises against using NOPs longer than 11 bytes because they // carry a performance penalty on CPUs older than AMD family 16h. - Write8(0x66); Write8(0x66); Write8(0x66); Write8(0x0F); - Write8(0x1F); Write8(0x84); Write8(0x00); Write8(0x00); - Write8(0x00); Write8(0x00); Write8(0x00); + Write8(0x66); + Write8(0x66); + Write8(0x66); + Write8(0x0F); + Write8(0x1F); + Write8(0x84); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); + Write8(0x00); size -= 11; continue; } } } -void XEmitter::PAUSE() {Write8(0xF3); NOP();} //use in tight spinloops for energy saving on some cpu -void XEmitter::CLC() {CheckFlags(); Write8(0xF8);} //clear carry -void XEmitter::CMC() {CheckFlags(); Write8(0xF5);} //flip carry -void XEmitter::STC() {CheckFlags(); Write8(0xF9);} //set carry +void XEmitter::PAUSE() { + Write8(0xF3); + NOP(); +} // use in tight spinloops for energy saving on some cpu +void XEmitter::CLC() { + CheckFlags(); + Write8(0xF8); +} // clear carry +void XEmitter::CMC() { + CheckFlags(); + Write8(0xF5); +} // flip carry +void XEmitter::STC() { + CheckFlags(); + Write8(0xF9); +} // set carry -//TODO: xchg ah, al ??? -void XEmitter::XCHG_AHAL() -{ +// TODO: xchg ah, al ??? +void XEmitter::XCHG_AHAL() { Write8(0x86); Write8(0xe0); // alt. 86 c4 } -//These two can not be executed on early Intel 64-bit CPU:s, only on AMD! -void XEmitter::LAHF() {Write8(0x9F);} -void XEmitter::SAHF() {CheckFlags(); Write8(0x9E);} +// These two can not be executed on early Intel 64-bit CPU:s, only on AMD! +void XEmitter::LAHF() { + Write8(0x9F); +} +void XEmitter::SAHF() { + CheckFlags(); + Write8(0x9E); +} -void XEmitter::PUSHF() {Write8(0x9C);} -void XEmitter::POPF() {CheckFlags(); Write8(0x9D);} +void XEmitter::PUSHF() { + Write8(0x9C); +} +void XEmitter::POPF() { + CheckFlags(); + Write8(0x9D); +} -void XEmitter::LFENCE() {Write8(0x0F); Write8(0xAE); Write8(0xE8);} -void XEmitter::MFENCE() {Write8(0x0F); Write8(0xAE); Write8(0xF0);} -void XEmitter::SFENCE() {Write8(0x0F); Write8(0xAE); Write8(0xF8);} +void XEmitter::LFENCE() { + Write8(0x0F); + Write8(0xAE); + Write8(0xE8); +} +void XEmitter::MFENCE() { + Write8(0x0F); + Write8(0xAE); + Write8(0xF0); +} +void XEmitter::SFENCE() { + Write8(0x0F); + Write8(0xAE); + Write8(0xF8); +} -void XEmitter::WriteSimple1Byte(int bits, u8 byte, X64Reg reg) -{ +void XEmitter::WriteSimple1Byte(int bits, u8 byte, X64Reg reg) { if (bits == 16) Write8(0x66); Rex(bits == 64, 0, 0, (int)reg >> 3); Write8(byte + ((int)reg & 7)); } -void XEmitter::WriteSimple2Byte(int bits, u8 byte1, u8 byte2, X64Reg reg) -{ +void XEmitter::WriteSimple2Byte(int bits, u8 byte1, u8 byte2, X64Reg reg) { if (bits == 16) Write8(0x66); - Rex(bits==64, 0, 0, (int)reg >> 3); + Rex(bits == 64, 0, 0, (int)reg >> 3); Write8(byte1); Write8(byte2 + ((int)reg & 7)); } -void XEmitter::CWD(int bits) -{ +void XEmitter::CWD(int bits) { if (bits == 16) Write8(0x66); Rex(bits == 64, 0, 0, 0); Write8(0x99); } -void XEmitter::CBW(int bits) -{ +void XEmitter::CBW(int bits) { if (bits == 8) Write8(0x66); Rex(bits == 32, 0, 0, 0); Write8(0x98); } -//Simple opcodes +// Simple opcodes +// push/pop do not need wide to be 64-bit +void XEmitter::PUSH(X64Reg reg) { + WriteSimple1Byte(32, 0x50, reg); +} +void XEmitter::POP(X64Reg reg) { + WriteSimple1Byte(32, 0x58, reg); +} -//push/pop do not need wide to be 64-bit -void XEmitter::PUSH(X64Reg reg) {WriteSimple1Byte(32, 0x50, reg);} -void XEmitter::POP(X64Reg reg) {WriteSimple1Byte(32, 0x58, reg);} - -void XEmitter::PUSH(int bits, const OpArg& reg) -{ +void XEmitter::PUSH(int bits, const OpArg& reg) { if (reg.IsSimpleReg()) PUSH(reg.GetSimpleReg()); - else if (reg.IsImm()) - { - switch (reg.GetImmBits()) - { + else if (reg.IsImm()) { + switch (reg.GetImmBits()) { case 8: Write8(0x6A); Write8((u8)(s8)reg.offset); @@ -715,9 +744,7 @@ void XEmitter::PUSH(int bits, const OpArg& reg) ASSERT_MSG(0, "PUSH - Bad imm bits"); break; } - } - else - { + } else { if (bits == 16) Write8(0x66); reg.WriteRex(this, bits, bits); @@ -726,44 +753,33 @@ void XEmitter::PUSH(int bits, const OpArg& reg) } } -void XEmitter::POP(int /*bits*/, const OpArg& reg) -{ +void XEmitter::POP(int /*bits*/, const OpArg& reg) { if (reg.IsSimpleReg()) POP(reg.GetSimpleReg()); else ASSERT_MSG(0, "POP - Unsupported encoding"); } -void XEmitter::BSWAP(int bits, X64Reg reg) -{ - if (bits >= 32) - { +void XEmitter::BSWAP(int bits, X64Reg reg) { + if (bits >= 32) { WriteSimple2Byte(bits, 0x0F, 0xC8, reg); - } - else if (bits == 16) - { + } else if (bits == 16) { ROL(16, R(reg), Imm8(8)); - } - else if (bits == 8) - { + } else if (bits == 8) { // Do nothing - can't bswap a single byte... - } - else - { + } else { ASSERT_MSG(0, "BSWAP - Wrong number of bits"); } } // Undefined opcode - reserved // If we ever need a way to always cause a non-breakpoint hard exception... -void XEmitter::UD2() -{ +void XEmitter::UD2() { Write8(0x0F); Write8(0x0B); } -void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg) -{ +void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg) { ASSERT_MSG(!arg.IsImm(), "PREFETCH - Imm argument"); arg.operandReg = (u8)level; arg.WriteRex(this, 0, 0); @@ -772,8 +788,7 @@ void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg) arg.WriteRest(this); } -void XEmitter::SETcc(CCFlags flag, OpArg dest) -{ +void XEmitter::SETcc(CCFlags flag, OpArg dest) { ASSERT_MSG(!dest.IsImm(), "SETcc - Imm argument"); dest.operandReg = 0; dest.WriteRex(this, 0, 8); @@ -782,8 +797,7 @@ void XEmitter::SETcc(CCFlags flag, OpArg dest) dest.WriteRest(this); } -void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag) -{ +void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag) { ASSERT_MSG(!src.IsImm(), "CMOVcc - Imm argument"); ASSERT_MSG(bits != 8, "CMOVcc - 8 bits unsupported"); if (bits == 16) @@ -795,34 +809,41 @@ void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag) src.WriteRest(this); } -void XEmitter::WriteMulDivType(int bits, OpArg src, int ext) -{ +void XEmitter::WriteMulDivType(int bits, OpArg src, int ext) { ASSERT_MSG(!src.IsImm(), "WriteMulDivType - Imm argument"); CheckFlags(); src.operandReg = ext; if (bits == 16) Write8(0x66); src.WriteRex(this, bits, bits, 0); - if (bits == 8) - { + if (bits == 8) { Write8(0xF6); - } - else - { + } else { Write8(0xF7); } src.WriteRest(this); } -void XEmitter::MUL(int bits, const OpArg& src) {WriteMulDivType(bits, src, 4);} -void XEmitter::DIV(int bits, const OpArg& src) {WriteMulDivType(bits, src, 6);} -void XEmitter::IMUL(int bits, const OpArg& src) {WriteMulDivType(bits, src, 5);} -void XEmitter::IDIV(int bits, const OpArg& src) {WriteMulDivType(bits, src, 7);} -void XEmitter::NEG(int bits, const OpArg& src) {WriteMulDivType(bits, src, 3);} -void XEmitter::NOT(int bits, const OpArg& src) {WriteMulDivType(bits, src, 2);} +void XEmitter::MUL(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 4); +} +void XEmitter::DIV(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 6); +} +void XEmitter::IMUL(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 5); +} +void XEmitter::IDIV(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 7); +} +void XEmitter::NEG(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 3); +} +void XEmitter::NOT(int bits, const OpArg& src) { + WriteMulDivType(bits, src, 2); +} -void XEmitter::WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2, bool rep) -{ +void XEmitter::WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2, bool rep) { ASSERT_MSG(!src.IsImm(), "WriteBitSearchType - Imm argument"); CheckFlags(); src.operandReg = (u8)dest; @@ -836,36 +857,35 @@ void XEmitter::WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2, bo src.WriteRest(this); } -void XEmitter::MOVNTI(int bits, const OpArg& dest, X64Reg src) -{ +void XEmitter::MOVNTI(int bits, const OpArg& dest, X64Reg src) { if (bits <= 16) ASSERT_MSG(0, "MOVNTI - bits<=16"); WriteBitSearchType(bits, src, dest, 0xC3); } -void XEmitter::BSF(int bits, X64Reg dest, const OpArg& src) {WriteBitSearchType(bits,dest,src,0xBC);} // Bottom bit to top bit -void XEmitter::BSR(int bits, X64Reg dest, const OpArg& src) {WriteBitSearchType(bits,dest,src,0xBD);} // Top bit to bottom bit +void XEmitter::BSF(int bits, X64Reg dest, const OpArg& src) { + WriteBitSearchType(bits, dest, src, 0xBC); +} // Bottom bit to top bit +void XEmitter::BSR(int bits, X64Reg dest, const OpArg& src) { + WriteBitSearchType(bits, dest, src, 0xBD); +} // Top bit to bottom bit -void XEmitter::TZCNT(int bits, X64Reg dest, const OpArg& src) -{ +void XEmitter::TZCNT(int bits, X64Reg dest, const OpArg& src) { CheckFlags(); if (!Common::GetCPUCaps().bmi1) ASSERT_MSG(0, "Trying to use BMI1 on a system that doesn't support it. Bad programmer."); WriteBitSearchType(bits, dest, src, 0xBC, true); } -void XEmitter::LZCNT(int bits, X64Reg dest, const OpArg& src) -{ +void XEmitter::LZCNT(int bits, X64Reg dest, const OpArg& src) { CheckFlags(); if (!Common::GetCPUCaps().lzcnt) ASSERT_MSG(0, "Trying to use LZCNT on a system that doesn't support it. Bad programmer."); WriteBitSearchType(bits, dest, src, 0xBD, true); } -void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src) -{ +void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src) { ASSERT_MSG(!src.IsImm(), "MOVSX - Imm argument"); - if (dbits == sbits) - { + if (dbits == sbits) { MOV(dbits, R(dest), src); return; } @@ -873,66 +893,49 @@ void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src) if (dbits == 16) Write8(0x66); src.WriteRex(this, dbits, sbits); - if (sbits == 8) - { + if (sbits == 8) { Write8(0x0F); Write8(0xBE); - } - else if (sbits == 16) - { + } else if (sbits == 16) { Write8(0x0F); Write8(0xBF); - } - else if (sbits == 32 && dbits == 64) - { + } else if (sbits == 32 && dbits == 64) { Write8(0x63); - } - else - { + } else { Crash(); } src.WriteRest(this); } -void XEmitter::MOVZX(int dbits, int sbits, X64Reg dest, OpArg src) -{ +void XEmitter::MOVZX(int dbits, int sbits, X64Reg dest, OpArg src) { ASSERT_MSG(!src.IsImm(), "MOVZX - Imm argument"); - if (dbits == sbits) - { + if (dbits == sbits) { MOV(dbits, R(dest), src); return; } src.operandReg = (u8)dest; if (dbits == 16) Write8(0x66); - //the 32bit result is automatically zero extended to 64bit + // the 32bit result is automatically zero extended to 64bit src.WriteRex(this, dbits == 64 ? 32 : dbits, sbits); - if (sbits == 8) - { + if (sbits == 8) { Write8(0x0F); Write8(0xB6); - } - else if (sbits == 16) - { + } else if (sbits == 16) { Write8(0x0F); Write8(0xB7); - } - else if (sbits == 32 && dbits == 64) - { + } else if (sbits == 32 && dbits == 64) { Write8(0x8B); - } - else - { + } else { ASSERT_MSG(0, "MOVZX - Invalid size"); } src.WriteRest(this); } -void XEmitter::MOVBE(int bits, const OpArg& dest, const OpArg& src) -{ - ASSERT_MSG(Common::GetCPUCaps().movbe, "Generating MOVBE on a system that does not support it."); - if (bits == 8) - { +void XEmitter::MOVBE(int bits, const OpArg& dest, const OpArg& src) { + ASSERT_MSG(Common::GetCPUCaps().movbe, + "Generating MOVBE on a system that does not support it."); + if (bits == 8) { MOV(bits, dest, src); return; } @@ -940,71 +943,60 @@ void XEmitter::MOVBE(int bits, const OpArg& dest, const OpArg& src) if (bits == 16) Write8(0x66); - if (dest.IsSimpleReg()) - { + if (dest.IsSimpleReg()) { ASSERT_MSG(!src.IsSimpleReg() && !src.IsImm(), "MOVBE: Loading from !mem"); src.WriteRex(this, bits, bits, dest.GetSimpleReg()); - Write8(0x0F); Write8(0x38); Write8(0xF0); + Write8(0x0F); + Write8(0x38); + Write8(0xF0); src.WriteRest(this, 0, dest.GetSimpleReg()); - } - else if (src.IsSimpleReg()) - { + } else if (src.IsSimpleReg()) { ASSERT_MSG(!dest.IsSimpleReg() && !dest.IsImm(), "MOVBE: Storing to !mem"); dest.WriteRex(this, bits, bits, src.GetSimpleReg()); - Write8(0x0F); Write8(0x38); Write8(0xF1); + Write8(0x0F); + Write8(0x38); + Write8(0xF1); dest.WriteRest(this, 0, src.GetSimpleReg()); - } - else - { + } else { ASSERT_MSG(0, "MOVBE: Not loading or storing to mem"); } } - -void XEmitter::LEA(int bits, X64Reg dest, OpArg src) -{ +void XEmitter::LEA(int bits, X64Reg dest, OpArg src) { ASSERT_MSG(!src.IsImm(), "LEA - Imm argument"); src.operandReg = (u8)dest; if (bits == 16) - Write8(0x66); //TODO: performance warning + Write8(0x66); // TODO: performance warning src.WriteRex(this, bits, bits); Write8(0x8D); src.WriteRest(this, 0, INVALID_REG, bits == 64); } -//shift can be either imm8 or cl -void XEmitter::WriteShift(int bits, OpArg dest, const OpArg& shift, int ext) -{ +// shift can be either imm8 or cl +void XEmitter::WriteShift(int bits, OpArg dest, const OpArg& shift, int ext) { CheckFlags(); bool writeImm = false; - if (dest.IsImm()) - { + if (dest.IsImm()) { ASSERT_MSG(0, "WriteShift - can't shift imms"); } - if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8)) - { + if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || + (shift.IsImm() && shift.GetImmBits() != 8)) { ASSERT_MSG(0, "WriteShift - illegal argument"); } dest.operandReg = ext; if (bits == 16) Write8(0x66); dest.WriteRex(this, bits, bits, 0); - if (shift.GetImmBits() == 8) - { - //ok an imm + if (shift.GetImmBits() == 8) { + // ok an imm u8 imm = (u8)shift.offset; - if (imm == 1) - { + if (imm == 1) { Write8(bits == 8 ? 0xD0 : 0xD1); - } - else - { + } else { writeImm = true; Write8(bits == 8 ? 0xC0 : 0xC1); } - } - else - { + } else { Write8(bits == 8 ? 0xD2 : 0xD3); } dest.WriteRest(this, writeImm ? 1 : 0); @@ -1014,116 +1006,125 @@ void XEmitter::WriteShift(int bits, OpArg dest, const OpArg& shift, int ext) // large rotates and shift are slower on intel than amd // intel likes to rotate by 1, and the op is smaller too -void XEmitter::ROL(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 0);} -void XEmitter::ROR(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 1);} -void XEmitter::RCL(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 2);} -void XEmitter::RCR(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 3);} -void XEmitter::SHL(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 4);} -void XEmitter::SHR(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 5);} -void XEmitter::SAR(int bits, const OpArg& dest, const OpArg& shift) {WriteShift(bits, dest, shift, 7);} +void XEmitter::ROL(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 0); +} +void XEmitter::ROR(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 1); +} +void XEmitter::RCL(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 2); +} +void XEmitter::RCR(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 3); +} +void XEmitter::SHL(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 4); +} +void XEmitter::SHR(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 5); +} +void XEmitter::SAR(int bits, const OpArg& dest, const OpArg& shift) { + WriteShift(bits, dest, shift, 7); +} // index can be either imm8 or register, don't use memory destination because it's slow -void XEmitter::WriteBitTest(int bits, const OpArg& dest, const OpArg& index, int ext) -{ +void XEmitter::WriteBitTest(int bits, const OpArg& dest, const OpArg& index, int ext) { CheckFlags(); - if (dest.IsImm()) - { + if (dest.IsImm()) { ASSERT_MSG(0, "WriteBitTest - can't test imms"); } - if ((index.IsImm() && index.GetImmBits() != 8)) - { + if ((index.IsImm() && index.GetImmBits() != 8)) { ASSERT_MSG(0, "WriteBitTest - illegal argument"); } if (bits == 16) Write8(0x66); - if (index.IsImm()) - { + if (index.IsImm()) { dest.WriteRex(this, bits, bits); - Write8(0x0F); Write8(0xBA); + Write8(0x0F); + Write8(0xBA); dest.WriteRest(this, 1, (X64Reg)ext); Write8((u8)index.offset); - } - else - { + } else { X64Reg operand = index.GetSimpleReg(); dest.WriteRex(this, bits, bits, operand); - Write8(0x0F); Write8(0x83 + 8*ext); + Write8(0x0F); + Write8(0x83 + 8 * ext); dest.WriteRest(this, 1, operand); } } -void XEmitter::BT(int bits, const OpArg& dest, const OpArg& index) {WriteBitTest(bits, dest, index, 4);} -void XEmitter::BTS(int bits, const OpArg& dest, const OpArg& index) {WriteBitTest(bits, dest, index, 5);} -void XEmitter::BTR(int bits, const OpArg& dest, const OpArg& index) {WriteBitTest(bits, dest, index, 6);} -void XEmitter::BTC(int bits, const OpArg& dest, const OpArg& index) {WriteBitTest(bits, dest, index, 7);} +void XEmitter::BT(int bits, const OpArg& dest, const OpArg& index) { + WriteBitTest(bits, dest, index, 4); +} +void XEmitter::BTS(int bits, const OpArg& dest, const OpArg& index) { + WriteBitTest(bits, dest, index, 5); +} +void XEmitter::BTR(int bits, const OpArg& dest, const OpArg& index) { + WriteBitTest(bits, dest, index, 6); +} +void XEmitter::BTC(int bits, const OpArg& dest, const OpArg& index) { + WriteBitTest(bits, dest, index, 7); +} -//shift can be either imm8 or cl -void XEmitter::SHRD(int bits, const OpArg& dest, const OpArg& src, const OpArg& shift) -{ +// shift can be either imm8 or cl +void XEmitter::SHRD(int bits, const OpArg& dest, const OpArg& src, const OpArg& shift) { CheckFlags(); - if (dest.IsImm()) - { + if (dest.IsImm()) { ASSERT_MSG(0, "SHRD - can't use imms as destination"); } - if (!src.IsSimpleReg()) - { + if (!src.IsSimpleReg()) { ASSERT_MSG(0, "SHRD - must use simple register as source"); } - if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8)) - { + if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || + (shift.IsImm() && shift.GetImmBits() != 8)) { ASSERT_MSG(0, "SHRD - illegal shift"); } if (bits == 16) Write8(0x66); X64Reg operand = src.GetSimpleReg(); dest.WriteRex(this, bits, bits, operand); - if (shift.GetImmBits() == 8) - { - Write8(0x0F); Write8(0xAC); + if (shift.GetImmBits() == 8) { + Write8(0x0F); + Write8(0xAC); dest.WriteRest(this, 1, operand); Write8((u8)shift.offset); - } - else - { - Write8(0x0F); Write8(0xAD); + } else { + Write8(0x0F); + Write8(0xAD); dest.WriteRest(this, 0, operand); } } -void XEmitter::SHLD(int bits, const OpArg& dest, const OpArg& src, const OpArg& shift) -{ +void XEmitter::SHLD(int bits, const OpArg& dest, const OpArg& src, const OpArg& shift) { CheckFlags(); - if (dest.IsImm()) - { + if (dest.IsImm()) { ASSERT_MSG(0, "SHLD - can't use imms as destination"); } - if (!src.IsSimpleReg()) - { + if (!src.IsSimpleReg()) { ASSERT_MSG(0, "SHLD - must use simple register as source"); } - if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8)) - { + if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || + (shift.IsImm() && shift.GetImmBits() != 8)) { ASSERT_MSG(0, "SHLD - illegal shift"); } if (bits == 16) Write8(0x66); X64Reg operand = src.GetSimpleReg(); dest.WriteRex(this, bits, bits, operand); - if (shift.GetImmBits() == 8) - { - Write8(0x0F); Write8(0xA4); + if (shift.GetImmBits() == 8) { + Write8(0x0F); + Write8(0xA4); dest.WriteRest(this, 1, operand); Write8((u8)shift.offset); - } - else - { - Write8(0x0F); Write8(0xA5); + } else { + Write8(0x0F); + Write8(0xA5); dest.WriteRest(this, 0, operand); } } -void OpArg::WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg _operandReg, int bits) -{ +void OpArg::WriteSingleByteOp(XEmitter* emit, u8 op, X64Reg _operandReg, int bits) { if (bits == 16) emit->Write8(0x66); @@ -1133,12 +1134,11 @@ void OpArg::WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg _operandReg, int bit WriteRest(emit); } -//operand can either be immediate or register -void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& operand, int bits) const -{ +// operand can either be immediate or register +void OpArg::WriteNormalOp(XEmitter* emit, bool toRM, NormalOp op, const OpArg& operand, + int bits) const { X64Reg _operandReg; - if (IsImm()) - { + if (IsImm()) { ASSERT_MSG(0, "WriteNormalOp - Imm argument, wrong order"); } @@ -1147,27 +1147,22 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& o int immToWrite = 0; - if (operand.IsImm()) - { + if (operand.IsImm()) { WriteRex(emit, bits, bits); - if (!toRM) - { + if (!toRM) { ASSERT_MSG(0, "WriteNormalOp - Writing to Imm (!toRM)"); } - if (operand.scale == SCALE_IMM8 && bits == 8) - { + if (operand.scale == SCALE_IMM8 && bits == 8) { // op al, imm8 - if (!scale && offsetOrBaseReg == AL && normalops[op].eaximm8 != 0xCC) - { + if (!scale && offsetOrBaseReg == AL && normalops[op].eaximm8 != 0xCC) { emit->Write8(normalops[op].eaximm8); emit->Write8((u8)operand.offset); return; } // mov reg, imm8 - if (!scale && op == nrmMOV) - { + if (!scale && op == nrmMOV) { emit->Write8(0xB0 + (offsetOrBaseReg & 7)); emit->Write8((u8)operand.offset); return; @@ -1175,26 +1170,20 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& o // op r/m8, imm8 emit->Write8(normalops[op].imm8); immToWrite = 8; - } - else if ((operand.scale == SCALE_IMM16 && bits == 16) || - (operand.scale == SCALE_IMM32 && bits == 32) || - (operand.scale == SCALE_IMM32 && bits == 64)) - { + } else if ((operand.scale == SCALE_IMM16 && bits == 16) || + (operand.scale == SCALE_IMM32 && bits == 32) || + (operand.scale == SCALE_IMM32 && bits == 64)) { // Try to save immediate size if we can, but first check to see // if the instruction supports simm8. // op r/m, imm8 if (normalops[op].simm8 != 0xCC && ((operand.scale == SCALE_IMM16 && (s16)operand.offset == (s8)operand.offset) || - (operand.scale == SCALE_IMM32 && (s32)operand.offset == (s8)operand.offset))) - { + (operand.scale == SCALE_IMM32 && (s32)operand.offset == (s8)operand.offset))) { emit->Write8(normalops[op].simm8); immToWrite = 8; - } - else - { + } else { // mov reg, imm - if (!scale && op == nrmMOV && bits != 64) - { + if (!scale && op == nrmMOV && bits != 64) { emit->Write8(0xB8 + (offsetOrBaseReg & 7)); if (bits == 16) emit->Write16((u16)operand.offset); @@ -1203,8 +1192,7 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& o return; } // op eax, imm - if (!scale && offsetOrBaseReg == EAX && normalops[op].eaximm32 != 0xCC) - { + if (!scale && offsetOrBaseReg == EAX && normalops[op].eaximm32 != 0xCC) { emit->Write8(normalops[op].eaximm32); if (bits == 16) emit->Write16((u16)operand.offset); @@ -1216,54 +1204,41 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& o emit->Write8(normalops[op].imm32); immToWrite = bits == 16 ? 16 : 32; } - } - else if ((operand.scale == SCALE_IMM8 && bits == 16) || - (operand.scale == SCALE_IMM8 && bits == 32) || - (operand.scale == SCALE_IMM8 && bits == 64)) - { + } else if ((operand.scale == SCALE_IMM8 && bits == 16) || + (operand.scale == SCALE_IMM8 && bits == 32) || + (operand.scale == SCALE_IMM8 && bits == 64)) { // op r/m, imm8 emit->Write8(normalops[op].simm8); immToWrite = 8; - } - else if (operand.scale == SCALE_IMM64 && bits == 64) - { - if (scale) - { + } else if (operand.scale == SCALE_IMM64 && bits == 64) { + if (scale) { ASSERT_MSG(0, "WriteNormalOp - MOV with 64-bit imm requres register destination"); } // mov reg64, imm64 - else if (op == nrmMOV) - { + else if (op == nrmMOV) { emit->Write8(0xB8 + (offsetOrBaseReg & 7)); emit->Write64((u64)operand.offset); return; } ASSERT_MSG(0, "WriteNormalOp - Only MOV can take 64-bit imm"); - } - else - { + } else { ASSERT_MSG(0, "WriteNormalOp - Unhandled case"); } - _operandReg = (X64Reg)normalops[op].ext; //pass extension in REG of ModRM - } - else - { + _operandReg = (X64Reg)normalops[op].ext; // pass extension in REG of ModRM + } else { _operandReg = (X64Reg)operand.offsetOrBaseReg; WriteRex(emit, bits, bits, _operandReg); // op r/m, reg - if (toRM) - { + if (toRM) { emit->Write8(bits == 8 ? normalops[op].toRm8 : normalops[op].toRm32); } // op reg, r/m - else - { + else { emit->Write8(bits == 8 ? normalops[op].fromRm8 : normalops[op].fromRm32); } } WriteRest(emit, immToWrite >> 3, _operandReg); - switch (immToWrite) - { + switch (immToWrite) { case 0: break; case 8: @@ -1280,66 +1255,84 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg& o } } -void XEmitter::WriteNormalOp(XEmitter *emit, int bits, NormalOp op, const OpArg& a1, const OpArg& a2) -{ - if (a1.IsImm()) - { - //Booh! Can't write to an imm +void XEmitter::WriteNormalOp(XEmitter* emit, int bits, NormalOp op, const OpArg& a1, + const OpArg& a2) { + if (a1.IsImm()) { + // Booh! Can't write to an imm ASSERT_MSG(0, "WriteNormalOp - a1 cannot be imm"); return; } - if (a2.IsImm()) - { + if (a2.IsImm()) { a1.WriteNormalOp(emit, true, op, a2, bits); - } - else - { - if (a1.IsSimpleReg()) - { + } else { + if (a1.IsSimpleReg()) { a2.WriteNormalOp(emit, false, op, a1, bits); - } - else - { - ASSERT_MSG(a2.IsSimpleReg() || a2.IsImm(), "WriteNormalOp - a1 and a2 cannot both be memory"); - a1.WriteNormalOp(emit, true, op, a2, bits); + } else { + ASSERT_MSG(a2.IsSimpleReg() || a2.IsImm(), + "WriteNormalOp - a1 and a2 cannot both be memory"); + a1.WriteNormalOp(emit, true, op, a2, bits); } } } -void XEmitter::ADD (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmADD, a1, a2);} -void XEmitter::ADC (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmADC, a1, a2);} -void XEmitter::SUB (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmSUB, a1, a2);} -void XEmitter::SBB (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmSBB, a1, a2);} -void XEmitter::AND (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmAND, a1, a2);} -void XEmitter::OR (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmOR , a1, a2);} -void XEmitter::XOR (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmXOR, a1, a2);} -void XEmitter::MOV (int bits, const OpArg& a1, const OpArg& a2) -{ +void XEmitter::ADD(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmADD, a1, a2); +} +void XEmitter::ADC(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmADC, a1, a2); +} +void XEmitter::SUB(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmSUB, a1, a2); +} +void XEmitter::SBB(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmSBB, a1, a2); +} +void XEmitter::AND(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmAND, a1, a2); +} +void XEmitter::OR(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmOR, a1, a2); +} +void XEmitter::XOR(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmXOR, a1, a2); +} +void XEmitter::MOV(int bits, const OpArg& a1, const OpArg& a2) { if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg()) LOG_ERROR(Common, "Redundant MOV @ %p - bug in JIT?", code); WriteNormalOp(this, bits, nrmMOV, a1, a2); } -void XEmitter::TEST(int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmTEST, a1, a2);} -void XEmitter::CMP (int bits, const OpArg& a1, const OpArg& a2) {CheckFlags(); WriteNormalOp(this, bits, nrmCMP, a1, a2);} -void XEmitter::XCHG(int bits, const OpArg& a1, const OpArg& a2) {WriteNormalOp(this, bits, nrmXCHG, a1, a2);} +void XEmitter::TEST(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmTEST, a1, a2); +} +void XEmitter::CMP(int bits, const OpArg& a1, const OpArg& a2) { + CheckFlags(); + WriteNormalOp(this, bits, nrmCMP, a1, a2); +} +void XEmitter::XCHG(int bits, const OpArg& a1, const OpArg& a2) { + WriteNormalOp(this, bits, nrmXCHG, a1, a2); +} -void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a1, const OpArg& a2) -{ +void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a1, const OpArg& a2) { CheckFlags(); - if (bits == 8) - { + if (bits == 8) { ASSERT_MSG(0, "IMUL - illegal bit size!"); return; } - if (a1.IsImm()) - { + if (a1.IsImm()) { ASSERT_MSG(0, "IMUL - second arg cannot be imm!"); return; } - if (!a2.IsImm()) - { + if (!a2.IsImm()) { ASSERT_MSG(0, "IMUL - third arg must be imm!"); return; } @@ -1348,46 +1341,34 @@ void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a1, const OpArg& a2) Write8(0x66); a1.WriteRex(this, bits, bits, regOp); - if (a2.GetImmBits() == 8 || - (a2.GetImmBits() == 16 && (s8)a2.offset == (s16)a2.offset) || - (a2.GetImmBits() == 32 && (s8)a2.offset == (s32)a2.offset)) - { + if (a2.GetImmBits() == 8 || (a2.GetImmBits() == 16 && (s8)a2.offset == (s16)a2.offset) || + (a2.GetImmBits() == 32 && (s8)a2.offset == (s32)a2.offset)) { Write8(0x6B); a1.WriteRest(this, 1, regOp); Write8((u8)a2.offset); - } - else - { + } else { Write8(0x69); - if (a2.GetImmBits() == 16 && bits == 16) - { + if (a2.GetImmBits() == 16 && bits == 16) { a1.WriteRest(this, 2, regOp); Write16((u16)a2.offset); - } - else if (a2.GetImmBits() == 32 && (bits == 32 || bits == 64)) - { + } else if (a2.GetImmBits() == 32 && (bits == 32 || bits == 64)) { a1.WriteRest(this, 4, regOp); Write32((u32)a2.offset); - } - else - { + } else { ASSERT_MSG(0, "IMUL - unhandled case!"); } } } -void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a) -{ +void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a) { CheckFlags(); - if (bits == 8) - { + if (bits == 8) { ASSERT_MSG(0, "IMUL - illegal bit size!"); return; } - if (a.IsImm()) - { - IMUL(bits, regOp, R(regOp), a) ; + if (a.IsImm()) { + IMUL(bits, regOp, R(regOp), a); return; } @@ -1399,9 +1380,7 @@ void XEmitter::IMUL(int bits, X64Reg regOp, const OpArg& a) a.WriteRest(this, 0, regOp); } - -void XEmitter::WriteSSEOp(u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes) -{ +void XEmitter::WriteSSEOp(u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extrabytes) { if (opPrefix) Write8(opPrefix); arg.operandReg = regOp; @@ -1413,13 +1392,11 @@ void XEmitter::WriteSSEOp(u8 opPrefix, u16 op, X64Reg regOp, OpArg arg, int extr arg.WriteRest(this, extrabytes); } -void XEmitter::WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) { WriteAVXOp(opPrefix, op, regOp, INVALID_REG, arg, extrabytes); } -static int GetVEXmmmmm(u16 op) -{ +static int GetVEXmmmmm(u16 op) { // Currently, only 0x38 and 0x3A are used as secondary escape byte. if ((op >> 8) == 0x3A) return 3; @@ -1429,8 +1406,7 @@ static int GetVEXmmmmm(u16 op) return 1; } -static int GetVEXpp(u8 opPrefix) -{ +static int GetVEXpp(u8 opPrefix) { if (opPrefix == 0x66) return 1; if (opPrefix == 0xF3) @@ -1441,21 +1417,22 @@ static int GetVEXpp(u8 opPrefix) return 0; } -void XEmitter::WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, + int extrabytes) { if (!Common::GetCPUCaps().avx) ASSERT_MSG(0, "Trying to use AVX on a system that doesn't support it. Bad programmer."); int mmmmm = GetVEXmmmmm(op); int pp = GetVEXpp(opPrefix); - // FIXME: we currently don't support 256-bit instructions, and "size" is not the vector size here + // FIXME: we currently don't support 256-bit instructions, and "size" is not the vector size + // here arg.WriteVex(this, regOp1, regOp2, 0, pp, mmmmm); Write8(op & 0xFF); arg.WriteRest(this, extrabytes, regOp1); } // Like the above, but more general; covers GPR-based VEX operations, like BMI1/2 -void XEmitter::WriteVEXOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteVEXOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, + const OpArg& arg, int extrabytes) { if (size != 32 && size != 64) ASSERT_MSG(0, "VEX GPR instructions only support 32-bit and 64-bit modes!"); int mmmmm = GetVEXmmmmm(op); @@ -1465,49 +1442,50 @@ void XEmitter::WriteVEXOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg r arg.WriteRest(this, extrabytes, regOp1); } -void XEmitter::WriteBMI1Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteBMI1Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, + const OpArg& arg, int extrabytes) { CheckFlags(); if (!Common::GetCPUCaps().bmi1) ASSERT_MSG(0, "Trying to use BMI1 on a system that doesn't support it. Bad programmer."); WriteVEXOp(size, opPrefix, op, regOp1, regOp2, arg, extrabytes); } -void XEmitter::WriteBMI2Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteBMI2Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, + const OpArg& arg, int extrabytes) { CheckFlags(); if (!Common::GetCPUCaps().bmi2) ASSERT_MSG(0, "Trying to use BMI2 on a system that doesn't support it. Bad programmer."); WriteVEXOp(size, opPrefix, op, regOp1, regOp2, arg, extrabytes); } -void XEmitter::MOVD_xmm(X64Reg dest, const OpArg &arg) {WriteSSEOp(0x66, 0x6E, dest, arg, 0);} -void XEmitter::MOVD_xmm(const OpArg &arg, X64Reg src) {WriteSSEOp(0x66, 0x7E, src, arg, 0);} +void XEmitter::MOVD_xmm(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x6E, dest, arg, 0); +} +void XEmitter::MOVD_xmm(const OpArg& arg, X64Reg src) { + WriteSSEOp(0x66, 0x7E, src, arg, 0); +} -void XEmitter::MOVQ_xmm(X64Reg dest, OpArg arg) -{ +void XEmitter::MOVQ_xmm(X64Reg dest, OpArg arg) { #ifdef ARCHITECTURE_x86_64 - // Alternate encoding - // This does not display correctly in MSVC's debugger, it thinks it's a MOVD - arg.operandReg = dest; - Write8(0x66); - arg.WriteRex(this, 64, 0); - Write8(0x0f); - Write8(0x6E); - arg.WriteRest(this, 0); + // Alternate encoding + // This does not display correctly in MSVC's debugger, it thinks it's a MOVD + arg.operandReg = dest; + Write8(0x66); + arg.WriteRex(this, 64, 0); + Write8(0x0f); + Write8(0x6E); + arg.WriteRest(this, 0); #else - arg.operandReg = dest; - Write8(0xF3); - Write8(0x0f); - Write8(0x7E); - arg.WriteRest(this, 0); + arg.operandReg = dest; + Write8(0xF3); + Write8(0x0f); + Write8(0x7E); + arg.WriteRest(this, 0); #endif } -void XEmitter::MOVQ_xmm(OpArg arg, X64Reg src) -{ - if (src > 7 || arg.IsSimpleReg()) - { +void XEmitter::MOVQ_xmm(OpArg arg, X64Reg src) { + if (src > 7 || arg.IsSimpleReg()) { // Alternate encoding // This does not display correctly in MSVC's debugger, it thinks it's a MOVD arg.operandReg = src; @@ -1516,9 +1494,7 @@ void XEmitter::MOVQ_xmm(OpArg arg, X64Reg src) Write8(0x0f); Write8(0x7E); arg.WriteRest(this, 0); - } - else - { + } else { arg.operandReg = src; arg.WriteRex(this, 0, 0); Write8(0x66); @@ -1528,8 +1504,7 @@ void XEmitter::MOVQ_xmm(OpArg arg, X64Reg src) } } -void XEmitter::WriteMXCSR(OpArg arg, int ext) -{ +void XEmitter::WriteMXCSR(OpArg arg, int ext) { if (arg.IsImm() || arg.IsSimpleReg()) ASSERT_MSG(0, "MXCSR - invalid operand"); @@ -1540,143 +1515,357 @@ void XEmitter::WriteMXCSR(OpArg arg, int ext) arg.WriteRest(this); } -void XEmitter::STMXCSR(const OpArg& memloc) {WriteMXCSR(memloc, 3);} -void XEmitter::LDMXCSR(const OpArg& memloc) {WriteMXCSR(memloc, 2);} - -void XEmitter::MOVNTDQ(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x66, sseMOVNTDQ, regOp, arg);} -void XEmitter::MOVNTPS(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x00, sseMOVNTP, regOp, arg);} -void XEmitter::MOVNTPD(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x66, sseMOVNTP, regOp, arg);} - -void XEmitter::ADDSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseADD, regOp, arg);} -void XEmitter::ADDSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseADD, regOp, arg);} -void XEmitter::SUBSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseSUB, regOp, arg);} -void XEmitter::SUBSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseSUB, regOp, arg);} -void XEmitter::CMPSS(X64Reg regOp, const OpArg& arg, u8 compare) {WriteSSEOp(0xF3, sseCMP, regOp, arg, 1); Write8(compare);} -void XEmitter::CMPSD(X64Reg regOp, const OpArg& arg, u8 compare) {WriteSSEOp(0xF2, sseCMP, regOp, arg, 1); Write8(compare);} -void XEmitter::MULSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseMUL, regOp, arg);} -void XEmitter::MULSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseMUL, regOp, arg);} -void XEmitter::DIVSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseDIV, regOp, arg);} -void XEmitter::DIVSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseDIV, regOp, arg);} -void XEmitter::MINSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseMIN, regOp, arg);} -void XEmitter::MINSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseMIN, regOp, arg);} -void XEmitter::MAXSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseMAX, regOp, arg);} -void XEmitter::MAXSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseMAX, regOp, arg);} -void XEmitter::SQRTSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseSQRT, regOp, arg);} -void XEmitter::SQRTSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseSQRT, regOp, arg);} -void XEmitter::RCPSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseRCP, regOp, arg);} -void XEmitter::RSQRTSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseRSQRT, regOp, arg);} - -void XEmitter::ADDPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseADD, regOp, arg);} -void XEmitter::ADDPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseADD, regOp, arg);} -void XEmitter::SUBPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseSUB, regOp, arg);} -void XEmitter::SUBPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseSUB, regOp, arg);} -void XEmitter::CMPPS(X64Reg regOp, const OpArg& arg, u8 compare) {WriteSSEOp(0x00, sseCMP, regOp, arg, 1); Write8(compare);} -void XEmitter::CMPPD(X64Reg regOp, const OpArg& arg, u8 compare) {WriteSSEOp(0x66, sseCMP, regOp, arg, 1); Write8(compare);} -void XEmitter::ANDPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseAND, regOp, arg);} -void XEmitter::ANDPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseAND, regOp, arg);} -void XEmitter::ANDNPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseANDN, regOp, arg);} -void XEmitter::ANDNPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseANDN, regOp, arg);} -void XEmitter::ORPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseOR, regOp, arg);} -void XEmitter::ORPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseOR, regOp, arg);} -void XEmitter::XORPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseXOR, regOp, arg);} -void XEmitter::XORPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseXOR, regOp, arg);} -void XEmitter::MULPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseMUL, regOp, arg);} -void XEmitter::MULPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMUL, regOp, arg);} -void XEmitter::DIVPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseDIV, regOp, arg);} -void XEmitter::DIVPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseDIV, regOp, arg);} -void XEmitter::MINPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseMIN, regOp, arg);} -void XEmitter::MINPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMIN, regOp, arg);} -void XEmitter::MAXPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseMAX, regOp, arg);} -void XEmitter::MAXPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMAX, regOp, arg);} -void XEmitter::SQRTPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseSQRT, regOp, arg);} -void XEmitter::SQRTPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseSQRT, regOp, arg);} -void XEmitter::RCPPS(X64Reg regOp, const OpArg& arg) { WriteSSEOp(0x00, sseRCP, regOp, arg); } -void XEmitter::RSQRTPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseRSQRT, regOp, arg);} -void XEmitter::SHUFPS(X64Reg regOp, const OpArg& arg, u8 shuffle) {WriteSSEOp(0x00, sseSHUF, regOp, arg,1); Write8(shuffle);} -void XEmitter::SHUFPD(X64Reg regOp, const OpArg& arg, u8 shuffle) {WriteSSEOp(0x66, sseSHUF, regOp, arg,1); Write8(shuffle);} - -void XEmitter::HADDPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseHADD, regOp, arg);} - -void XEmitter::COMISS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseCOMIS, regOp, arg);} //weird that these should be packed -void XEmitter::COMISD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseCOMIS, regOp, arg);} //ordered -void XEmitter::UCOMISS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseUCOMIS, regOp, arg);} //unordered -void XEmitter::UCOMISD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseUCOMIS, regOp, arg);} - -void XEmitter::MOVAPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseMOVAPfromRM, regOp, arg);} -void XEmitter::MOVAPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMOVAPfromRM, regOp, arg);} -void XEmitter::MOVAPS(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x00, sseMOVAPtoRM, regOp, arg);} -void XEmitter::MOVAPD(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x66, sseMOVAPtoRM, regOp, arg);} - -void XEmitter::MOVUPS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, sseMOVUPfromRM, regOp, arg);} -void XEmitter::MOVUPD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMOVUPfromRM, regOp, arg);} -void XEmitter::MOVUPS(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x00, sseMOVUPtoRM, regOp, arg);} -void XEmitter::MOVUPD(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x66, sseMOVUPtoRM, regOp, arg);} - -void XEmitter::MOVDQA(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, sseMOVDQfromRM, regOp, arg);} -void XEmitter::MOVDQA(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0x66, sseMOVDQtoRM, regOp, arg);} -void XEmitter::MOVDQU(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseMOVDQfromRM, regOp, arg);} -void XEmitter::MOVDQU(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0xF3, sseMOVDQtoRM, regOp, arg);} - -void XEmitter::MOVSS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, sseMOVUPfromRM, regOp, arg);} -void XEmitter::MOVSD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, sseMOVUPfromRM, regOp, arg);} -void XEmitter::MOVSS(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0xF3, sseMOVUPtoRM, regOp, arg);} -void XEmitter::MOVSD(const OpArg& arg, X64Reg regOp) {WriteSSEOp(0xF2, sseMOVUPtoRM, regOp, arg);} - -void XEmitter::MOVLPS(X64Reg regOp, const OpArg& arg) { WriteSSEOp(0x00, sseMOVLPfromRM, regOp, arg); } -void XEmitter::MOVLPD(X64Reg regOp, const OpArg& arg) { WriteSSEOp(0x66, sseMOVLPfromRM, regOp, arg); } -void XEmitter::MOVLPS(const OpArg& arg, X64Reg regOp) { WriteSSEOp(0x00, sseMOVLPtoRM, regOp, arg); } -void XEmitter::MOVLPD(const OpArg& arg, X64Reg regOp) { WriteSSEOp(0x66, sseMOVLPtoRM, regOp, arg); } - -void XEmitter::MOVHPS(X64Reg regOp, const OpArg& arg) { WriteSSEOp(0x00, sseMOVHPfromRM, regOp, arg); } -void XEmitter::MOVHPD(X64Reg regOp, const OpArg& arg) { WriteSSEOp(0x66, sseMOVHPfromRM, regOp, arg); } -void XEmitter::MOVHPS(const OpArg& arg, X64Reg regOp) { WriteSSEOp(0x00, sseMOVHPtoRM, regOp, arg); } -void XEmitter::MOVHPD(const OpArg& arg, X64Reg regOp) { WriteSSEOp(0x66, sseMOVHPtoRM, regOp, arg); } - -void XEmitter::MOVHLPS(X64Reg regOp1, X64Reg regOp2) {WriteSSEOp(0x00, sseMOVHLPS, regOp1, R(regOp2));} -void XEmitter::MOVLHPS(X64Reg regOp1, X64Reg regOp2) {WriteSSEOp(0x00, sseMOVLHPS, regOp1, R(regOp2));} - -void XEmitter::CVTPS2PD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, 0x5A, regOp, arg);} -void XEmitter::CVTPD2PS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, 0x5A, regOp, arg);} - -void XEmitter::CVTSD2SS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x5A, regOp, arg);} -void XEmitter::CVTSS2SD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x5A, regOp, arg);} -void XEmitter::CVTSD2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x2D, regOp, arg);} -void XEmitter::CVTSS2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x2D, regOp, arg);} -void XEmitter::CVTSI2SD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x2A, regOp, arg);} -void XEmitter::CVTSI2SS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x2A, regOp, arg);} - -void XEmitter::CVTDQ2PD(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0xE6, regOp, arg);} -void XEmitter::CVTDQ2PS(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x00, 0x5B, regOp, arg);} -void XEmitter::CVTPD2DQ(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0xE6, regOp, arg);} -void XEmitter::CVTPS2DQ(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, 0x5B, regOp, arg);} - -void XEmitter::CVTTSD2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF2, 0x2C, regOp, arg);} -void XEmitter::CVTTSS2SI(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x2C, regOp, arg);} -void XEmitter::CVTTPS2DQ(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0xF3, 0x5B, regOp, arg);} -void XEmitter::CVTTPD2DQ(X64Reg regOp, const OpArg& arg) {WriteSSEOp(0x66, 0xE6, regOp, arg);} - -void XEmitter::MASKMOVDQU(X64Reg dest, X64Reg src) {WriteSSEOp(0x66, sseMASKMOVDQU, dest, R(src));} - -void XEmitter::MOVMSKPS(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x00, 0x50, dest, arg);} -void XEmitter::MOVMSKPD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x50, dest, arg);} - -void XEmitter::LDDQU(X64Reg dest, const OpArg& arg) {WriteSSEOp(0xF2, sseLDDQU, dest, arg);} // For integer data only +void XEmitter::STMXCSR(const OpArg& memloc) { + WriteMXCSR(memloc, 3); +} +void XEmitter::LDMXCSR(const OpArg& memloc) { + WriteMXCSR(memloc, 2); +} + +void XEmitter::MOVNTDQ(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVNTDQ, regOp, arg); +} +void XEmitter::MOVNTPS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x00, sseMOVNTP, regOp, arg); +} +void XEmitter::MOVNTPD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVNTP, regOp, arg); +} + +void XEmitter::ADDSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseADD, regOp, arg); +} +void XEmitter::ADDSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseADD, regOp, arg); +} +void XEmitter::SUBSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseSUB, regOp, arg); +} +void XEmitter::SUBSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseSUB, regOp, arg); +} +void XEmitter::CMPSS(X64Reg regOp, const OpArg& arg, u8 compare) { + WriteSSEOp(0xF3, sseCMP, regOp, arg, 1); + Write8(compare); +} +void XEmitter::CMPSD(X64Reg regOp, const OpArg& arg, u8 compare) { + WriteSSEOp(0xF2, sseCMP, regOp, arg, 1); + Write8(compare); +} +void XEmitter::MULSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseMUL, regOp, arg); +} +void XEmitter::MULSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseMUL, regOp, arg); +} +void XEmitter::DIVSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseDIV, regOp, arg); +} +void XEmitter::DIVSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseDIV, regOp, arg); +} +void XEmitter::MINSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseMIN, regOp, arg); +} +void XEmitter::MINSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseMIN, regOp, arg); +} +void XEmitter::MAXSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseMAX, regOp, arg); +} +void XEmitter::MAXSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseMAX, regOp, arg); +} +void XEmitter::SQRTSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseSQRT, regOp, arg); +} +void XEmitter::SQRTSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseSQRT, regOp, arg); +} +void XEmitter::RCPSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseRCP, regOp, arg); +} +void XEmitter::RSQRTSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseRSQRT, regOp, arg); +} + +void XEmitter::ADDPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseADD, regOp, arg); +} +void XEmitter::ADDPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseADD, regOp, arg); +} +void XEmitter::SUBPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseSUB, regOp, arg); +} +void XEmitter::SUBPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseSUB, regOp, arg); +} +void XEmitter::CMPPS(X64Reg regOp, const OpArg& arg, u8 compare) { + WriteSSEOp(0x00, sseCMP, regOp, arg, 1); + Write8(compare); +} +void XEmitter::CMPPD(X64Reg regOp, const OpArg& arg, u8 compare) { + WriteSSEOp(0x66, sseCMP, regOp, arg, 1); + Write8(compare); +} +void XEmitter::ANDPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseAND, regOp, arg); +} +void XEmitter::ANDPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseAND, regOp, arg); +} +void XEmitter::ANDNPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseANDN, regOp, arg); +} +void XEmitter::ANDNPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseANDN, regOp, arg); +} +void XEmitter::ORPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseOR, regOp, arg); +} +void XEmitter::ORPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseOR, regOp, arg); +} +void XEmitter::XORPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseXOR, regOp, arg); +} +void XEmitter::XORPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseXOR, regOp, arg); +} +void XEmitter::MULPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMUL, regOp, arg); +} +void XEmitter::MULPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMUL, regOp, arg); +} +void XEmitter::DIVPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseDIV, regOp, arg); +} +void XEmitter::DIVPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseDIV, regOp, arg); +} +void XEmitter::MINPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMIN, regOp, arg); +} +void XEmitter::MINPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMIN, regOp, arg); +} +void XEmitter::MAXPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMAX, regOp, arg); +} +void XEmitter::MAXPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMAX, regOp, arg); +} +void XEmitter::SQRTPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseSQRT, regOp, arg); +} +void XEmitter::SQRTPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseSQRT, regOp, arg); +} +void XEmitter::RCPPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseRCP, regOp, arg); +} +void XEmitter::RSQRTPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseRSQRT, regOp, arg); +} +void XEmitter::SHUFPS(X64Reg regOp, const OpArg& arg, u8 shuffle) { + WriteSSEOp(0x00, sseSHUF, regOp, arg, 1); + Write8(shuffle); +} +void XEmitter::SHUFPD(X64Reg regOp, const OpArg& arg, u8 shuffle) { + WriteSSEOp(0x66, sseSHUF, regOp, arg, 1); + Write8(shuffle); +} + +void XEmitter::HADDPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseHADD, regOp, arg); +} + +void XEmitter::COMISS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseCOMIS, regOp, arg); +} // weird that these should be packed +void XEmitter::COMISD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseCOMIS, regOp, arg); +} // ordered +void XEmitter::UCOMISS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseUCOMIS, regOp, arg); +} // unordered +void XEmitter::UCOMISD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseUCOMIS, regOp, arg); +} + +void XEmitter::MOVAPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMOVAPfromRM, regOp, arg); +} +void XEmitter::MOVAPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMOVAPfromRM, regOp, arg); +} +void XEmitter::MOVAPS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x00, sseMOVAPtoRM, regOp, arg); +} +void XEmitter::MOVAPD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVAPtoRM, regOp, arg); +} + +void XEmitter::MOVUPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMOVUPfromRM, regOp, arg); +} +void XEmitter::MOVUPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMOVUPfromRM, regOp, arg); +} +void XEmitter::MOVUPS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x00, sseMOVUPtoRM, regOp, arg); +} +void XEmitter::MOVUPD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVUPtoRM, regOp, arg); +} + +void XEmitter::MOVDQA(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMOVDQfromRM, regOp, arg); +} +void XEmitter::MOVDQA(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVDQtoRM, regOp, arg); +} +void XEmitter::MOVDQU(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseMOVDQfromRM, regOp, arg); +} +void XEmitter::MOVDQU(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0xF3, sseMOVDQtoRM, regOp, arg); +} + +void XEmitter::MOVSS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, sseMOVUPfromRM, regOp, arg); +} +void XEmitter::MOVSD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, sseMOVUPfromRM, regOp, arg); +} +void XEmitter::MOVSS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0xF3, sseMOVUPtoRM, regOp, arg); +} +void XEmitter::MOVSD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0xF2, sseMOVUPtoRM, regOp, arg); +} + +void XEmitter::MOVLPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMOVLPfromRM, regOp, arg); +} +void XEmitter::MOVLPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMOVLPfromRM, regOp, arg); +} +void XEmitter::MOVLPS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x00, sseMOVLPtoRM, regOp, arg); +} +void XEmitter::MOVLPD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVLPtoRM, regOp, arg); +} + +void XEmitter::MOVHPS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, sseMOVHPfromRM, regOp, arg); +} +void XEmitter::MOVHPD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, sseMOVHPfromRM, regOp, arg); +} +void XEmitter::MOVHPS(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x00, sseMOVHPtoRM, regOp, arg); +} +void XEmitter::MOVHPD(const OpArg& arg, X64Reg regOp) { + WriteSSEOp(0x66, sseMOVHPtoRM, regOp, arg); +} + +void XEmitter::MOVHLPS(X64Reg regOp1, X64Reg regOp2) { + WriteSSEOp(0x00, sseMOVHLPS, regOp1, R(regOp2)); +} +void XEmitter::MOVLHPS(X64Reg regOp1, X64Reg regOp2) { + WriteSSEOp(0x00, sseMOVLHPS, regOp1, R(regOp2)); +} + +void XEmitter::CVTPS2PD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, 0x5A, regOp, arg); +} +void XEmitter::CVTPD2PS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, 0x5A, regOp, arg); +} + +void XEmitter::CVTSD2SS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, 0x5A, regOp, arg); +} +void XEmitter::CVTSS2SD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0x5A, regOp, arg); +} +void XEmitter::CVTSD2SI(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, 0x2D, regOp, arg); +} +void XEmitter::CVTSS2SI(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0x2D, regOp, arg); +} +void XEmitter::CVTSI2SD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, 0x2A, regOp, arg); +} +void XEmitter::CVTSI2SS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0x2A, regOp, arg); +} + +void XEmitter::CVTDQ2PD(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0xE6, regOp, arg); +} +void XEmitter::CVTDQ2PS(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x00, 0x5B, regOp, arg); +} +void XEmitter::CVTPD2DQ(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, 0xE6, regOp, arg); +} +void XEmitter::CVTPS2DQ(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, 0x5B, regOp, arg); +} + +void XEmitter::CVTTSD2SI(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF2, 0x2C, regOp, arg); +} +void XEmitter::CVTTSS2SI(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0x2C, regOp, arg); +} +void XEmitter::CVTTPS2DQ(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0xF3, 0x5B, regOp, arg); +} +void XEmitter::CVTTPD2DQ(X64Reg regOp, const OpArg& arg) { + WriteSSEOp(0x66, 0xE6, regOp, arg); +} + +void XEmitter::MASKMOVDQU(X64Reg dest, X64Reg src) { + WriteSSEOp(0x66, sseMASKMOVDQU, dest, R(src)); +} + +void XEmitter::MOVMSKPS(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x00, 0x50, dest, arg); +} +void XEmitter::MOVMSKPD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x50, dest, arg); +} + +void XEmitter::LDDQU(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0xF2, sseLDDQU, dest, arg); +} // For integer data only // THESE TWO ARE UNTESTED. -void XEmitter::UNPCKLPS(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x00, 0x14, dest, arg);} -void XEmitter::UNPCKHPS(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x00, 0x15, dest, arg);} +void XEmitter::UNPCKLPS(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x00, 0x14, dest, arg); +} +void XEmitter::UNPCKHPS(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x00, 0x15, dest, arg); +} -void XEmitter::UNPCKLPD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x14, dest, arg);} -void XEmitter::UNPCKHPD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x15, dest, arg);} +void XEmitter::UNPCKLPD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x14, dest, arg); +} +void XEmitter::UNPCKHPD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x15, dest, arg); +} -void XEmitter::MOVDDUP(X64Reg regOp, const OpArg& arg) -{ - if (Common::GetCPUCaps().sse3) - { - WriteSSEOp(0xF2, 0x12, regOp, arg); //SSE3 movddup - } - else - { +void XEmitter::MOVDDUP(X64Reg regOp, const OpArg& arg) { + if (Common::GetCPUCaps().sse3) { + WriteSSEOp(0xF2, 0x12, regOp, arg); // SSE3 movddup + } else { // Simulate this instruction with SSE2 instructions if (!arg.IsSimpleReg(regOp)) MOVSD(regOp, arg); @@ -1684,38 +1873,48 @@ void XEmitter::MOVDDUP(X64Reg regOp, const OpArg& arg) } } -//There are a few more left +// There are a few more left // Also some integer instructions are missing -void XEmitter::PACKSSDW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x6B, dest, arg);} -void XEmitter::PACKSSWB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x63, dest, arg);} -void XEmitter::PACKUSWB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x67, dest, arg);} +void XEmitter::PACKSSDW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x6B, dest, arg); +} +void XEmitter::PACKSSWB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x63, dest, arg); +} +void XEmitter::PACKUSWB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x67, dest, arg); +} -void XEmitter::PUNPCKLBW(X64Reg dest, const OpArg &arg) {WriteSSEOp(0x66, 0x60, dest, arg);} -void XEmitter::PUNPCKLWD(X64Reg dest, const OpArg &arg) {WriteSSEOp(0x66, 0x61, dest, arg);} -void XEmitter::PUNPCKLDQ(X64Reg dest, const OpArg &arg) {WriteSSEOp(0x66, 0x62, dest, arg);} -void XEmitter::PUNPCKLQDQ(X64Reg dest, const OpArg &arg) {WriteSSEOp(0x66, 0x6C, dest, arg);} +void XEmitter::PUNPCKLBW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x60, dest, arg); +} +void XEmitter::PUNPCKLWD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x61, dest, arg); +} +void XEmitter::PUNPCKLDQ(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x62, dest, arg); +} +void XEmitter::PUNPCKLQDQ(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x6C, dest, arg); +} -void XEmitter::PSRLW(X64Reg reg, int shift) -{ +void XEmitter::PSRLW(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x71, (X64Reg)2, R(reg)); Write8(shift); } -void XEmitter::PSRLD(X64Reg reg, int shift) -{ +void XEmitter::PSRLD(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x72, (X64Reg)2, R(reg)); Write8(shift); } -void XEmitter::PSRLQ(X64Reg reg, int shift) -{ +void XEmitter::PSRLQ(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x73, (X64Reg)2, R(reg)); Write8(shift); } -void XEmitter::PSRLQ(X64Reg reg, const OpArg& arg) -{ +void XEmitter::PSRLQ(X64Reg reg, const OpArg& arg) { WriteSSEOp(0x66, 0xd3, reg, arg); } @@ -1724,20 +1923,17 @@ void XEmitter::PSRLDQ(X64Reg reg, int shift) { Write8(shift); } -void XEmitter::PSLLW(X64Reg reg, int shift) -{ +void XEmitter::PSLLW(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x71, (X64Reg)6, R(reg)); Write8(shift); } -void XEmitter::PSLLD(X64Reg reg, int shift) -{ +void XEmitter::PSLLD(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x72, (X64Reg)6, R(reg)); Write8(shift); } -void XEmitter::PSLLQ(X64Reg reg, int shift) -{ +void XEmitter::PSLLQ(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x73, (X64Reg)6, R(reg)); Write8(shift); } @@ -1747,267 +1943,643 @@ void XEmitter::PSLLDQ(X64Reg reg, int shift) { Write8(shift); } -void XEmitter::PSRAW(X64Reg reg, int shift) -{ +void XEmitter::PSRAW(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x71, (X64Reg)4, R(reg)); Write8(shift); } -void XEmitter::PSRAD(X64Reg reg, int shift) -{ +void XEmitter::PSRAD(X64Reg reg, int shift) { WriteSSEOp(0x66, 0x72, (X64Reg)4, R(reg)); Write8(shift); } -void XEmitter::WriteSSSE3Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteSSSE3Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) { if (!Common::GetCPUCaps().ssse3) ASSERT_MSG(0, "Trying to use SSSE3 on a system that doesn't support it. Bad programmer."); WriteSSEOp(opPrefix, op, regOp, arg, extrabytes); } -void XEmitter::WriteSSE41Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) -{ +void XEmitter::WriteSSE41Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes) { if (!Common::GetCPUCaps().sse4_1) ASSERT_MSG(0, "Trying to use SSE4.1 on a system that doesn't support it. Bad programmer."); WriteSSEOp(opPrefix, op, regOp, arg, extrabytes); } -void XEmitter::PSHUFB(X64Reg dest, const OpArg& arg) {WriteSSSE3Op(0x66, 0x3800, dest, arg);} -void XEmitter::PTEST(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3817, dest, arg);} -void XEmitter::PACKUSDW(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x382b, dest, arg);} -void XEmitter::DPPS(X64Reg dest, const OpArg& arg, u8 mask) {WriteSSE41Op(0x66, 0x3A40, dest, arg, 1); Write8(mask);} - -void XEmitter::PMINSB(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3838, dest, arg);} -void XEmitter::PMINSD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3839, dest, arg);} -void XEmitter::PMINUW(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383a, dest, arg);} -void XEmitter::PMINUD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383b, dest, arg);} -void XEmitter::PMAXSB(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383c, dest, arg);} -void XEmitter::PMAXSD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383d, dest, arg);} -void XEmitter::PMAXUW(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383e, dest, arg);} -void XEmitter::PMAXUD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x383f, dest, arg);} - -void XEmitter::PMOVSXBW(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3820, dest, arg);} -void XEmitter::PMOVSXBD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3821, dest, arg);} -void XEmitter::PMOVSXBQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3822, dest, arg);} -void XEmitter::PMOVSXWD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3823, dest, arg);} -void XEmitter::PMOVSXWQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3824, dest, arg);} -void XEmitter::PMOVSXDQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3825, dest, arg);} -void XEmitter::PMOVZXBW(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3830, dest, arg);} -void XEmitter::PMOVZXBD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3831, dest, arg);} -void XEmitter::PMOVZXBQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3832, dest, arg);} -void XEmitter::PMOVZXWD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3833, dest, arg);} -void XEmitter::PMOVZXWQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3834, dest, arg);} -void XEmitter::PMOVZXDQ(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3835, dest, arg);} - -void XEmitter::PBLENDVB(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3810, dest, arg);} -void XEmitter::BLENDVPS(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3814, dest, arg);} -void XEmitter::BLENDVPD(X64Reg dest, const OpArg& arg) {WriteSSE41Op(0x66, 0x3815, dest, arg);} -void XEmitter::BLENDPS(X64Reg dest, const OpArg& arg, u8 blend) { WriteSSE41Op(0x66, 0x3A0C, dest, arg, 1); Write8(blend); } -void XEmitter::BLENDPD(X64Reg dest, const OpArg& arg, u8 blend) { WriteSSE41Op(0x66, 0x3A0D, dest, arg, 1); Write8(blend); } - -void XEmitter::ROUNDSS(X64Reg dest, const OpArg& arg, u8 mode) {WriteSSE41Op(0x66, 0x3A0A, dest, arg, 1); Write8(mode);} -void XEmitter::ROUNDSD(X64Reg dest, const OpArg& arg, u8 mode) {WriteSSE41Op(0x66, 0x3A0B, dest, arg, 1); Write8(mode);} -void XEmitter::ROUNDPS(X64Reg dest, const OpArg& arg, u8 mode) {WriteSSE41Op(0x66, 0x3A08, dest, arg, 1); Write8(mode);} -void XEmitter::ROUNDPD(X64Reg dest, const OpArg& arg, u8 mode) {WriteSSE41Op(0x66, 0x3A09, dest, arg, 1); Write8(mode);} - -void XEmitter::PAND(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDB, dest, arg);} -void XEmitter::PANDN(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDF, dest, arg);} -void XEmitter::PXOR(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xEF, dest, arg);} -void XEmitter::POR(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xEB, dest, arg);} - -void XEmitter::PADDB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xFC, dest, arg);} -void XEmitter::PADDW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xFD, dest, arg);} -void XEmitter::PADDD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xFE, dest, arg);} -void XEmitter::PADDQ(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xD4, dest, arg);} - -void XEmitter::PADDSB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xEC, dest, arg);} -void XEmitter::PADDSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xED, dest, arg);} -void XEmitter::PADDUSB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDC, dest, arg);} -void XEmitter::PADDUSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDD, dest, arg);} - -void XEmitter::PSUBB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xF8, dest, arg);} -void XEmitter::PSUBW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xF9, dest, arg);} -void XEmitter::PSUBD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xFA, dest, arg);} -void XEmitter::PSUBQ(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xFB, dest, arg);} - -void XEmitter::PSUBSB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xE8, dest, arg);} -void XEmitter::PSUBSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xE9, dest, arg);} -void XEmitter::PSUBUSB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xD8, dest, arg);} -void XEmitter::PSUBUSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xD9, dest, arg);} - -void XEmitter::PAVGB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xE0, dest, arg);} -void XEmitter::PAVGW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xE3, dest, arg);} - -void XEmitter::PCMPEQB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x74, dest, arg);} -void XEmitter::PCMPEQW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x75, dest, arg);} -void XEmitter::PCMPEQD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x76, dest, arg);} - -void XEmitter::PCMPGTB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x64, dest, arg);} -void XEmitter::PCMPGTW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x65, dest, arg);} -void XEmitter::PCMPGTD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0x66, dest, arg);} - -void XEmitter::PEXTRW(X64Reg dest, const OpArg& arg, u8 subreg) {WriteSSEOp(0x66, 0xC5, dest, arg, 1); Write8(subreg);} -void XEmitter::PINSRW(X64Reg dest, const OpArg& arg, u8 subreg) {WriteSSEOp(0x66, 0xC4, dest, arg, 1); Write8(subreg);} - -void XEmitter::PMADDWD(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xF5, dest, arg); } -void XEmitter::PSADBW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xF6, dest, arg);} - -void XEmitter::PMAXSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xEE, dest, arg); } -void XEmitter::PMAXUB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDE, dest, arg); } -void XEmitter::PMINSW(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xEA, dest, arg); } -void XEmitter::PMINUB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xDA, dest, arg); } - -void XEmitter::PMOVMSKB(X64Reg dest, const OpArg& arg) {WriteSSEOp(0x66, 0xD7, dest, arg); } -void XEmitter::PSHUFD(X64Reg regOp, const OpArg& arg, u8 shuffle) {WriteSSEOp(0x66, 0x70, regOp, arg, 1); Write8(shuffle);} -void XEmitter::PSHUFLW(X64Reg regOp, const OpArg& arg, u8 shuffle) {WriteSSEOp(0xF2, 0x70, regOp, arg, 1); Write8(shuffle);} -void XEmitter::PSHUFHW(X64Reg regOp, const OpArg& arg, u8 shuffle) {WriteSSEOp(0xF3, 0x70, regOp, arg, 1); Write8(shuffle);} +void XEmitter::PSHUFB(X64Reg dest, const OpArg& arg) { + WriteSSSE3Op(0x66, 0x3800, dest, arg); +} +void XEmitter::PTEST(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3817, dest, arg); +} +void XEmitter::PACKUSDW(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x382b, dest, arg); +} +void XEmitter::DPPS(X64Reg dest, const OpArg& arg, u8 mask) { + WriteSSE41Op(0x66, 0x3A40, dest, arg, 1); + Write8(mask); +} + +void XEmitter::PMINSB(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3838, dest, arg); +} +void XEmitter::PMINSD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3839, dest, arg); +} +void XEmitter::PMINUW(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383a, dest, arg); +} +void XEmitter::PMINUD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383b, dest, arg); +} +void XEmitter::PMAXSB(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383c, dest, arg); +} +void XEmitter::PMAXSD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383d, dest, arg); +} +void XEmitter::PMAXUW(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383e, dest, arg); +} +void XEmitter::PMAXUD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x383f, dest, arg); +} + +void XEmitter::PMOVSXBW(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3820, dest, arg); +} +void XEmitter::PMOVSXBD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3821, dest, arg); +} +void XEmitter::PMOVSXBQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3822, dest, arg); +} +void XEmitter::PMOVSXWD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3823, dest, arg); +} +void XEmitter::PMOVSXWQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3824, dest, arg); +} +void XEmitter::PMOVSXDQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3825, dest, arg); +} +void XEmitter::PMOVZXBW(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3830, dest, arg); +} +void XEmitter::PMOVZXBD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3831, dest, arg); +} +void XEmitter::PMOVZXBQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3832, dest, arg); +} +void XEmitter::PMOVZXWD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3833, dest, arg); +} +void XEmitter::PMOVZXWQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3834, dest, arg); +} +void XEmitter::PMOVZXDQ(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3835, dest, arg); +} + +void XEmitter::PBLENDVB(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3810, dest, arg); +} +void XEmitter::BLENDVPS(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3814, dest, arg); +} +void XEmitter::BLENDVPD(X64Reg dest, const OpArg& arg) { + WriteSSE41Op(0x66, 0x3815, dest, arg); +} +void XEmitter::BLENDPS(X64Reg dest, const OpArg& arg, u8 blend) { + WriteSSE41Op(0x66, 0x3A0C, dest, arg, 1); + Write8(blend); +} +void XEmitter::BLENDPD(X64Reg dest, const OpArg& arg, u8 blend) { + WriteSSE41Op(0x66, 0x3A0D, dest, arg, 1); + Write8(blend); +} + +void XEmitter::ROUNDSS(X64Reg dest, const OpArg& arg, u8 mode) { + WriteSSE41Op(0x66, 0x3A0A, dest, arg, 1); + Write8(mode); +} +void XEmitter::ROUNDSD(X64Reg dest, const OpArg& arg, u8 mode) { + WriteSSE41Op(0x66, 0x3A0B, dest, arg, 1); + Write8(mode); +} +void XEmitter::ROUNDPS(X64Reg dest, const OpArg& arg, u8 mode) { + WriteSSE41Op(0x66, 0x3A08, dest, arg, 1); + Write8(mode); +} +void XEmitter::ROUNDPD(X64Reg dest, const OpArg& arg, u8 mode) { + WriteSSE41Op(0x66, 0x3A09, dest, arg, 1); + Write8(mode); +} + +void XEmitter::PAND(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDB, dest, arg); +} +void XEmitter::PANDN(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDF, dest, arg); +} +void XEmitter::PXOR(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xEF, dest, arg); +} +void XEmitter::POR(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xEB, dest, arg); +} + +void XEmitter::PADDB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xFC, dest, arg); +} +void XEmitter::PADDW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xFD, dest, arg); +} +void XEmitter::PADDD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xFE, dest, arg); +} +void XEmitter::PADDQ(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xD4, dest, arg); +} + +void XEmitter::PADDSB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xEC, dest, arg); +} +void XEmitter::PADDSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xED, dest, arg); +} +void XEmitter::PADDUSB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDC, dest, arg); +} +void XEmitter::PADDUSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDD, dest, arg); +} + +void XEmitter::PSUBB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xF8, dest, arg); +} +void XEmitter::PSUBW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xF9, dest, arg); +} +void XEmitter::PSUBD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xFA, dest, arg); +} +void XEmitter::PSUBQ(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xFB, dest, arg); +} + +void XEmitter::PSUBSB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xE8, dest, arg); +} +void XEmitter::PSUBSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xE9, dest, arg); +} +void XEmitter::PSUBUSB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xD8, dest, arg); +} +void XEmitter::PSUBUSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xD9, dest, arg); +} + +void XEmitter::PAVGB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xE0, dest, arg); +} +void XEmitter::PAVGW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xE3, dest, arg); +} + +void XEmitter::PCMPEQB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x74, dest, arg); +} +void XEmitter::PCMPEQW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x75, dest, arg); +} +void XEmitter::PCMPEQD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x76, dest, arg); +} + +void XEmitter::PCMPGTB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x64, dest, arg); +} +void XEmitter::PCMPGTW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x65, dest, arg); +} +void XEmitter::PCMPGTD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0x66, dest, arg); +} + +void XEmitter::PEXTRW(X64Reg dest, const OpArg& arg, u8 subreg) { + WriteSSEOp(0x66, 0xC5, dest, arg, 1); + Write8(subreg); +} +void XEmitter::PINSRW(X64Reg dest, const OpArg& arg, u8 subreg) { + WriteSSEOp(0x66, 0xC4, dest, arg, 1); + Write8(subreg); +} + +void XEmitter::PMADDWD(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xF5, dest, arg); +} +void XEmitter::PSADBW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xF6, dest, arg); +} + +void XEmitter::PMAXSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xEE, dest, arg); +} +void XEmitter::PMAXUB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDE, dest, arg); +} +void XEmitter::PMINSW(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xEA, dest, arg); +} +void XEmitter::PMINUB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xDA, dest, arg); +} + +void XEmitter::PMOVMSKB(X64Reg dest, const OpArg& arg) { + WriteSSEOp(0x66, 0xD7, dest, arg); +} +void XEmitter::PSHUFD(X64Reg regOp, const OpArg& arg, u8 shuffle) { + WriteSSEOp(0x66, 0x70, regOp, arg, 1); + Write8(shuffle); +} +void XEmitter::PSHUFLW(X64Reg regOp, const OpArg& arg, u8 shuffle) { + WriteSSEOp(0xF2, 0x70, regOp, arg, 1); + Write8(shuffle); +} +void XEmitter::PSHUFHW(X64Reg regOp, const OpArg& arg, u8 shuffle) { + WriteSSEOp(0xF3, 0x70, regOp, arg, 1); + Write8(shuffle); +} // VEX -void XEmitter::VADDSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0xF2, sseADD, regOp1, regOp2, arg);} -void XEmitter::VSUBSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0xF2, sseSUB, regOp1, regOp2, arg);} -void XEmitter::VMULSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0xF2, sseMUL, regOp1, regOp2, arg);} -void XEmitter::VDIVSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0xF2, sseDIV, regOp1, regOp2, arg);} -void XEmitter::VADDPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0x66, sseADD, regOp1, regOp2, arg);} -void XEmitter::VSUBPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0x66, sseSUB, regOp1, regOp2, arg);} -void XEmitter::VMULPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0x66, sseMUL, regOp1, regOp2, arg);} -void XEmitter::VDIVPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0x66, sseDIV, regOp1, regOp2, arg);} -void XEmitter::VSQRTSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteAVXOp(0xF2, sseSQRT, regOp1, regOp2, arg);} -void XEmitter::VSHUFPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg, u8 shuffle) {WriteAVXOp(0x66, sseSHUF, regOp1, regOp2, arg, 1); Write8(shuffle);} -void XEmitter::VUNPCKLPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg){WriteAVXOp(0x66, 0x14, regOp1, regOp2, arg);} -void XEmitter::VUNPCKHPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg){WriteAVXOp(0x66, 0x15, regOp1, regOp2, arg);} - -void XEmitter::VANDPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x00, sseAND, regOp1, regOp2, arg); } -void XEmitter::VANDPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, sseAND, regOp1, regOp2, arg); } -void XEmitter::VANDNPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x00, sseANDN, regOp1, regOp2, arg); } -void XEmitter::VANDNPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, sseANDN, regOp1, regOp2, arg); } -void XEmitter::VORPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x00, sseOR, regOp1, regOp2, arg); } -void XEmitter::VORPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, sseOR, regOp1, regOp2, arg); } -void XEmitter::VXORPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x00, sseXOR, regOp1, regOp2, arg); } -void XEmitter::VXORPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, sseXOR, regOp1, regOp2, arg); } - -void XEmitter::VPAND(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0xDB, regOp1, regOp2, arg); } -void XEmitter::VPANDN(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0xDF, regOp1, regOp2, arg); } -void XEmitter::VPOR(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0xEB, regOp1, regOp2, arg); } -void XEmitter::VPXOR(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0xEF, regOp1, regOp2, arg); } - -void XEmitter::VFMADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3898, regOp1, regOp2, arg); } -void XEmitter::VFMADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A8, regOp1, regOp2, arg); } -void XEmitter::VFMADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B8, regOp1, regOp2, arg); } -void XEmitter::VFMADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3898, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A8, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B8, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADD132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3899, regOp1, regOp2, arg); } -void XEmitter::VFMADD213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A9, regOp1, regOp2, arg); } -void XEmitter::VFMADD231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B9, regOp1, regOp2, arg); } -void XEmitter::VFMADD132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3899, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADD213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A9, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADD231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B9, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389A, regOp1, regOp2, arg); } -void XEmitter::VFMSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AA, regOp1, regOp2, arg); } -void XEmitter::VFMSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BA, regOp1, regOp2, arg); } -void XEmitter::VFMSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389A, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AA, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BA, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389B, regOp1, regOp2, arg); } -void XEmitter::VFMSUB213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AB, regOp1, regOp2, arg); } -void XEmitter::VFMSUB231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BB, regOp1, regOp2, arg); } -void XEmitter::VFMSUB132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389B, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AB, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUB231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BB, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389C, regOp1, regOp2, arg); } -void XEmitter::VFNMADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AC, regOp1, regOp2, arg); } -void XEmitter::VFNMADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BC, regOp1, regOp2, arg); } -void XEmitter::VFNMADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389C, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AC, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BC, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389D, regOp1, regOp2, arg); } -void XEmitter::VFNMADD213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AD, regOp1, regOp2, arg); } -void XEmitter::VFNMADD231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BD, regOp1, regOp2, arg); } -void XEmitter::VFNMADD132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389D, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AD, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMADD231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BD, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389E, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AE, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BE, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389E, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AE, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BE, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389F, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AF, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BF, regOp1, regOp2, arg); } -void XEmitter::VFNMSUB132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x389F, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38AF, regOp1, regOp2, arg, 1); } -void XEmitter::VFNMSUB231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38BF, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADDSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3896, regOp1, regOp2, arg); } -void XEmitter::VFMADDSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A6, regOp1, regOp2, arg); } -void XEmitter::VFMADDSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B6, regOp1, regOp2, arg); } -void XEmitter::VFMADDSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3896, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADDSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A6, regOp1, regOp2, arg, 1); } -void XEmitter::VFMADDSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B6, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUBADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3897, regOp1, regOp2, arg); } -void XEmitter::VFMSUBADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A7, regOp1, regOp2, arg); } -void XEmitter::VFMSUBADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B7, regOp1, regOp2, arg); } -void XEmitter::VFMSUBADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x3897, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUBADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38A7, regOp1, regOp2, arg, 1); } -void XEmitter::VFMSUBADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { WriteAVXOp(0x66, 0x38B7, regOp1, regOp2, arg, 1); } - -void XEmitter::SARX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) {WriteBMI2Op(bits, 0xF3, 0x38F7, regOp1, regOp2, arg);} -void XEmitter::SHLX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) {WriteBMI2Op(bits, 0x66, 0x38F7, regOp1, regOp2, arg);} -void XEmitter::SHRX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) {WriteBMI2Op(bits, 0xF2, 0x38F7, regOp1, regOp2, arg);} -void XEmitter::RORX(int bits, X64Reg regOp, const OpArg& arg, u8 rotate) {WriteBMI2Op(bits, 0xF2, 0x3AF0, regOp, INVALID_REG, arg, 1); Write8(rotate);} -void XEmitter::PEXT(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteBMI2Op(bits, 0xF3, 0x38F5, regOp1, regOp2, arg);} -void XEmitter::PDEP(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteBMI2Op(bits, 0xF2, 0x38F5, regOp1, regOp2, arg);} -void XEmitter::MULX(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteBMI2Op(bits, 0xF2, 0x38F6, regOp2, regOp1, arg);} -void XEmitter::BZHI(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) {WriteBMI2Op(bits, 0x00, 0x38F5, regOp1, regOp2, arg);} -void XEmitter::BLSR(int bits, X64Reg regOp, const OpArg& arg) {WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x1, regOp, arg);} -void XEmitter::BLSMSK(int bits, X64Reg regOp, const OpArg& arg) {WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x2, regOp, arg);} -void XEmitter::BLSI(int bits, X64Reg regOp, const OpArg& arg) {WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x3, regOp, arg);} -void XEmitter::BEXTR(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2){WriteBMI1Op(bits, 0x00, 0x38F7, regOp1, regOp2, arg);} -void XEmitter::ANDN(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) {WriteBMI1Op(bits, 0x00, 0x38F2, regOp1, regOp2, arg);} +void XEmitter::VADDSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0xF2, sseADD, regOp1, regOp2, arg); +} +void XEmitter::VSUBSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0xF2, sseSUB, regOp1, regOp2, arg); +} +void XEmitter::VMULSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0xF2, sseMUL, regOp1, regOp2, arg); +} +void XEmitter::VDIVSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0xF2, sseDIV, regOp1, regOp2, arg); +} +void XEmitter::VADDPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseADD, regOp1, regOp2, arg); +} +void XEmitter::VSUBPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseSUB, regOp1, regOp2, arg); +} +void XEmitter::VMULPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseMUL, regOp1, regOp2, arg); +} +void XEmitter::VDIVPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseDIV, regOp1, regOp2, arg); +} +void XEmitter::VSQRTSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0xF2, sseSQRT, regOp1, regOp2, arg); +} +void XEmitter::VSHUFPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg, u8 shuffle) { + WriteAVXOp(0x66, sseSHUF, regOp1, regOp2, arg, 1); + Write8(shuffle); +} +void XEmitter::VUNPCKLPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x14, regOp1, regOp2, arg); +} +void XEmitter::VUNPCKHPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x15, regOp1, regOp2, arg); +} + +void XEmitter::VANDPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x00, sseAND, regOp1, regOp2, arg); +} +void XEmitter::VANDPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseAND, regOp1, regOp2, arg); +} +void XEmitter::VANDNPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x00, sseANDN, regOp1, regOp2, arg); +} +void XEmitter::VANDNPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseANDN, regOp1, regOp2, arg); +} +void XEmitter::VORPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x00, sseOR, regOp1, regOp2, arg); +} +void XEmitter::VORPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseOR, regOp1, regOp2, arg); +} +void XEmitter::VXORPS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x00, sseXOR, regOp1, regOp2, arg); +} +void XEmitter::VXORPD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, sseXOR, regOp1, regOp2, arg); +} + +void XEmitter::VPAND(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0xDB, regOp1, regOp2, arg); +} +void XEmitter::VPANDN(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0xDF, regOp1, regOp2, arg); +} +void XEmitter::VPOR(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0xEB, regOp1, regOp2, arg); +} +void XEmitter::VPXOR(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0xEF, regOp1, regOp2, arg); +} + +void XEmitter::VFMADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3898, regOp1, regOp2, arg); +} +void XEmitter::VFMADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A8, regOp1, regOp2, arg); +} +void XEmitter::VFMADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B8, regOp1, regOp2, arg); +} +void XEmitter::VFMADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3898, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A8, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B8, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADD132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3899, regOp1, regOp2, arg); +} +void XEmitter::VFMADD213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A9, regOp1, regOp2, arg); +} +void XEmitter::VFMADD231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B9, regOp1, regOp2, arg); +} +void XEmitter::VFMADD132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3899, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADD213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A9, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADD231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B9, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389A, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AA, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BA, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389A, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AA, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BA, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389B, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AB, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BB, regOp1, regOp2, arg); +} +void XEmitter::VFMSUB132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389B, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AB, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUB231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BB, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389C, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AC, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BC, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389C, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AC, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BC, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389D, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AD, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BD, regOp1, regOp2, arg); +} +void XEmitter::VFNMADD132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389D, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AD, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMADD231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BD, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389E, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AE, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BE, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389E, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AE, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BE, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB132SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389F, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB213SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AF, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB231SS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BF, regOp1, regOp2, arg); +} +void XEmitter::VFNMSUB132SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x389F, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB213SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38AF, regOp1, regOp2, arg, 1); +} +void XEmitter::VFNMSUB231SD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38BF, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADDSUB132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3896, regOp1, regOp2, arg); +} +void XEmitter::VFMADDSUB213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A6, regOp1, regOp2, arg); +} +void XEmitter::VFMADDSUB231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B6, regOp1, regOp2, arg); +} +void XEmitter::VFMADDSUB132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3896, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADDSUB213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A6, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMADDSUB231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B6, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUBADD132PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3897, regOp1, regOp2, arg); +} +void XEmitter::VFMSUBADD213PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A7, regOp1, regOp2, arg); +} +void XEmitter::VFMSUBADD231PS(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B7, regOp1, regOp2, arg); +} +void XEmitter::VFMSUBADD132PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x3897, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUBADD213PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38A7, regOp1, regOp2, arg, 1); +} +void XEmitter::VFMSUBADD231PD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteAVXOp(0x66, 0x38B7, regOp1, regOp2, arg, 1); +} + +void XEmitter::SARX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) { + WriteBMI2Op(bits, 0xF3, 0x38F7, regOp1, regOp2, arg); +} +void XEmitter::SHLX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) { + WriteBMI2Op(bits, 0x66, 0x38F7, regOp1, regOp2, arg); +} +void XEmitter::SHRX(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) { + WriteBMI2Op(bits, 0xF2, 0x38F7, regOp1, regOp2, arg); +} +void XEmitter::RORX(int bits, X64Reg regOp, const OpArg& arg, u8 rotate) { + WriteBMI2Op(bits, 0xF2, 0x3AF0, regOp, INVALID_REG, arg, 1); + Write8(rotate); +} +void XEmitter::PEXT(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteBMI2Op(bits, 0xF3, 0x38F5, regOp1, regOp2, arg); +} +void XEmitter::PDEP(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteBMI2Op(bits, 0xF2, 0x38F5, regOp1, regOp2, arg); +} +void XEmitter::MULX(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteBMI2Op(bits, 0xF2, 0x38F6, regOp2, regOp1, arg); +} +void XEmitter::BZHI(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) { + WriteBMI2Op(bits, 0x00, 0x38F5, regOp1, regOp2, arg); +} +void XEmitter::BLSR(int bits, X64Reg regOp, const OpArg& arg) { + WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x1, regOp, arg); +} +void XEmitter::BLSMSK(int bits, X64Reg regOp, const OpArg& arg) { + WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x2, regOp, arg); +} +void XEmitter::BLSI(int bits, X64Reg regOp, const OpArg& arg) { + WriteBMI1Op(bits, 0x00, 0x38F3, (X64Reg)0x3, regOp, arg); +} +void XEmitter::BEXTR(int bits, X64Reg regOp1, const OpArg& arg, X64Reg regOp2) { + WriteBMI1Op(bits, 0x00, 0x38F7, regOp1, regOp2, arg); +} +void XEmitter::ANDN(int bits, X64Reg regOp1, X64Reg regOp2, const OpArg& arg) { + WriteBMI1Op(bits, 0x00, 0x38F2, regOp1, regOp2, arg); +} // Prefixes -void XEmitter::LOCK() { Write8(0xF0); } -void XEmitter::REP() { Write8(0xF3); } -void XEmitter::REPNE() { Write8(0xF2); } -void XEmitter::FSOverride() { Write8(0x64); } -void XEmitter::GSOverride() { Write8(0x65); } +void XEmitter::LOCK() { + Write8(0xF0); +} +void XEmitter::REP() { + Write8(0xF3); +} +void XEmitter::REPNE() { + Write8(0xF2); +} +void XEmitter::FSOverride() { + Write8(0x64); +} +void XEmitter::GSOverride() { + Write8(0x65); +} -void XEmitter::FWAIT() -{ +void XEmitter::FWAIT() { Write8(0x9B); } // TODO: make this more generic -void XEmitter::WriteFloatLoadStore(int bits, FloatOp op, FloatOp op_80b, const OpArg& arg) -{ +void XEmitter::WriteFloatLoadStore(int bits, FloatOp op, FloatOp op_80b, const OpArg& arg) { int mf = 0; - ASSERT_MSG(!(bits == 80 && op_80b == floatINVALID), "WriteFloatLoadStore: 80 bits not supported for this instruction"); - switch (bits) - { - case 32: mf = 0; break; - case 64: mf = 4; break; - case 80: mf = 2; break; - default: ASSERT_MSG(0, "WriteFloatLoadStore: invalid bits (should be 32/64/80)"); + ASSERT_MSG(!(bits == 80 && op_80b == floatINVALID), + "WriteFloatLoadStore: 80 bits not supported for this instruction"); + switch (bits) { + case 32: + mf = 0; + break; + case 64: + mf = 4; + break; + case 80: + mf = 2; + break; + default: + ASSERT_MSG(0, "WriteFloatLoadStore: invalid bits (should be 32/64/80)"); } Write8(0xd9 | mf); // x87 instructions use the reg field of the ModR/M byte as opcode: if (bits == 80) op = op_80b; - arg.WriteRest(this, 0, (X64Reg) op); + arg.WriteRest(this, 0, (X64Reg)op); } -void XEmitter::FLD(int bits, const OpArg& src) {WriteFloatLoadStore(bits, floatLD, floatLD80, src);} -void XEmitter::FST(int bits, const OpArg& dest) {WriteFloatLoadStore(bits, floatST, floatINVALID, dest);} -void XEmitter::FSTP(int bits, const OpArg& dest) {WriteFloatLoadStore(bits, floatSTP, floatSTP80, dest);} -void XEmitter::FNSTSW_AX() { Write8(0xDF); Write8(0xE0); } +void XEmitter::FLD(int bits, const OpArg& src) { + WriteFloatLoadStore(bits, floatLD, floatLD80, src); +} +void XEmitter::FST(int bits, const OpArg& dest) { + WriteFloatLoadStore(bits, floatST, floatINVALID, dest); +} +void XEmitter::FSTP(int bits, const OpArg& dest) { + WriteFloatLoadStore(bits, floatSTP, floatSTP80, dest); +} +void XEmitter::FNSTSW_AX() { + Write8(0xDF); + Write8(0xE0); +} -void XEmitter::RDTSC() { Write8(0x0F); Write8(0x31); } +void XEmitter::RDTSC() { + Write8(0x0F); + Write8(0x31); +} void XCodeBlock::PoisonMemory() { // x86/64: 0xCC = breakpoint memset(region, 0xCC, region_size); } - } diff --git a/src/common/x64/emitter.h b/src/common/x64/emitter.h index 60a77dfe1..467f7812f 100644 --- a/src/common/x64/emitter.h +++ b/src/common/x64/emitter.h @@ -21,8 +21,8 @@ #include "common/assert.h" #include "common/bit_set.h" -#include "common/common_types.h" #include "common/code_block.h" +#include "common/common_types.h" #if defined(ARCHITECTURE_x86_64) && !defined(_ARCH_64) #define _ARCH_64 @@ -34,75 +34,145 @@ #define PTRBITS 32 #endif -namespace Gen -{ - -enum X64Reg -{ - EAX = 0, EBX = 3, ECX = 1, EDX = 2, - ESI = 6, EDI = 7, EBP = 5, ESP = 4, - - RAX = 0, RBX = 3, RCX = 1, RDX = 2, - RSI = 6, RDI = 7, RBP = 5, RSP = 4, - R8 = 8, R9 = 9, R10 = 10,R11 = 11, - R12 = 12,R13 = 13,R14 = 14,R15 = 15, - - AL = 0, BL = 3, CL = 1, DL = 2, - SIL = 6, DIL = 7, BPL = 5, SPL = 4, - AH = 0x104, BH = 0x107, CH = 0x105, DH = 0x106, - - AX = 0, BX = 3, CX = 1, DX = 2, - SI = 6, DI = 7, BP = 5, SP = 4, - - XMM0=0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, - - YMM0=0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7, - YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15, +namespace Gen { + +enum X64Reg { + EAX = 0, + EBX = 3, + ECX = 1, + EDX = 2, + ESI = 6, + EDI = 7, + EBP = 5, + ESP = 4, + + RAX = 0, + RBX = 3, + RCX = 1, + RDX = 2, + RSI = 6, + RDI = 7, + RBP = 5, + RSP = 4, + R8 = 8, + R9 = 9, + R10 = 10, + R11 = 11, + R12 = 12, + R13 = 13, + R14 = 14, + R15 = 15, + + AL = 0, + BL = 3, + CL = 1, + DL = 2, + SIL = 6, + DIL = 7, + BPL = 5, + SPL = 4, + AH = 0x104, + BH = 0x107, + CH = 0x105, + DH = 0x106, + + AX = 0, + BX = 3, + CX = 1, + DX = 2, + SI = 6, + DI = 7, + BP = 5, + SP = 4, + + XMM0 = 0, + XMM1, + XMM2, + XMM3, + XMM4, + XMM5, + XMM6, + XMM7, + XMM8, + XMM9, + XMM10, + XMM11, + XMM12, + XMM13, + XMM14, + XMM15, + + YMM0 = 0, + YMM1, + YMM2, + YMM3, + YMM4, + YMM5, + YMM6, + YMM7, + YMM8, + YMM9, + YMM10, + YMM11, + YMM12, + YMM13, + YMM14, + YMM15, INVALID_REG = 0xFFFFFFFF }; -enum CCFlags -{ - CC_O = 0, - CC_NO = 1, - CC_B = 2, CC_C = 2, CC_NAE = 2, - CC_NB = 3, CC_NC = 3, CC_AE = 3, - CC_Z = 4, CC_E = 4, - CC_NZ = 5, CC_NE = 5, - CC_BE = 6, CC_NA = 6, - CC_NBE = 7, CC_A = 7, - CC_S = 8, - CC_NS = 9, - CC_P = 0xA, CC_PE = 0xA, - CC_NP = 0xB, CC_PO = 0xB, - CC_L = 0xC, CC_NGE = 0xC, - CC_NL = 0xD, CC_GE = 0xD, - CC_LE = 0xE, CC_NG = 0xE, - CC_NLE = 0xF, CC_G = 0xF +enum CCFlags { + CC_O = 0, + CC_NO = 1, + CC_B = 2, + CC_C = 2, + CC_NAE = 2, + CC_NB = 3, + CC_NC = 3, + CC_AE = 3, + CC_Z = 4, + CC_E = 4, + CC_NZ = 5, + CC_NE = 5, + CC_BE = 6, + CC_NA = 6, + CC_NBE = 7, + CC_A = 7, + CC_S = 8, + CC_NS = 9, + CC_P = 0xA, + CC_PE = 0xA, + CC_NP = 0xB, + CC_PO = 0xB, + CC_L = 0xC, + CC_NGE = 0xC, + CC_NL = 0xD, + CC_GE = 0xD, + CC_LE = 0xE, + CC_NG = 0xE, + CC_NLE = 0xF, + CC_G = 0xF }; -enum -{ +enum { NUMGPRs = 16, NUMXMMs = 16, }; -enum -{ +enum { SCALE_NONE = 0, SCALE_1 = 1, SCALE_2 = 2, SCALE_4 = 4, SCALE_8 = 8, SCALE_ATREG = 16, - //SCALE_NOBASE_1 is not supported and can be replaced with SCALE_ATREG + // SCALE_NOBASE_1 is not supported and can be replaced with SCALE_ATREG SCALE_NOBASE_2 = 34, SCALE_NOBASE_4 = 36, SCALE_NOBASE_8 = 40, SCALE_RIP = 0xFF, - SCALE_IMM8 = 0xF0, + SCALE_IMM8 = 0xF0, SCALE_IMM16 = 0xF1, SCALE_IMM32 = 0xF2, SCALE_IMM64 = 0xF3, @@ -114,7 +184,7 @@ enum NormalOp { nrmSUB, nrmSBB, nrmAND, - nrmOR , + nrmOR, nrmXOR, nrmMOV, nrmTEST, @@ -157,68 +227,74 @@ enum FloatRound { class XEmitter; // RIP addressing does not benefit from micro op fusion on Core arch -struct OpArg -{ +struct OpArg { friend class XEmitter; - constexpr OpArg() = default; // dummy op arg, used for storage + constexpr OpArg() = default; // dummy op arg, used for storage constexpr OpArg(u64 offset_, int scale_, X64Reg rmReg = RAX, X64Reg scaledReg = RAX) - : scale(static_cast(scale_)) - , offsetOrBaseReg(static_cast(rmReg)) - , indexReg(static_cast(scaledReg)) - , offset(offset_) - { + : scale(static_cast(scale_)), offsetOrBaseReg(static_cast(rmReg)), + indexReg(static_cast(scaledReg)), offset(offset_) { } - constexpr bool operator==(const OpArg &b) const - { - return operandReg == b.operandReg && - scale == b.scale && - offsetOrBaseReg == b.offsetOrBaseReg && - indexReg == b.indexReg && - offset == b.offset; + constexpr bool operator==(const OpArg& b) const { + return operandReg == b.operandReg && scale == b.scale && + offsetOrBaseReg == b.offsetOrBaseReg && indexReg == b.indexReg && offset == b.offset; } - void WriteRex(XEmitter *emit, int opBits, int bits, int customOp = -1) const; - void WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp, int mmmmm, int W = 0) const; - void WriteRest(XEmitter *emit, int extraBytes=0, X64Reg operandReg=INVALID_REG, bool warn_64bit_offset = true) const; - void WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg operandReg, int bits); - void WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg &operand, int bits) const; - - constexpr bool IsImm() const { return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64; } - constexpr bool IsSimpleReg() const { return scale == SCALE_NONE; } - constexpr bool IsSimpleReg(X64Reg reg) const - { + void WriteRex(XEmitter* emit, int opBits, int bits, int customOp = -1) const; + void WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp, int mmmmm, + int W = 0) const; + void WriteRest(XEmitter* emit, int extraBytes = 0, X64Reg operandReg = INVALID_REG, + bool warn_64bit_offset = true) const; + void WriteSingleByteOp(XEmitter* emit, u8 op, X64Reg operandReg, int bits); + void WriteNormalOp(XEmitter* emit, bool toRM, NormalOp op, const OpArg& operand, + int bits) const; + + constexpr bool IsImm() const { + return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || + scale == SCALE_IMM64; + } + constexpr bool IsSimpleReg() const { + return scale == SCALE_NONE; + } + constexpr bool IsSimpleReg(X64Reg reg) const { return IsSimpleReg() && GetSimpleReg() == reg; } - int GetImmBits() const - { - switch (scale) - { - case SCALE_IMM8: return 8; - case SCALE_IMM16: return 16; - case SCALE_IMM32: return 32; - case SCALE_IMM64: return 64; - default: return -1; + int GetImmBits() const { + switch (scale) { + case SCALE_IMM8: + return 8; + case SCALE_IMM16: + return 16; + case SCALE_IMM32: + return 32; + case SCALE_IMM64: + return 64; + default: + return -1; } } void SetImmBits(int bits) { - switch (bits) - { - case 8: scale = SCALE_IMM8; break; - case 16: scale = SCALE_IMM16; break; - case 32: scale = SCALE_IMM32; break; - case 64: scale = SCALE_IMM64; break; + switch (bits) { + case 8: + scale = SCALE_IMM8; + break; + case 16: + scale = SCALE_IMM16; + break; + case 32: + scale = SCALE_IMM32; + break; + case 64: + scale = SCALE_IMM64; + break; } } - constexpr X64Reg GetSimpleReg() const - { - return scale == SCALE_NONE - ? static_cast(offsetOrBaseReg) - : INVALID_REG; + constexpr X64Reg GetSimpleReg() const { + return scale == SCALE_NONE ? static_cast(offsetOrBaseReg) : INVALID_REG; } constexpr u32 GetImmValue() const { @@ -234,41 +310,50 @@ private: u8 scale = 0; u16 offsetOrBaseReg = 0; u16 indexReg = 0; - u64 offset = 0; // use RIP-relative as much as possible - 64-bit immediates are not available. + u64 offset = 0; // use RIP-relative as much as possible - 64-bit immediates are not available. u16 operandReg = 0; }; template -inline OpArg M(const T *ptr) { return OpArg(reinterpret_cast(ptr), static_cast(SCALE_RIP)); } -constexpr OpArg R(X64Reg value) { return OpArg(0, SCALE_NONE, value); } -constexpr OpArg MatR(X64Reg value) { return OpArg(0, SCALE_ATREG, value); } +inline OpArg M(const T* ptr) { + return OpArg(reinterpret_cast(ptr), static_cast(SCALE_RIP)); +} +constexpr OpArg R(X64Reg value) { + return OpArg(0, SCALE_NONE, value); +} +constexpr OpArg MatR(X64Reg value) { + return OpArg(0, SCALE_ATREG, value); +} -constexpr OpArg MDisp(X64Reg value, int offset) -{ +constexpr OpArg MDisp(X64Reg value, int offset) { return OpArg(static_cast(offset), SCALE_ATREG, value); } -constexpr OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset) -{ +constexpr OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset) { return OpArg(offset, scale, base, scaled); } -constexpr OpArg MScaled(X64Reg scaled, int scale, int offset) -{ - return scale == SCALE_1 - ? OpArg(offset, SCALE_ATREG, scaled) - : OpArg(offset, scale | 0x20, RAX, scaled); +constexpr OpArg MScaled(X64Reg scaled, int scale, int offset) { + return scale == SCALE_1 ? OpArg(offset, SCALE_ATREG, scaled) + : OpArg(offset, scale | 0x20, RAX, scaled); } -constexpr OpArg MRegSum(X64Reg base, X64Reg offset) -{ +constexpr OpArg MRegSum(X64Reg base, X64Reg offset) { return MComplex(base, offset, 1, 0); } -constexpr OpArg Imm8 (u8 imm) { return OpArg(imm, SCALE_IMM8); } -constexpr OpArg Imm16(u16 imm) { return OpArg(imm, SCALE_IMM16); } //rarely used -constexpr OpArg Imm32(u32 imm) { return OpArg(imm, SCALE_IMM32); } -constexpr OpArg Imm64(u64 imm) { return OpArg(imm, SCALE_IMM64); } +constexpr OpArg Imm8(u8 imm) { + return OpArg(imm, SCALE_IMM8); +} +constexpr OpArg Imm16(u16 imm) { + return OpArg(imm, SCALE_IMM16); +} // rarely used +constexpr OpArg Imm32(u32 imm) { + return OpArg(imm, SCALE_IMM32); +} +constexpr OpArg Imm64(u64 imm) { + return OpArg(imm, SCALE_IMM64); +} constexpr OpArg UImmAuto(u32 imm) { return OpArg(imm, imm >= 128 ? SCALE_IMM32 : SCALE_IMM8); } @@ -277,8 +362,7 @@ constexpr OpArg SImmAuto(s32 imm) { } template -OpArg ImmPtr(const T* imm) -{ +OpArg ImmPtr(const T* imm) { #ifdef _ARCH_64 return Imm64(reinterpret_cast(imm)); #else @@ -286,36 +370,31 @@ OpArg ImmPtr(const T* imm) #endif } -inline u32 PtrOffset(const void* ptr, const void* base) -{ +inline u32 PtrOffset(const void* ptr, const void* base) { #ifdef _ARCH_64 - s64 distance = (s64)ptr-(s64)base; - if (distance >= 0x80000000LL || - distance < -0x80000000LL) - { + s64 distance = (s64)ptr - (s64)base; + if (distance >= 0x80000000LL || distance < -0x80000000LL) { ASSERT_MSG(0, "pointer offset out of range"); return 0; } return (u32)distance; #else - return (u32)ptr-(u32)base; + return (u32)ptr - (u32)base; #endif } -//usage: int a[]; ARRAY_OFFSET(a,10) -#define ARRAY_OFFSET(array,index) ((u32)((u64)&(array)[index]-(u64)&(array)[0])) -//usage: struct {int e;} s; STRUCT_OFFSET(s,e) -#define STRUCT_OFFSET(str,elem) ((u32)((u64)&(str).elem-(u64)&(str))) +// usage: int a[]; ARRAY_OFFSET(a,10) +#define ARRAY_OFFSET(array, index) ((u32)((u64) & (array)[index] - (u64) & (array)[0])) +// usage: struct {int e;} s; STRUCT_OFFSET(s,e) +#define STRUCT_OFFSET(str, elem) ((u32)((u64) & (str).elem - (u64) & (str))) -struct FixupBranch -{ - u8 *ptr; - int type; //0 = 8bit 1 = 32bit +struct FixupBranch { + u8* ptr; + int type; // 0 = 8bit 1 = 32bit }; -enum SSECompare -{ +enum SSECompare { EQ = 0, LT, LE, @@ -326,11 +405,10 @@ enum SSECompare ORD, }; -class XEmitter -{ - friend struct OpArg; // for Write8 etc +class XEmitter { + friend struct OpArg; // for Write8 etc private: - u8 *code; + u8* code; bool flags_locked; void CheckFlags(); @@ -347,14 +425,19 @@ private: void WriteSSSE3Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); void WriteSSE41Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); void WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes = 0); - void WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes = 0); - void WriteVEXOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes = 0); - void WriteBMI1Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes = 0); - void WriteBMI2Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int extrabytes = 0); + void WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, + int extrabytes = 0); + void WriteVEXOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, + int extrabytes = 0); + void WriteBMI1Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, + int extrabytes = 0); + void WriteBMI2Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, + int extrabytes = 0); void WriteFloatLoadStore(int bits, FloatOp op, FloatOp op_80b, const OpArg& arg); - void WriteNormalOp(XEmitter *emit, int bits, NormalOp op, const OpArg& a1, const OpArg& a2); + void WriteNormalOp(XEmitter* emit, int bits, NormalOp op, const OpArg& a1, const OpArg& a2); - void ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp); + void ABI_CalculateFrameSize(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size, + size_t* shadowp, size_t* subtractionp, size_t* xmm_offsetp); protected: void Write8(u8 value); @@ -363,26 +446,38 @@ protected: void Write64(u64 value); public: - XEmitter() { code = nullptr; flags_locked = false; } - XEmitter(u8 *code_ptr) { code = code_ptr; flags_locked = false; } - virtual ~XEmitter() {} + XEmitter() { + code = nullptr; + flags_locked = false; + } + XEmitter(u8* code_ptr) { + code = code_ptr; + flags_locked = false; + } + virtual ~XEmitter() { + } void WriteModRM(int mod, int rm, int reg); void WriteSIB(int scale, int index, int base); - void SetCodePtr(u8 *ptr); + void SetCodePtr(u8* ptr); void ReserveCodeSpace(int bytes); - const u8 *AlignCode4(); - const u8 *AlignCode16(); - const u8 *AlignCodePage(); - const u8 *GetCodePtr() const; - u8 *GetWritableCodePtr(); - - void LockFlags() { flags_locked = true; } - void UnlockFlags() { flags_locked = false; } + const u8* AlignCode4(); + const u8* AlignCode16(); + const u8* AlignCodePage(); + const u8* GetCodePtr() const; + u8* GetWritableCodePtr(); + + void LockFlags() { + flags_locked = true; + } + void UnlockFlags() { + flags_locked = false; + } // Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU - // INC, DEC, LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XCHG, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr., + // INC, DEC, LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XCHG, XLAT, REP MOVSB/MOVSD, REP SCASD + other + // string instr., // INC and DEC are slow on Intel Core, but not on AMD. They create a // false flag dependency because they only update a subset of the flags. // XCHG is SLOW and should be avoided. @@ -401,11 +496,11 @@ public: void CLC(); void CMC(); - // These two can not be executed in 64-bit mode on early Intel 64-bit CPU:s, only on Core2 and AMD! + // These two can not be executed in 64-bit mode on early Intel 64-bit CPU:s, only on Core2 and + // AMD! void LAHF(); // 3 cycle vector path void SAHF(); // direct path fast - // Stack control void PUSH(X64Reg reg); void POP(X64Reg reg); @@ -422,7 +517,7 @@ public: void JMP(const u8* addr, bool force5Bytes = false); void JMPptr(const OpArg& arg); - void JMPself(); //infinite loop! + void JMPself(); // infinite loop! #ifdef CALL #undef CALL #endif @@ -450,12 +545,11 @@ public: void BSR(int bits, X64Reg dest, const OpArg& src); // Top bit to bottom bit // Cache control - enum PrefetchLevel - { - PF_NTA, //Non-temporal (data used once and only once) - PF_T0, //All cache levels - PF_T1, //Levels 2+ (aliased to T0 on AMD) - PF_T2, //Levels 3+ (aliased to T0 on AMD) + enum PrefetchLevel { + PF_NTA, // Non-temporal (data used once and only once) + PF_T0, // All cache levels + PF_T1, // Levels 2+ (aliased to T0 on AMD) + PF_T2, // Levels 3+ (aliased to T0 on AMD) }; void PREFETCH(PrefetchLevel level, OpArg arg); void MOVNTI(int bits, const OpArg& dest, X64Reg src); @@ -464,8 +558,8 @@ public: void MOVNTPD(const OpArg& arg, X64Reg regOp); // Multiplication / division - void MUL(int bits, const OpArg& src); //UNSIGNED - void IMUL(int bits, const OpArg& src); //SIGNED + void MUL(int bits, const OpArg& src); // UNSIGNED + void IMUL(int bits, const OpArg& src); // SIGNED void IMUL(int bits, X64Reg regOp, const OpArg& src); void IMUL(int bits, X64Reg regOp, const OpArg& src, const OpArg& imm); void DIV(int bits, const OpArg& src); @@ -492,11 +586,19 @@ public: // Extend EAX into EDX in various ways void CWD(int bits = 16); - void CDQ() {CWD(32);} - void CQO() {CWD(64);} + void CDQ() { + CWD(32); + } + void CQO() { + CWD(64); + } void CBW(int bits = 8); - void CWDE() {CBW(16);} - void CDQE() {CBW(32);} + void CWDE() { + CBW(16); + } + void CDQE() { + CBW(32); + } // Load effective address void LEA(int bits, X64Reg dest, OpArg src); @@ -511,7 +613,7 @@ public: void CMP(int bits, const OpArg& a1, const OpArg& a2); // Bit operations - void NOT (int bits, const OpArg& src); + void NOT(int bits, const OpArg& src); void OR(int bits, const OpArg& a1, const OpArg& a2); void XOR(int bits, const OpArg& a1, const OpArg& a2); void MOV(int bits, const OpArg& a1, const OpArg& a2); @@ -525,7 +627,8 @@ public: void BSWAP(int bits, X64Reg reg); // Sign/zero extension - void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //automatically uses MOVSXD if necessary + void MOVSX(int dbits, int sbits, X64Reg dest, + OpArg src); // automatically uses MOVSXD if necessary void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src); // Available only on Atom or >= Haswell so far. Test with GetCPUCaps().movbe. @@ -593,13 +696,27 @@ public: void CMPSS(X64Reg regOp, const OpArg& arg, u8 compare); void CMPSD(X64Reg regOp, const OpArg& arg, u8 compare); - void CMPEQSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_EQ); } - void CMPLTSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_LT); } - void CMPLESS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_LE); } - void CMPUNORDSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_UNORD); } - void CMPNEQSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_NEQ); } - void CMPNLTSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_NLT); } - void CMPORDSS(X64Reg regOp, const OpArg& arg) { CMPSS(regOp, arg, CMP_ORD); } + void CMPEQSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_EQ); + } + void CMPLTSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_LT); + } + void CMPLESS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_LE); + } + void CMPUNORDSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_UNORD); + } + void CMPNEQSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_NEQ); + } + void CMPNLTSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_NLT); + } + void CMPORDSS(X64Reg regOp, const OpArg& arg) { + CMPSS(regOp, arg, CMP_ORD); + } // SSE/SSE2: Floating point packed arithmetic (x4 for float, x2 for double) void ADDPS(X64Reg regOp, const OpArg& arg); @@ -638,10 +755,12 @@ public: // SSE/SSE2: Useful alternative to shuffle in some cases. void MOVDDUP(X64Reg regOp, const OpArg& arg); - // SSE3: Horizontal operations in SIMD registers. Very slow! shufps-based code beats it handily on Ivy. + // SSE3: Horizontal operations in SIMD registers. Very slow! shufps-based code beats it handily + // on Ivy. void HADDPS(X64Reg dest, const OpArg& src); - // SSE4: Further horizontal operations - dot products. These are weirdly flexible, the arg contains both a read mask and a write "mask". + // SSE4: Further horizontal operations - dot products. These are weirdly flexible, the arg + // contains both a read mask and a write "mask". void DPPS(X64Reg dest, const OpArg& src, u8 arg); void UNPCKLPS(X64Reg dest, const OpArg& src); @@ -694,11 +813,13 @@ public: void MOVD_xmm(const OpArg& arg, X64Reg src); void MOVQ_xmm(OpArg arg, X64Reg src); - // SSE/SSE2: Generates a mask from the high bits of the components of the packed register in question. + // SSE/SSE2: Generates a mask from the high bits of the components of the packed register in + // question. void MOVMSKPS(X64Reg dest, const OpArg& arg); void MOVMSKPD(X64Reg dest, const OpArg& arg); - // SSE2: Selective byte store, mask in src register. EDI/RDI specifies store address. This is a weird one. + // SSE2: Selective byte store, mask in src register. EDI/RDI specifies store address. This is a + // weird one. void MASKMOVDQU(X64Reg dest, X64Reg src); void LDDQU(X64Reg dest, const OpArg& src); @@ -729,10 +850,10 @@ public: void PACKUSDW(X64Reg dest, const OpArg& arg); void PACKUSWB(X64Reg dest, const OpArg& arg); - void PUNPCKLBW(X64Reg dest, const OpArg &arg); - void PUNPCKLWD(X64Reg dest, const OpArg &arg); - void PUNPCKLDQ(X64Reg dest, const OpArg &arg); - void PUNPCKLQDQ(X64Reg dest, const OpArg &arg); + void PUNPCKLBW(X64Reg dest, const OpArg& arg); + void PUNPCKLWD(X64Reg dest, const OpArg& arg); + void PUNPCKLDQ(X64Reg dest, const OpArg& arg); + void PUNPCKLQDQ(X64Reg dest, const OpArg& arg); void PTEST(X64Reg dest, const OpArg& arg); void PAND(X64Reg dest, const OpArg& arg); @@ -839,25 +960,57 @@ public: void ROUNDPS(X64Reg dest, const OpArg& arg, u8 mode); void ROUNDPD(X64Reg dest, const OpArg& arg, u8 mode); - void ROUNDNEARSS(X64Reg dest, const OpArg& arg) { ROUNDSS(dest, arg, FROUND_NEAREST); } - void ROUNDFLOORSS(X64Reg dest, const OpArg& arg) { ROUNDSS(dest, arg, FROUND_FLOOR); } - void ROUNDCEILSS(X64Reg dest, const OpArg& arg) { ROUNDSS(dest, arg, FROUND_CEIL); } - void ROUNDZEROSS(X64Reg dest, const OpArg& arg) { ROUNDSS(dest, arg, FROUND_ZERO); } + void ROUNDNEARSS(X64Reg dest, const OpArg& arg) { + ROUNDSS(dest, arg, FROUND_NEAREST); + } + void ROUNDFLOORSS(X64Reg dest, const OpArg& arg) { + ROUNDSS(dest, arg, FROUND_FLOOR); + } + void ROUNDCEILSS(X64Reg dest, const OpArg& arg) { + ROUNDSS(dest, arg, FROUND_CEIL); + } + void ROUNDZEROSS(X64Reg dest, const OpArg& arg) { + ROUNDSS(dest, arg, FROUND_ZERO); + } - void ROUNDNEARSD(X64Reg dest, const OpArg& arg) { ROUNDSD(dest, arg, FROUND_NEAREST); } - void ROUNDFLOORSD(X64Reg dest, const OpArg& arg) { ROUNDSD(dest, arg, FROUND_FLOOR); } - void ROUNDCEILSD(X64Reg dest, const OpArg& arg) { ROUNDSD(dest, arg, FROUND_CEIL); } - void ROUNDZEROSD(X64Reg dest, const OpArg& arg) { ROUNDSD(dest, arg, FROUND_ZERO); } + void ROUNDNEARSD(X64Reg dest, const OpArg& arg) { + ROUNDSD(dest, arg, FROUND_NEAREST); + } + void ROUNDFLOORSD(X64Reg dest, const OpArg& arg) { + ROUNDSD(dest, arg, FROUND_FLOOR); + } + void ROUNDCEILSD(X64Reg dest, const OpArg& arg) { + ROUNDSD(dest, arg, FROUND_CEIL); + } + void ROUNDZEROSD(X64Reg dest, const OpArg& arg) { + ROUNDSD(dest, arg, FROUND_ZERO); + } - void ROUNDNEARPS(X64Reg dest, const OpArg& arg) { ROUNDPS(dest, arg, FROUND_NEAREST); } - void ROUNDFLOORPS(X64Reg dest, const OpArg& arg) { ROUNDPS(dest, arg, FROUND_FLOOR); } - void ROUNDCEILPS(X64Reg dest, const OpArg& arg) { ROUNDPS(dest, arg, FROUND_CEIL); } - void ROUNDZEROPS(X64Reg dest, const OpArg& arg) { ROUNDPS(dest, arg, FROUND_ZERO); } + void ROUNDNEARPS(X64Reg dest, const OpArg& arg) { + ROUNDPS(dest, arg, FROUND_NEAREST); + } + void ROUNDFLOORPS(X64Reg dest, const OpArg& arg) { + ROUNDPS(dest, arg, FROUND_FLOOR); + } + void ROUNDCEILPS(X64Reg dest, const OpArg& arg) { + ROUNDPS(dest, arg, FROUND_CEIL); + } + void ROUNDZEROPS(X64Reg dest, const OpArg& arg) { + ROUNDPS(dest, arg, FROUND_ZERO); + } - void ROUNDNEARPD(X64Reg dest, const OpArg& arg) { ROUNDPD(dest, arg, FROUND_NEAREST); } - void ROUNDFLOORPD(X64Reg dest, const OpArg& arg) { ROUNDPD(dest, arg, FROUND_FLOOR); } - void ROUNDCEILPD(X64Reg dest, const OpArg& arg) { ROUNDPD(dest, arg, FROUND_CEIL); } - void ROUNDZEROPD(X64Reg dest, const OpArg& arg) { ROUNDPD(dest, arg, FROUND_ZERO); } + void ROUNDNEARPD(X64Reg dest, const OpArg& arg) { + ROUNDPD(dest, arg, FROUND_NEAREST); + } + void ROUNDFLOORPD(X64Reg dest, const OpArg& arg) { + ROUNDPD(dest, arg, FROUND_FLOOR); + } + void ROUNDCEILPD(X64Reg dest, const OpArg& arg) { + ROUNDPD(dest, arg, FROUND_CEIL); + } + void ROUNDZEROPD(X64Reg dest, const OpArg& arg) { + ROUNDPD(dest, arg, FROUND_ZERO); + } // AVX void VADDSD(X64Reg regOp1, X64Reg regOp2, const OpArg& arg); @@ -981,7 +1134,6 @@ public: void ABI_CallFunctionC16(const void* func, u16 param1); void ABI_CallFunctionCC16(const void* func, u32 param1, u16 param2); - // These only support u32 parameters, but that's enough for a lot of uses. // These will destroy the 1 or 2 first "parameter regs". void ABI_CallFunctionC(const void* func, u32 param1); @@ -1012,29 +1164,38 @@ public: * * @param mask Registers to push on the stack (high 16 bits are XMMs, low 16 bits are GPRs) * @param rsp_alignment Current alignment of the stack pointer, must be 0 or 8 - * @param needed_frame_size Additional space needed, e.g., for function arguments passed on the stack + * @param needed_frame_size Additional space needed, e.g., for function arguments passed on the + * stack * @return Size of the shadow space, i.e., offset of the frame */ - size_t ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0); + size_t ABI_PushRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, + size_t needed_frame_size = 0); /** - * Restores specified registers and adjusts the stack to its original alignment, i.e., the alignment before + * Restores specified registers and adjusts the stack to its original alignment, i.e., the + * alignment before * the matching PushRegistersAndAdjustStack. * - * @param mask Registers to restores from the stack (high 16 bits are XMMs, low 16 bits are GPRs) - * @param rsp_alignment Original alignment before the matching PushRegistersAndAdjustStack, must be 0 or 8 + * @param mask Registers to restores from the stack (high 16 bits are XMMs, low 16 bits are + * GPRs) + * @param rsp_alignment Original alignment before the matching PushRegistersAndAdjustStack, must + * be 0 or 8 * @param needed_frame_size Additional space that was needed * @warning Stack must be currently 16-byte aligned */ - void ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, size_t needed_frame_size = 0); - - #ifdef _M_IX86 - static int ABI_GetNumXMMRegs() { return 8; } - #else - static int ABI_GetNumXMMRegs() { return 16; } - #endif -}; // class XEmitter + void ABI_PopRegistersAndAdjustStack(BitSet32 mask, size_t rsp_alignment, + size_t needed_frame_size = 0); +#ifdef _M_IX86 + static int ABI_GetNumXMMRegs() { + return 8; + } +#else + static int ABI_GetNumXMMRegs() { + return 16; + } +#endif +}; // class XEmitter // Everything that needs to generate X86 code should inherit from this. // You get memory management for free, plus, you can use all the MOV etc functions without @@ -1045,4 +1206,4 @@ public: void PoisonMemory() override; }; -} // namespace +} // namespace -- cgit v1.2.3 From 396a8d91a4423d9c793eeff0798d544613647511 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 18 Sep 2016 18:01:46 -0700 Subject: Manually tweak source formatting and then re-run clang-format --- src/audio_core/codec.cpp | 2 +- src/audio_core/hle/dsp.cpp | 3 +- src/audio_core/hle/dsp.h | 72 ++++++---- src/audio_core/hle/filter.cpp | 2 + src/audio_core/hle/mixers.cpp | 5 +- src/audio_core/hle/pipe.cpp | 10 +- src/audio_core/hle/pipe.h | 14 +- src/audio_core/hle/source.cpp | 44 +++--- src/audio_core/interpolate.cpp | 20 +-- src/audio_core/interpolate.h | 4 +- src/audio_core/null_sink.h | 3 +- src/audio_core/sink.h | 4 +- src/audio_core/sink_details.h | 3 +- src/citra/citra.cpp | 10 +- src/citra/emu_window/emu_window_sdl2.cpp | 1 + src/citra/emu_window/emu_window_sdl2.h | 4 +- src/citra_qt/bootmanager.cpp | 11 +- src/citra_qt/bootmanager.h | 4 +- src/citra_qt/configure_audio.cpp | 3 +- src/citra_qt/configure_debug.cpp | 3 +- src/citra_qt/configure_dialog.cpp | 8 +- src/citra_qt/configure_general.cpp | 4 +- src/citra_qt/configure_graphics.cpp | 4 +- src/citra_qt/configure_input.cpp | 49 +++---- src/citra_qt/configure_system.cpp | 15 +- src/citra_qt/debugger/callstack.cpp | 3 +- src/citra_qt/debugger/disassembler.cpp | 6 +- src/citra_qt/debugger/graphics_breakpoints.cpp | 6 +- src/citra_qt/debugger/graphics_cmdlists.cpp | 3 +- src/citra_qt/debugger/graphics_surface.cpp | 11 +- src/citra_qt/debugger/graphics_vertex_shader.cpp | 3 +- src/citra_qt/debugger/ramview.cpp | 3 +- src/citra_qt/debugger/registers.cpp | 3 +- src/citra_qt/game_list_p.h | 18 +-- src/citra_qt/hotkeys.cpp | 3 +- src/citra_qt/main.h | 4 +- src/common/bit_set.h | 18 +-- src/common/chunk_file.h | 9 +- src/common/code_block.h | 3 +- src/common/common_funcs.h | 3 +- src/common/emu_window.h | 7 +- src/common/file_util.cpp | 3 +- src/common/math_util.h | 6 +- src/common/profiler.cpp | 3 +- src/common/scope_exit.h | 3 +- src/common/swap.h | 3 +- src/common/synchronized_wrapper.h | 3 +- src/common/thread.h | 6 +- src/common/vector_math.h | 18 +-- src/common/x64/emitter.cpp | 2 +- src/common/x64/emitter.h | 6 +- src/core/arm/arm_interface.h | 3 +- src/core/arm/dyncom/arm_dyncom.cpp | 3 +- src/core/arm/dyncom/arm_dyncom_trans.cpp | 3 +- src/core/arm/skyeye_common/armstate.h | 6 +- src/core/arm/skyeye_common/vfp/vfpdouble.cpp | 2 +- src/core/arm/skyeye_common/vfp/vfpsingle.cpp | 14 +- src/core/core.cpp | 3 +- src/core/core_timing.cpp | 6 +- src/core/file_sys/archive_backend.h | 36 +++-- src/core/file_sys/archive_savedata.cpp | 7 +- src/core/file_sys/archive_savedatacheck.cpp | 3 +- src/core/file_sys/archive_systemsavedata.cpp | 3 +- src/core/file_sys/directory_backend.h | 6 +- src/core/file_sys/disk_archive.h | 3 +- src/core/file_sys/file_backend.h | 6 +- src/core/file_sys/ivfc_archive.h | 9 +- src/core/hle/applets/applet.h | 6 +- src/core/hle/applets/erreula.cpp | 3 +- src/core/hle/applets/erreula.h | 3 +- src/core/hle/applets/mii_selector.cpp | 3 +- src/core/hle/applets/mii_selector.h | 3 +- src/core/hle/applets/swkbd.h | 3 +- src/core/hle/kernel/address_arbiter.cpp | 6 +- src/core/hle/kernel/client_port.cpp | 6 +- src/core/hle/kernel/event.cpp | 6 +- src/core/hle/kernel/kernel.h | 3 +- src/core/hle/kernel/mutex.cpp | 6 +- src/core/hle/kernel/process.cpp | 12 +- src/core/hle/kernel/resource_limit.cpp | 9 +- src/core/hle/kernel/resource_limit.h | 4 +- src/core/hle/kernel/semaphore.cpp | 6 +- src/core/hle/kernel/server_port.cpp | 11 +- src/core/hle/kernel/server_port.h | 4 +- src/core/hle/kernel/session.cpp | 6 +- src/core/hle/kernel/shared_memory.cpp | 6 +- src/core/hle/kernel/thread.cpp | 6 +- src/core/hle/kernel/timer.cpp | 9 +- src/core/hle/result.h | 3 +- src/core/hle/service/am/am.cpp | 3 +- src/core/hle/service/am/am_app.cpp | 2 +- src/core/hle/service/am/am_net.cpp | 2 +- src/core/hle/service/am/am_sys.cpp | 46 +++--- src/core/hle/service/am/am_u.cpp | 72 +++++----- src/core/hle/service/apt/apt.cpp | 6 +- src/core/hle/service/apt/apt.h | 14 +- src/core/hle/service/apt/apt_a.cpp | 5 +- src/core/hle/service/apt/apt_s.cpp | 5 +- src/core/hle/service/apt/apt_u.cpp | 5 +- src/core/hle/service/boss/boss.cpp | 3 +- src/core/hle/service/cam/cam.h | 54 ++++++-- src/core/hle/service/cam/cam_u.cpp | 2 +- src/core/hle/service/cecd/cecd_u.cpp | 2 +- src/core/hle/service/cfg/cfg.cpp | 13 +- src/core/hle/service/cfg/cfg.h | 15 +- src/core/hle/service/cfg/cfg_i.cpp | 2 +- src/core/hle/service/cfg/cfg_s.cpp | 2 +- src/core/hle/service/cfg/cfg_u.cpp | 2 +- src/core/hle/service/dlp/dlp.cpp | 3 +- src/core/hle/service/err_f.cpp | 4 +- src/core/hle/service/frd/frd.cpp | 3 +- src/core/hle/service/frd/frd_u.cpp | 2 +- src/core/hle/service/fs/archive.cpp | 12 +- src/core/hle/service/fs/fs_user.cpp | 3 +- src/core/hle/service/gsp_gpu.cpp | 7 +- src/core/hle/service/gsp_lcd.cpp | 14 +- src/core/hle/service/hid/hid.cpp | 9 +- src/core/hle/service/hid/hid_spvr.cpp | 2 +- src/core/hle/service/hid/hid_user.cpp | 2 +- src/core/hle/service/ir/ir_rst.cpp | 2 +- src/core/hle/service/ir/ir_u.cpp | 29 ++-- src/core/hle/service/ir/ir_user.cpp | 2 +- src/core/hle/service/ldr_ro/cro_helper.cpp | 47 ++++--- src/core/hle/service/ldr_ro/cro_helper.h | 9 +- src/core/hle/service/ldr_ro/ldr_ro.cpp | 14 +- src/core/hle/service/ndm/ndm.cpp | 13 +- src/core/hle/service/ndm/ndm.h | 9 +- src/core/hle/service/ndm/ndm_u.cpp | 2 +- src/core/hle/service/news/news.cpp | 3 +- src/core/hle/service/news/news_s.cpp | 2 +- src/core/hle/service/nim/nim.cpp | 3 +- src/core/hle/service/nim/nim_u.cpp | 2 +- src/core/hle/service/ptm/ptm.cpp | 3 +- src/core/hle/service/ptm/ptm_sysm.cpp | 2 +- src/core/hle/service/ptm/ptm_u.cpp | 2 +- src/core/hle/service/soc_u.cpp | 154 +++++++++++---------- src/core/hle/service/ssl_c.cpp | 3 +- src/core/hle/service/y2r_u.cpp | 4 +- src/core/hw/hw.cpp | 3 +- src/core/hw/y2r.cpp | 32 +++-- src/core/loader/3dsx.h | 3 +- src/core/loader/elf.h | 3 +- src/core/loader/loader.h | 6 +- src/core/loader/ncch.h | 3 +- src/core/tracer/citrace.h | 7 +- src/core/tracer/recorder.cpp | 3 +- src/video_core/clipper.cpp | 3 +- src/video_core/command_processor.cpp | 3 +- src/video_core/debug_utils/debug_utils.cpp | 37 ++--- src/video_core/debug_utils/debug_utils.h | 6 +- src/video_core/gpu_debugger.h | 3 +- src/video_core/pica.h | 25 +++- src/video_core/primitive_assembly.cpp | 3 +- src/video_core/rasterizer.cpp | 42 +++--- src/video_core/rasterizer_interface.h | 3 +- src/video_core/renderer_base.h | 3 +- src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 +- src/video_core/renderer_opengl/gl_rasterizer.h | 9 +- .../renderer_opengl/gl_rasterizer_cache.cpp | 4 +- .../renderer_opengl/gl_rasterizer_cache.h | 4 +- src/video_core/renderer_opengl/gl_shader_gen.cpp | 4 +- src/video_core/renderer_opengl/pica_to_gl.h | 16 ++- src/video_core/renderer_opengl/renderer_opengl.cpp | 32 ++--- src/video_core/renderer_opengl/renderer_opengl.h | 7 +- src/video_core/shader/shader.cpp | 4 +- src/video_core/shader/shader.h | 3 +- src/video_core/shader/shader_interpreter.cpp | 5 +- src/video_core/shader/shader_jit_x64.cpp | 3 +- src/video_core/swrasterizer.h | 15 +- 169 files changed, 808 insertions(+), 812 deletions(-) (limited to 'src/common') diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index c7efae753..4edfe9be0 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp @@ -23,7 +23,7 @@ StereoBuffer16 DecodeADPCM(const u8* const data, const size_t sample_count, constexpr size_t FRAME_LEN = 8; constexpr size_t SAMPLES_PER_FRAME = 14; - constexpr std::array SIGNED_NIBBLES{ + constexpr std::array SIGNED_NIBBLES = { {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}}; const size_t ret_size = diff --git a/src/audio_core/hle/dsp.cpp b/src/audio_core/hle/dsp.cpp index 5c8afa111..aaa3a280f 100644 --- a/src/audio_core/hle/dsp.cpp +++ b/src/audio_core/hle/dsp.cpp @@ -49,7 +49,8 @@ static SharedMemory& WriteRegion() { static std::array sources = { Source(0), Source(1), Source(2), Source(3), Source(4), Source(5), Source(6), Source(7), Source(8), Source(9), Source(10), Source(11), Source(12), Source(13), Source(14), Source(15), - Source(16), Source(17), Source(18), Source(19), Source(20), Source(21), Source(22), Source(23)}; + Source(16), Source(17), Source(18), Source(19), Source(20), Source(21), Source(22), Source(23), +}; static Mixers mixers; static StereoFrame16 GenerateCurrentFrame() { diff --git a/src/audio_core/hle/dsp.h b/src/audio_core/hle/dsp.h index 5b216eb87..f4c4b01e2 100644 --- a/src/audio_core/hle/dsp.h +++ b/src/audio_core/hle/dsp.h @@ -23,16 +23,15 @@ class Sink; namespace DSP { namespace HLE { -// The application-accessible region of DSP memory consists of two parts. -// Both are marked as IO and have Read/Write permissions. +// The application-accessible region of DSP memory consists of two parts. Both are marked as IO and +// have Read/Write permissions. // // First Region: 0x1FF50000 (Size: 0x8000) // Second Region: 0x1FF70000 (Size: 0x8000) // // The DSP reads from each region alternately based on the frame counter for each region much like a // double-buffer. The frame counter is located as the very last u16 of each region and is -// incremented -// each audio tick. +// incremented each audio tick. constexpr VAddr region0_base = 0x1FF50000; constexpr VAddr region1_base = 0x1FF70000; @@ -92,14 +91,12 @@ static_assert(std::is_trivially_copyable::value, "u32_dsp isn't trivial // See also: DSP::HLE::PipeRead. // // Note that the above addresses do vary slightly between audio firmwares observed; the addresses -// are -// not fixed in stone. The addresses above are only an examplar; they're what this implementation -// does and provides to applications. +// are not fixed in stone. The addresses above are only an examplar; they're what this +// implementation does and provides to applications. // // Application requests the DSP service to convert DSP addresses into ARM11 virtual addresses using -// the -// ConvertProcessAddressFromDspDram service call. Applications seem to derive the addresses for the -// second region via: +// the ConvertProcessAddressFromDspDram service call. Applications seem to derive the addresses for +// the second region via: // second_region_dsp_addr = first_region_dsp_addr | 0x10000 // // Applications maintain most of its own audio state, the memory region is used mainly for @@ -107,7 +104,7 @@ static_assert(std::is_trivially_copyable::value, "u32_dsp isn't trivial // // In the documentation below, filter and effect transfer functions are specified in the z domain. // (If you are more familiar with the Laplace transform, z = exp(sT). The z domain is the digital -// frequency domain, just like how the s domain is the analog frequency domain.) +// frequency domain, just like how the s domain is the analog frequency domain.) #define INSERT_PADDING_DSPWORDS(num_words) INSERT_PADDING_BYTES(2 * (num_words)) @@ -137,8 +134,8 @@ struct SourceConfiguration { BitField<0, 1, u32_le> format_dirty; BitField<1, 1, u32_le> mono_or_stereo_dirty; BitField<2, 1, u32_le> adpcm_coefficients_dirty; - BitField<3, 1, u32_le> - partial_embedded_buffer_dirty; ///< Tends to be set when a looped buffer is queued. + /// Tends to be set when a looped buffer is queued. + BitField<3, 1, u32_le> partial_embedded_buffer_dirty; BitField<4, 1, u32_le> partial_reset_flag; BitField<16, 1, u32_le> enable_dirty; @@ -146,8 +143,8 @@ struct SourceConfiguration { BitField<18, 1, u32_le> rate_multiplier_dirty; BitField<19, 1, u32_le> buffer_queue_dirty; BitField<20, 1, u32_le> loop_related_dirty; - BitField<21, 1, u32_le> - play_position_dirty; ///< Tends to also be set when embedded buffer is updated. + /// Tends to also be set when embedded buffer is updated. + BitField<21, 1, u32_le> play_position_dirty; BitField<22, 1, u32_le> filters_enabled_dirty; BitField<23, 1, u32_le> simple_filter_dirty; BitField<24, 1, u32_le> biquad_filter_dirty; @@ -162,9 +159,9 @@ struct SourceConfiguration { // Gain control /** - * Gain is between 0.0-1.0. This determines how much will this source appear on - * each of the 12 channels that feed into the intermediate mixers. - * Each of the three intermediate mixers is fed two left and two right channels. + * Gain is between 0.0-1.0. This determines how much will this source appear on each of the + * 12 channels that feed into the intermediate mixers. Each of the three intermediate mixers + * is fed two left and two right channels. */ float_le gain[3][4]; @@ -173,7 +170,11 @@ struct SourceConfiguration { /// Multiplier for sample rate. Resampling occurs with the selected interpolation method. float_le rate_multiplier; - enum class InterpolationMode : u8 { Polyphase = 0, Linear = 1, None = 2 }; + enum class InterpolationMode : u8 { + Polyphase = 0, + Linear = 1, + None = 2, + }; InterpolationMode interpolation_mode; INSERT_PADDING_BYTES(1); ///< Interpolation related @@ -197,8 +198,7 @@ struct SourceConfiguration { * The transfer function of this filter is: * H(z) = (b0 + b1 z^-1 + b2 z^-2) / (1 - a1 z^-1 - a2 z^-2) * Nintendo chose to negate the feedbackward coefficients. This differs from standard - * notation - * as in: https://ccrma.stanford.edu/~jos/filters/Direct_Form_I.html + * notation as in: https://ccrma.stanford.edu/~jos/filters/Direct_Form_I.html * Values are signed fixed point with 14 fractional bits. */ struct BiquadFilter { @@ -246,8 +246,8 @@ struct SourceConfiguration { u8 is_looping; /// This value is shown in SourceStatus::previous_buffer_id when this buffer has - /// finished. - /// This allows the emulated application to tell what buffer is currently playing + /// finished. This allows the emulated application to tell what buffer is currently + /// playing. u16_le buffer_id; INSERT_PADDING_DSPWORDS(1); @@ -275,9 +275,16 @@ struct SourceConfiguration { /// Note a sample takes up different number of bytes in different buffer formats. u32_dsp length; - enum class MonoOrStereo : u16_le { Mono = 1, Stereo = 2 }; + enum class MonoOrStereo : u16_le { + Mono = 1, + Stereo = 2, + }; - enum class Format : u16_le { PCM8 = 0, PCM16 = 1, ADPCM = 2 }; + enum class Format : u16_le { + PCM8 = 0, + PCM16 = 1, + ADPCM = 2, + }; union { u16_le flags1_raw; @@ -349,12 +356,16 @@ struct DspConfiguration { }; /// The DSP has three intermediate audio mixers. This controls the volume level (0.0-1.0) for - /// each at the final mixer + /// each at the final mixer. float_le volume[3]; INSERT_PADDING_DSPWORDS(3); - enum class OutputFormat : u16_le { Mono = 0, Stereo = 1, Surround = 2 }; + enum class OutputFormat : u16_le { + Mono = 0, + Stereo = 1, + Surround = 2, + }; OutputFormat output_format; @@ -386,9 +397,10 @@ struct DspConfiguration { u16_le enable; INSERT_PADDING_DSPWORDS(1); u16_le outputs; - u32_dsp work_buffer_address; ///< The application allocates a block of memory for the DSP to - /// use as a work buffer. - u16_le frame_count; ///< Frames to delay by + /// The application allocates a block of memory for the DSP to use as a work buffer. + u32_dsp work_buffer_address; + /// Frames to delay by + u16_le frame_count; // Coefficients s16_le g; ///< Fixed point with 7 fractional bits diff --git a/src/audio_core/hle/filter.cpp b/src/audio_core/hle/filter.cpp index ab8814e59..da2a4684e 100644 --- a/src/audio_core/hle/filter.cpp +++ b/src/audio_core/hle/filter.cpp @@ -61,6 +61,7 @@ void SourceFilters::SimpleFilter::Reset() { void SourceFilters::SimpleFilter::Configure( SourceConfiguration::Configuration::SimpleFilter config) { + a1 = config.a1; b0 = config.b0; } @@ -91,6 +92,7 @@ void SourceFilters::BiquadFilter::Reset() { void SourceFilters::BiquadFilter::Configure( SourceConfiguration::Configuration::BiquadFilter config) { + a1 = config.a1; a2 = config.a2; b0 = config.b0; diff --git a/src/audio_core/hle/mixers.cpp b/src/audio_core/hle/mixers.cpp index a661a7b27..126f328bc 100644 --- a/src/audio_core/hle/mixers.cpp +++ b/src/audio_core/hle/mixers.cpp @@ -77,9 +77,8 @@ void Mixers::ParseConfig(DspConfiguration& config) { if (config.headphones_connected_dirty) { config.headphones_connected_dirty.Assign(0); - // Do nothing. - // (Note: Whether headphones are connected does affect coefficients used for surround - // sound.) + // Do nothing. (Note: Whether headphones are connected does affect coefficients used for + // surround sound.) LOG_TRACE(Audio_DSP, "mixers headphones_connected=%hu", config.headphones_connected); } diff --git a/src/audio_core/hle/pipe.cpp b/src/audio_core/hle/pipe.cpp index fe67d2503..f2b6d6552 100644 --- a/src/audio_core/hle/pipe.cpp +++ b/src/audio_core/hle/pipe.cpp @@ -97,7 +97,8 @@ static void AudioPipeWriteStructAddresses() { 0x8000 + offsetof(SharedMemory, unknown11) / 2, 0x8000 + offsetof(SharedMemory, unknown12) / 2, 0x8000 + offsetof(SharedMemory, unknown13) / 2, - 0x8000 + offsetof(SharedMemory, unknown14) / 2}; + 0x8000 + offsetof(SharedMemory, unknown14) / 2, + }; // Begin with a u16 denoting the number of structs. WriteU16(DspPipe::Audio, static_cast(struct_addresses.size())); @@ -118,7 +119,12 @@ void PipeWrite(DspPipe pipe_number, const std::vector& buffer) { return; } - enum class StateChange { Initalize = 0, Shutdown = 1, Wakeup = 2, Sleep = 3 }; + enum class StateChange { + Initalize = 0, + Shutdown = 1, + Wakeup = 2, + Sleep = 3, + }; // The difference between Initialize and Wakeup is that Input state is maintained // when sleeping but isn't when turning it off and on again. (TODO: Implement this.) diff --git a/src/audio_core/hle/pipe.h b/src/audio_core/hle/pipe.h index 73b857a90..6d7fd92ab 100644 --- a/src/audio_core/hle/pipe.h +++ b/src/audio_core/hle/pipe.h @@ -15,7 +15,12 @@ namespace HLE { /// Reset the pipes by setting pipe positions back to the beginning. void ResetPipes(); -enum class DspPipe { Debug = 0, Dma = 1, Audio = 2, Binary = 3 }; +enum class DspPipe { + Debug = 0, + Dma = 1, + Audio = 2, + Binary = 3, +}; constexpr size_t NUM_DSP_PIPE = 8; /** @@ -46,7 +51,12 @@ size_t GetPipeReadableSize(DspPipe pipe_number); */ void PipeWrite(DspPipe pipe_number, const std::vector& buffer); -enum class DspState { Off, On, Sleeping }; +enum class DspState { + Off, + On, + Sleeping, +}; + /// Get the state of the DSP DspState GetDspState(); diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index fad0ce2ad..249acc449 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -163,16 +163,18 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, if (config.embedded_buffer_dirty) { config.embedded_buffer_dirty.Assign(0); - state.input_queue.emplace(Buffer{config.physical_address, - config.length, - static_cast(config.adpcm_ps), - {config.adpcm_yn[0], config.adpcm_yn[1]}, - config.adpcm_dirty.ToBool(), - config.is_looping.ToBool(), - config.buffer_id, - state.mono_or_stereo, - state.format, - false}); + state.input_queue.emplace(Buffer{ + config.physical_address, + config.length, + static_cast(config.adpcm_ps), + {config.adpcm_yn[0], config.adpcm_yn[1]}, + config.adpcm_dirty.ToBool(), + config.is_looping.ToBool(), + config.buffer_id, + state.mono_or_stereo, + state.format, + false, + }); LOG_TRACE(Audio_DSP, "enqueuing embedded addr=0x%08x len=%u id=%hu", config.physical_address, config.length, config.buffer_id); } @@ -182,16 +184,18 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, for (size_t i = 0; i < 4; i++) { if (config.buffers_dirty & (1 << i)) { const auto& b = config.buffers[i]; - state.input_queue.emplace(Buffer{b.physical_address, - b.length, - static_cast(b.adpcm_ps), - {b.adpcm_yn[0], b.adpcm_yn[1]}, - b.adpcm_dirty != 0, - b.is_looping != 0, - b.buffer_id, - state.mono_or_stereo, - state.format, - true}); + state.input_queue.emplace(Buffer{ + b.physical_address, + b.length, + static_cast(b.adpcm_ps), + {b.adpcm_yn[0], b.adpcm_yn[1]}, + b.adpcm_dirty != 0, + b.is_looping != 0, + b.buffer_id, + state.mono_or_stereo, + state.format, + true, + }); LOG_TRACE(Audio_DSP, "enqueuing queued %zu addr=0x%08x len=%u id=%hu", i, b.physical_address, b.length, b.buffer_id); } diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp index 7751c545d..cb1c58a67 100644 --- a/src/audio_core/interpolate.cpp +++ b/src/audio_core/interpolate.cpp @@ -71,15 +71,17 @@ StereoBuffer16 None(State& state, const StereoBuffer16& input, float rate_multip StereoBuffer16 Linear(State& state, const StereoBuffer16& input, float rate_multiplier) { // Note on accuracy: Some values that this produces are +/- 1 from the actual firmware. - return StepOverSamples(state, input, rate_multiplier, [](u64 fraction, const auto& x0, - const auto& x1, const auto& x2) { - // This is a saturated subtraction. (Verified by black-box fuzzing.) - s64 delta0 = MathUtil::Clamp(x1[0] - x0[0], -32768, 32767); - s64 delta1 = MathUtil::Clamp(x1[1] - x0[1], -32768, 32767); - - return std::array{static_cast(x0[0] + fraction * delta0 / scale_factor), - static_cast(x0[1] + fraction * delta1 / scale_factor)}; - }); + return StepOverSamples(state, input, rate_multiplier, + [](u64 fraction, const auto& x0, const auto& x1, const auto& x2) { + // This is a saturated subtraction. (Verified by black-box fuzzing.) + s64 delta0 = MathUtil::Clamp(x1[0] - x0[0], -32768, 32767); + s64 delta1 = MathUtil::Clamp(x1[1] - x0[1], -32768, 32767); + + return std::array{ + static_cast(x0[0] + fraction * delta0 / scale_factor), + static_cast(x0[1] + fraction * delta1 / scale_factor), + }; + }); } } // namespace AudioInterp diff --git a/src/audio_core/interpolate.h b/src/audio_core/interpolate.h index 99e5b9657..2d2e60311 100644 --- a/src/audio_core/interpolate.h +++ b/src/audio_core/interpolate.h @@ -25,7 +25,7 @@ struct State { * @param input Input buffer. * @param rate_multiplier Stretch factor. Must be a positive non-zero value. * rate_multiplier > 1.0 performs decimation and rate_multipler < 1.0 - * performs upsampling. + * performs upsampling. * @return The resampled audio buffer. */ StereoBuffer16 None(State& state, const StereoBuffer16& input, float rate_multiplier); @@ -35,7 +35,7 @@ StereoBuffer16 None(State& state, const StereoBuffer16& input, float rate_multip * @param input Input buffer. * @param rate_multiplier Stretch factor. Must be a positive non-zero value. * rate_multiplier > 1.0 performs decimation and rate_multipler < 1.0 - * performs upsampling. + * performs upsampling. * @return The resampled audio buffer. */ StereoBuffer16 Linear(State& state, const StereoBuffer16& input, float rate_multiplier); diff --git a/src/audio_core/null_sink.h b/src/audio_core/null_sink.h index b82cd3b9a..9931c4778 100644 --- a/src/audio_core/null_sink.h +++ b/src/audio_core/null_sink.h @@ -19,8 +19,7 @@ public: return native_sample_rate; } - void EnqueueSamples(const s16*, size_t) override { - } + void EnqueueSamples(const s16*, size_t) override {} size_t SamplesInQueue() const override { return 0; diff --git a/src/audio_core/sink.h b/src/audio_core/sink.h index c938e87d2..f5ce55a6b 100644 --- a/src/audio_core/sink.h +++ b/src/audio_core/sink.h @@ -12,8 +12,8 @@ namespace AudioCore { /** * This class is an interface for an audio sink. An audio sink accepts samples in stereo signed - * PCM16 format to be output. - * Sinks *do not* handle resampling and expect the correct sample rate. They are dumb outputs. + * PCM16 format to be output. Sinks *do not* handle resampling and expect the correct sample rate. + * They are dumb outputs. */ class Sink { public: diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h index 34110c97a..4b30cf835 100644 --- a/src/audio_core/sink_details.h +++ b/src/audio_core/sink_details.h @@ -14,8 +14,7 @@ class Sink; struct SinkDetails { SinkDetails(const char* id_, std::function()> factory_) - : id(id_), factory(factory_) { - } + : id(id_), factory(factory_) {} /// Name for this sink. const char* id; diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 7b387e258..1b8f8cffe 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -69,10 +69,12 @@ int main(int argc, char** argv) { #endif std::string boot_filename; - static struct option long_options[] = {{"gdbport", required_argument, 0, 'g'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {0, 0, 0, 0}}; + static struct option long_options[] = { + {"gdbport", required_argument, 0, 'g'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'v'}, + {0, 0, 0, 0}, + }; while (optind < argc) { char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index); diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index 12f3e2c71..42f2a7553 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp @@ -181,5 +181,6 @@ void EmuWindow_SDL2::ReloadSetKeymaps() { void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest( const std::pair& minimal_size) { + SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); } diff --git a/src/citra/emu_window/emu_window_sdl2.h b/src/citra/emu_window/emu_window_sdl2.h index 693dfb14b..d4d86821d 100644 --- a/src/citra/emu_window/emu_window_sdl2.h +++ b/src/citra/emu_window/emu_window_sdl2.h @@ -47,8 +47,8 @@ private: void OnResize(); /// Called when a configuration change affects the minimal size of the window - void - OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) override; + void OnMinimalClientAreaChangeRequest( + const std::pair& minimal_size) override; /// Is the window still open? bool is_open = true; diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 01cc6b9ca..53d035b32 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -28,8 +28,7 @@ #define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" EmuThread::EmuThread(GRenderWindow* render_window) - : exec_step(false), running(false), stop_run(false), render_window(render_window) { -} + : exec_step(false), running(false), stop_run(false), render_window(render_window) {} void EmuThread::run() { render_window->MakeCurrent(); @@ -84,8 +83,7 @@ void EmuThread::run() { class GGLWidgetInternal : public QGLWidget { public: GGLWidgetInternal(QGLFormat fmt, GRenderWindow* parent) - : QGLWidget(fmt, parent), parent(parent) { - } + : QGLWidget(fmt, parent), parent(parent) {} void paintEvent(QPaintEvent* ev) override { if (do_painting) { @@ -153,8 +151,7 @@ void GRenderWindow::DoneCurrent() { child->doneCurrent(); } -void GRenderWindow::PollEvents() { -} +void GRenderWindow::PollEvents() {} // On Qt 5.0+, this correctly gets the size of the framebuffer (pixels). // @@ -306,8 +303,8 @@ void GRenderWindow::OnEmulationStopping() { void GRenderWindow::showEvent(QShowEvent* event) { QWidget::showEvent(event); -// windowHandle() is not initialized until the Window is shown, so we connect it here. #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + // windowHandle() is not initialized until the Window is shown, so we connect it here. connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection); #endif diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index e0e4341df..59241684d 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -144,8 +144,8 @@ signals: void Closed(); private: - void - OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) override; + void OnMinimalClientAreaChangeRequest( + const std::pair& minimal_size) override; GGLWidgetInternal* child; diff --git a/src/citra_qt/configure_audio.cpp b/src/citra_qt/configure_audio.cpp index 29900536c..944047d05 100644 --- a/src/citra_qt/configure_audio.cpp +++ b/src/citra_qt/configure_audio.cpp @@ -22,8 +22,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) this->setConfiguration(); } -ConfigureAudio::~ConfigureAudio() { -} +ConfigureAudio::~ConfigureAudio() {} void ConfigureAudio::setConfiguration() { int new_sink_index = 0; diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configure_debug.cpp index b6b44723c..dde8d670e 100644 --- a/src/citra_qt/configure_debug.cpp +++ b/src/citra_qt/configure_debug.cpp @@ -12,8 +12,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co this->setConfiguration(); } -ConfigureDebug::~ConfigureDebug() { -} +ConfigureDebug::~ConfigureDebug() {} void ConfigureDebug::setConfiguration() { ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp index 837934c81..c33c95540 100644 --- a/src/citra_qt/configure_dialog.cpp +++ b/src/citra_qt/configure_dialog.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/config.h" #include "citra_qt/configure_dialog.h" +#include "citra_qt/config.h" #include "ui_configure.h" #include "core/settings.h" @@ -13,11 +13,9 @@ ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui:: this->setConfiguration(); } -ConfigureDialog::~ConfigureDialog() { -} +ConfigureDialog::~ConfigureDialog() {} -void ConfigureDialog::setConfiguration() { -} +void ConfigureDialog::setConfiguration() {} void ConfigureDialog::applyConfiguration() { ui->generalTab->applyConfiguration(); diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 7bfba6dd0..3e6f76bfe 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp @@ -11,14 +11,14 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureGeneral) { + ui->setupUi(this); this->setConfiguration(); ui->toggle_cpu_jit->setEnabled(!System::IsPoweredOn()); } -ConfigureGeneral::~ConfigureGeneral() { -} +ConfigureGeneral::~ConfigureGeneral() {} void ConfigureGeneral::setConfiguration() { ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan); diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp index adc9cb5ef..bde6727cc 100644 --- a/src/citra_qt/configure_graphics.cpp +++ b/src/citra_qt/configure_graphics.cpp @@ -10,14 +10,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureGraphics) { + ui->setupUi(this); this->setConfiguration(); ui->toggle_vsync->setEnabled(!System::IsPoweredOn()); } -ConfigureGraphics::~ConfigureGraphics() { -} +ConfigureGraphics::~ConfigureGraphics() {} void ConfigureGraphics::setConfiguration() { ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configure_input.cpp index af473f841..7900134ca 100644 --- a/src/citra_qt/configure_input.cpp +++ b/src/citra_qt/configure_input.cpp @@ -10,34 +10,35 @@ ConfigureInput::ConfigureInput(QWidget* parent) : QWidget(parent), ui(std::make_unique()) { + ui->setupUi(this); // Initialize mapping of input enum to UI button. input_mapping = { - {std::make_pair(Settings::NativeInput::Values::A, ui->buttonA)}, - {std::make_pair(Settings::NativeInput::Values::B, ui->buttonB)}, - {std::make_pair(Settings::NativeInput::Values::X, ui->buttonX)}, - {std::make_pair(Settings::NativeInput::Values::Y, ui->buttonY)}, - {std::make_pair(Settings::NativeInput::Values::L, ui->buttonL)}, - {std::make_pair(Settings::NativeInput::Values::R, ui->buttonR)}, - {std::make_pair(Settings::NativeInput::Values::ZL, ui->buttonZL)}, - {std::make_pair(Settings::NativeInput::Values::ZR, ui->buttonZR)}, - {std::make_pair(Settings::NativeInput::Values::START, ui->buttonStart)}, - {std::make_pair(Settings::NativeInput::Values::SELECT, ui->buttonSelect)}, - {std::make_pair(Settings::NativeInput::Values::HOME, ui->buttonHome)}, - {std::make_pair(Settings::NativeInput::Values::DUP, ui->buttonDpadUp)}, - {std::make_pair(Settings::NativeInput::Values::DDOWN, ui->buttonDpadDown)}, - {std::make_pair(Settings::NativeInput::Values::DLEFT, ui->buttonDpadLeft)}, - {std::make_pair(Settings::NativeInput::Values::DRIGHT, ui->buttonDpadRight)}, - {std::make_pair(Settings::NativeInput::Values::CUP, ui->buttonCStickUp)}, - {std::make_pair(Settings::NativeInput::Values::CDOWN, ui->buttonCStickDown)}, - {std::make_pair(Settings::NativeInput::Values::CLEFT, ui->buttonCStickLeft)}, - {std::make_pair(Settings::NativeInput::Values::CRIGHT, ui->buttonCStickRight)}, - {std::make_pair(Settings::NativeInput::Values::CIRCLE_UP, ui->buttonCircleUp)}, - {std::make_pair(Settings::NativeInput::Values::CIRCLE_DOWN, ui->buttonCircleDown)}, - {std::make_pair(Settings::NativeInput::Values::CIRCLE_LEFT, ui->buttonCircleLeft)}, - {std::make_pair(Settings::NativeInput::Values::CIRCLE_RIGHT, ui->buttonCircleRight)}, - {std::make_pair(Settings::NativeInput::Values::CIRCLE_MODIFIER, ui->buttonCircleMod)}, + {Settings::NativeInput::Values::A, ui->buttonA}, + {Settings::NativeInput::Values::B, ui->buttonB}, + {Settings::NativeInput::Values::X, ui->buttonX}, + {Settings::NativeInput::Values::Y, ui->buttonY}, + {Settings::NativeInput::Values::L, ui->buttonL}, + {Settings::NativeInput::Values::R, ui->buttonR}, + {Settings::NativeInput::Values::ZL, ui->buttonZL}, + {Settings::NativeInput::Values::ZR, ui->buttonZR}, + {Settings::NativeInput::Values::START, ui->buttonStart}, + {Settings::NativeInput::Values::SELECT, ui->buttonSelect}, + {Settings::NativeInput::Values::HOME, ui->buttonHome}, + {Settings::NativeInput::Values::DUP, ui->buttonDpadUp}, + {Settings::NativeInput::Values::DDOWN, ui->buttonDpadDown}, + {Settings::NativeInput::Values::DLEFT, ui->buttonDpadLeft}, + {Settings::NativeInput::Values::DRIGHT, ui->buttonDpadRight}, + {Settings::NativeInput::Values::CUP, ui->buttonCStickUp}, + {Settings::NativeInput::Values::CDOWN, ui->buttonCStickDown}, + {Settings::NativeInput::Values::CLEFT, ui->buttonCStickLeft}, + {Settings::NativeInput::Values::CRIGHT, ui->buttonCStickRight}, + {Settings::NativeInput::Values::CIRCLE_UP, ui->buttonCircleUp}, + {Settings::NativeInput::Values::CIRCLE_DOWN, ui->buttonCircleDown}, + {Settings::NativeInput::Values::CIRCLE_LEFT, ui->buttonCircleLeft}, + {Settings::NativeInput::Values::CIRCLE_RIGHT, ui->buttonCircleRight}, + {Settings::NativeInput::Values::CIRCLE_MODIFIER, ui->buttonCircleMod}, }; // Attach handle click method to each button click. diff --git a/src/citra_qt/configure_system.cpp b/src/citra_qt/configure_system.cpp index d89b342df..732e15dda 100644 --- a/src/citra_qt/configure_system.cpp +++ b/src/citra_qt/configure_system.cpp @@ -10,7 +10,9 @@ #include "core/hle/service/fs/archive.h" #include "core/system.h" -static const std::array days_in_month = {{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; +static const std::array days_in_month = {{ + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, +}}; ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { ui->setupUi(this); @@ -20,8 +22,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui:: this->setConfiguration(); } -ConfigureSystem::~ConfigureSystem() { -} +ConfigureSystem::~ConfigureSystem() {} void ConfigureSystem::setConfiguration() { enabled = !System::IsPoweredOn(); @@ -51,8 +52,8 @@ void ConfigureSystem::setConfiguration() { void ConfigureSystem::ReadSystemSettings() { // set username username = Service::CFG::GetUsername(); - // ui->edit_username->setText(QString::fromStdU16String(username)); // TODO(wwylele): Use this - // when we move to Qt 5.5 + // TODO(wwylele): Use this when we move to Qt 5.5 + // ui->edit_username->setText(QString::fromStdU16String(username)); ui->edit_username->setText( QString::fromUtf16(reinterpret_cast(username.data()))); @@ -80,8 +81,8 @@ void ConfigureSystem::applyConfiguration() { bool modified = false; // apply username - // std::u16string new_username = ui->edit_username->text().toStdU16String(); // TODO(wwylele): - // Use this when we move to Qt 5.5 + // TODO(wwylele): Use this when we move to Qt 5.5 + // std::u16string new_username = ui->edit_username->text().toStdU16String(); std::u16string new_username( reinterpret_cast(ui->edit_username->text().utf16())); if (new_username != username) { diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp index a87046acb..db266b506 100644 --- a/src/citra_qt/debugger/callstack.cpp +++ b/src/citra_qt/debugger/callstack.cpp @@ -78,8 +78,7 @@ void CallstackWidget::OnDebugModeEntered() { } } -void CallstackWidget::OnDebugModeLeft() { -} +void CallstackWidget::OnDebugModeLeft() {} void CallstackWidget::Clear() { for (int row = 0; row < callstack_model->rowCount(); row++) { diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index b523fe9a7..803e8b172 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp @@ -19,8 +19,7 @@ DisassemblerModel::DisassemblerModel(QObject* parent) : QAbstractListModel(parent), base_address(0), code_size(0), program_counter(0), - selection(QModelIndex()) { -} + selection(QModelIndex()) {} int DisassemblerModel::columnCount(const QModelIndex& parent) const { return 3; @@ -241,8 +240,7 @@ void DisassemblerWidget::OnDebugModeEntered() { model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); } -void DisassemblerWidget::OnDebugModeLeft() { -} +void DisassemblerWidget::OnDebugModeLeft() {} int DisassemblerWidget::SelectedRow() { QModelIndex index = disasm_ui.treeView->selectionModel()->currentIndex(); diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index 953840e7f..b31eba533 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp @@ -16,8 +16,7 @@ BreakPointModel::BreakPointModel(std::shared_ptr debug_context, QObject* parent) : QAbstractListModel(parent), context_weak(debug_context), at_breakpoint(debug_context->at_breakpoint), - active_breakpoint(debug_context->active_breakpoint) { -} + active_breakpoint(debug_context->active_breakpoint) {} int BreakPointModel::columnCount(const QModelIndex& parent) const { return 1; @@ -42,7 +41,8 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const { {Pica::DebugContext::Event::IncomingDisplayTransfer, tr("Incoming display transfer")}, {Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed")}, - {Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped")}}; + {Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped")}, + }; DEBUG_ASSERT(map.size() == static_cast(Pica::DebugContext::Event::NumEvents)); return (map.find(event) != map.end()) ? map.at(event) : QString(); diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index daf1cf1de..b088ad29d 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp @@ -51,8 +51,7 @@ public: } }; -GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) { -} +GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {} int GPUCommandListModel::rowCount(const QModelIndex& parent) const { return static_cast(pica_trace.writes.size()); diff --git a/src/citra_qt/debugger/graphics_surface.cpp b/src/citra_qt/debugger/graphics_surface.cpp index 839fca124..bb998acc4 100644 --- a/src/citra_qt/debugger/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics_surface.cpp @@ -25,10 +25,8 @@ #include "video_core/utils.h" SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) - : QLabel(parent), surface_widget(surface_widget_) { -} -SurfacePicture::~SurfacePicture() { -} + : QLabel(parent), surface_widget(surface_widget_) {} +SurfacePicture::~SurfacePicture() {} void SurfacePicture::mousePressEvent(QMouseEvent* event) { // Only do something while the left mouse button is held down @@ -707,9 +705,8 @@ unsigned int GraphicsSurfaceWidget::NibblesPerPixel(GraphicsSurfaceWidget::Forma case Format::D16: return 2 * 2; default: - UNREACHABLE_MSG("GraphicsSurfaceWidget::BytesPerPixel: this " - "should not be reached as this function should " - "be given a format which is in " + UNREACHABLE_MSG("GraphicsSurfaceWidget::BytesPerPixel: this should not be reached as this " + "function should be given a format which is in " "GraphicsSurfaceWidget::Format. Instead got %i", static_cast(format)); return 0; diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index c49327f9c..0f02bc3da 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -29,8 +29,7 @@ using nihstro::SourceRegister; using nihstro::SwizzlePattern; GraphicsVertexShaderModel::GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent) - : QAbstractTableModel(parent), par(parent) { -} + : QAbstractTableModel(parent), par(parent) {} int GraphicsVertexShaderModel::columnCount(const QModelIndex& parent) const { return 3; diff --git a/src/citra_qt/debugger/ramview.cpp b/src/citra_qt/debugger/ramview.cpp index 63f2850e1..10a09dda8 100644 --- a/src/citra_qt/debugger/ramview.cpp +++ b/src/citra_qt/debugger/ramview.cpp @@ -4,8 +4,7 @@ #include "citra_qt/debugger/ramview.h" -GRamView::GRamView(QWidget* parent) : QHexEdit(parent) { -} +GRamView::GRamView(QWidget* parent) : QHexEdit(parent) {} void GRamView::OnCPUStepped() { // TODO: QHexEdit doesn't show vertical scroll bars for > 10MB data streams... diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index 82da0022f..87c8c3418 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp @@ -75,8 +75,7 @@ void RegistersWidget::OnDebugModeEntered() { UpdateVFPSystemRegisterValues(); } -void RegistersWidget::OnDebugModeLeft() { -} +void RegistersWidget::OnDebugModeLeft() {} void RegistersWidget::OnEmulationStarting(EmuThread* emu_thread) { setEnabled(true); diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index bcb3fccbd..c8a9ee5db 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -59,12 +59,9 @@ static QString GetQStringShortTitleFromSMDH(const Loader::SMDH& smdh, class GameListItem : public QStandardItem { public: - GameListItem() : QStandardItem() { - } - GameListItem(const QString& string) : QStandardItem(string) { - } - virtual ~GameListItem() override { - } + GameListItem() : QStandardItem() {} + GameListItem(const QString& string) : QStandardItem(string) {} + virtual ~GameListItem() override {} }; /** @@ -79,8 +76,7 @@ public: static const int FullPathRole = Qt::UserRole + 1; static const int TitleRole = Qt::UserRole + 2; - GameListItemPath() : GameListItem() { - } + GameListItemPath() : GameListItem() {} GameListItemPath(const QString& game_path, const std::vector& smdh_data) : GameListItem() { setData(game_path, FullPathRole); @@ -124,8 +120,7 @@ class GameListItemSize : public GameListItem { public: static const int SizeRole = Qt::UserRole + 1; - GameListItemSize() : GameListItem() { - } + GameListItemSize() : GameListItem() {} GameListItemSize(const qulonglong size_bytes) : GameListItem() { setData(size_bytes, SizeRole); } @@ -161,8 +156,7 @@ class GameListWorker : public QObject, public QRunnable { public: GameListWorker(QString dir_path, bool deep_scan) - : QObject(), QRunnable(), dir_path(dir_path), deep_scan(deep_scan) { - } + : QObject(), QRunnable(), dir_path(dir_path), deep_scan(deep_scan) {} public slots: /// Starts the processing of directory tree information. diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 6301259d8..3e38223ee 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -12,8 +12,7 @@ #include "citra_qt/ui_settings.h" struct Hotkey { - Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) { - } + Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {} QKeySequence keyseq; QShortcut* shortcut; diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 717c68382..10157310e 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -26,8 +26,8 @@ class GPUCommandListWidget; class GMainWindow : public QMainWindow { Q_OBJECT - static const int max_recent_files_item = - 10; ///< Max number of recently loaded items to keep track + /// Max number of recently loaded items to keep track of + static const int max_recent_files_item = 10; // TODO: Make use of this! enum { diff --git a/src/common/bit_set.h b/src/common/bit_set.h index b83cbbb36..c48b3b769 100644 --- a/src/common/bit_set.h +++ b/src/common/bit_set.h @@ -102,10 +102,8 @@ public: // A reference to a particular bit, returned from operator[]. class Ref { public: - Ref(Ref&& other) : m_bs(other.m_bs), m_mask(other.m_mask) { - } - Ref(BitSet* bs, IntTy mask) : m_bs(bs), m_mask(mask) { - } + Ref(Ref&& other) : m_bs(other.m_bs), m_mask(other.m_mask) {} + Ref(BitSet* bs, IntTy mask) : m_bs(bs), m_mask(mask) {} operator bool() const { return (m_bs->m_val & m_mask) != 0; } @@ -122,10 +120,8 @@ public: // A STL-like iterator is required to be able to use range-based for loops. class Iterator { public: - Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) { - } - Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) { - } + Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) {} + Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) {} Iterator& operator=(Iterator other) { new (this) Iterator(other); return *this; @@ -160,10 +156,8 @@ public: int m_bit; }; - BitSet() : m_val(0) { - } - explicit BitSet(IntTy val) : m_val(val) { - } + BitSet() : m_val(0) {} + explicit BitSet(IntTy val) : m_val(val) {} BitSet(std::initializer_list init) { m_val = 0; for (int bit : init) diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 3b36c0a9e..2bf3c774b 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -50,8 +50,7 @@ class PointerWrap; class PointerWrapSection { public: PointerWrapSection(PointerWrap& p, int ver, const char* title) - : p_(p), ver_(ver), title_(title) { - } + : p_(p), ver_(ver), title_(title) {} ~PointerWrapSection(); bool operator==(const int& v) const { @@ -134,11 +133,9 @@ public: Error error; public: - PointerWrap(u8** ptr_, Mode mode_) : ptr(ptr_), mode(mode_), error(ERROR_NONE) { - } + PointerWrap(u8** ptr_, Mode mode_) : ptr(ptr_), mode(mode_), error(ERROR_NONE) {} PointerWrap(unsigned char** ptr_, int mode_) - : ptr((u8**)ptr_), mode((Mode)mode_), error(ERROR_NONE) { - } + : ptr((u8**)ptr_), mode((Mode)mode_), error(ERROR_NONE) {} PointerWrapSection Section(const char* title, int ver) { return Section(title, ver, ver); diff --git a/src/common/code_block.h b/src/common/code_block.h index 58696737e..099088925 100644 --- a/src/common/code_block.h +++ b/src/common/code_block.h @@ -27,8 +27,7 @@ protected: size_t region_size; public: - CodeBlock() : region(nullptr), region_size(0) { - } + CodeBlock() : region(nullptr), region_size(0) {} virtual ~CodeBlock() { if (region) FreeCodeSpace(); diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index ad5bdbc08..7032c2117 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -86,8 +86,7 @@ inline u64 _rotr64(u64 x, unsigned int shift) { extern "C" { __declspec(dllimport) void __stdcall DebugBreak(void); } -#define Crash() \ - { DebugBreak(); } +#define Crash() DebugBreak() // cstdlib provides these on MSVC #define rotr _rotr diff --git a/src/common/emu_window.h b/src/common/emu_window.h index de8badd4f..20131300d 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -229,8 +229,7 @@ protected: circle_pad_y = 0; touch_pressed = false; } - virtual ~EmuWindow() { - } + virtual ~EmuWindow() {} /** * Processes any pending configuration changes from the last SetConfig call. @@ -272,8 +271,8 @@ private: * For the request to be honored, EmuWindow implementations will usually reimplement this * function. */ - virtual void - OnMinimalClientAreaChangeRequest(const std::pair& minimal_size) { + virtual void OnMinimalClientAreaChangeRequest( + const std::pair& minimal_size) { // By default, ignore this request and do nothing. } diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index c8723a4b3..96afe2ca0 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -828,8 +828,7 @@ void SplitFilename83(const std::string& filename, std::array& short_nam } } -IOFile::IOFile() { -} +IOFile::IOFile() {} IOFile::IOFile(const std::string& filename, const char openmode[]) { Open(filename, openmode); diff --git a/src/common/math_util.h b/src/common/math_util.h index 696bd43ea..41d89666c 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h @@ -27,12 +27,10 @@ struct Rectangle { T right; T bottom; - Rectangle() { - } + Rectangle() {} Rectangle(T left, T top, T right, T bottom) - : left(left), top(top), right(right), bottom(bottom) { - } + : left(left), top(top), right(right), bottom(bottom) {} T GetWidth() const { return std::abs(static_cast::type>(right - left)); diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index 992ec25b2..231a0afc1 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -14,8 +14,7 @@ namespace Common { namespace Profiling { ProfilingManager::ProfilingManager() - : last_frame_end(Clock::now()), this_frame_start(Clock::now()) { -} + : last_frame_end(Clock::now()), this_frame_start(Clock::now()) {} void ProfilingManager::BeginFrame() { this_frame_start = Clock::now(); diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 73b2a262e..072ab285d 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -10,8 +10,7 @@ namespace detail { template struct ScopeExitHelper { - explicit ScopeExitHelper(Func&& func) : func(std::move(func)) { - } + explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} ~ScopeExitHelper() { func(); } diff --git a/src/common/swap.h b/src/common/swap.h index 1794144fb..72c50d789 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -168,8 +168,7 @@ public: return swap(value); } swap_struct_t() = default; - swap_struct_t(const T& v) : value(swap(v)) { - } + swap_struct_t(const T& v) : value(swap(v)) {} template swapped_t& operator=(const S& source) { diff --git a/src/common/synchronized_wrapper.h b/src/common/synchronized_wrapper.h index 8dc4ddeac..04b4f2e51 100644 --- a/src/common/synchronized_wrapper.h +++ b/src/common/synchronized_wrapper.h @@ -19,8 +19,7 @@ template class SynchronizedWrapper { public: template - SynchronizedWrapper(Args&&... args) : data(std::forward(args)...) { - } + SynchronizedWrapper(Args&&... args) : data(std::forward(args)...) {} private: template diff --git a/src/common/thread.h b/src/common/thread.h index b189dc764..499c151c2 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -39,8 +39,7 @@ void SetCurrentThreadAffinity(u32 mask); class Event { public: - Event() : is_set(false) { - } + Event() : is_set(false) {} void Set() { std::lock_guard lk(mutex); @@ -71,8 +70,7 @@ private: class Barrier { public: - explicit Barrier(size_t count_) : count(count_), waiting(0), generation(0) { - } + explicit Barrier(size_t count_) : count(count_), waiting(0), generation(0) {} /// Blocks until all "count" threads have called Sync() void Sync() { diff --git a/src/common/vector_math.h b/src/common/vector_math.h index b2d630829..2d56f168c 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -60,10 +60,8 @@ public: } Vec2() = default; - Vec2(const T a[2]) : x(a[0]), y(a[1]) { - } - Vec2(const T& _x, const T& _y) : x(_x), y(_y) { - } + Vec2(const T a[2]) : x(a[0]), y(a[1]) {} + Vec2(const T& _x, const T& _y) : x(_x), y(_y) {} template Vec2 Cast() const { @@ -201,10 +199,8 @@ public: } Vec3() = default; - Vec3(const T a[3]) : x(a[0]), y(a[1]), z(a[2]) { - } - Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) { - } + Vec3(const T a[3]) : x(a[0]), y(a[1]), z(a[2]) {} + Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) {} template Vec3 Cast() const { @@ -409,10 +405,8 @@ public: } Vec4() = default; - Vec4(const T a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3]) { - } - Vec4(const T& _x, const T& _y, const T& _z, const T& _w) : x(_x), y(_y), z(_z), w(_w) { - } + Vec4(const T a[4]) : x(a[0]), y(a[1]), z(a[2]), w(a[3]) {} + Vec4(const T& _x, const T& _y, const T& _z, const T& _w) : x(_x), y(_y), z(_z), w(_w) {} template Vec4 Cast() const { diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp index 1a9fd6a6b..7cf350b4a 100644 --- a/src/common/x64/emitter.cpp +++ b/src/common/x64/emitter.cpp @@ -222,7 +222,7 @@ void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp void OpArg::WriteRest(XEmitter* emit, int extraBytes, X64Reg _operandReg, bool warn_64bit_offset) const { if (_operandReg == INVALID_REG) - _operandReg = (X64Reg) this->operandReg; + _operandReg = (X64Reg)this->operandReg; int mod = 0; int ireg = indexReg; bool SIB = false; diff --git a/src/common/x64/emitter.h b/src/common/x64/emitter.h index 467f7812f..6c9dc3d6b 100644 --- a/src/common/x64/emitter.h +++ b/src/common/x64/emitter.h @@ -233,8 +233,7 @@ struct OpArg { constexpr OpArg() = default; // dummy op arg, used for storage constexpr OpArg(u64 offset_, int scale_, X64Reg rmReg = RAX, X64Reg scaledReg = RAX) : scale(static_cast(scale_)), offsetOrBaseReg(static_cast(rmReg)), - indexReg(static_cast(scaledReg)), offset(offset_) { - } + indexReg(static_cast(scaledReg)), offset(offset_) {} constexpr bool operator==(const OpArg& b) const { return operandReg == b.operandReg && scale == b.scale && @@ -454,8 +453,7 @@ public: code = code_ptr; flags_locked = false; } - virtual ~XEmitter() { - } + virtual ~XEmitter() {} void WriteModRM(int mod, int rm, int reg); void WriteSIB(int scale, int index, int base); diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 919da6737..e466b21b2 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -15,8 +15,7 @@ struct ThreadContext; /// Generic ARM11 CPU interface class ARM_Interface : NonCopyable { public: - virtual ~ARM_Interface() { - } + virtual ~ARM_Interface() {} /** * Runs the CPU for the given number of instructions diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index d84917529..912560402 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -21,8 +21,7 @@ ARM_DynCom::ARM_DynCom(PrivilegeMode initial_mode) { state = std::make_unique(initial_mode); } -ARM_DynCom::~ARM_DynCom() { -} +ARM_DynCom::~ARM_DynCom() {} void ARM_DynCom::ClearInstructionCache() { state->instruction_cache.clear(); diff --git a/src/core/arm/dyncom/arm_dyncom_trans.cpp b/src/core/arm/dyncom/arm_dyncom_trans.cpp index e056d890c..526cf28f3 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.cpp +++ b/src/core/arm/dyncom/arm_dyncom_trans.cpp @@ -1883,6 +1883,7 @@ const transop_fp_t arm_instruction_trans[] = { // All the thumb instructions should be placed the end of table INTERPRETER_TRANSLATE(b_2_thumb), INTERPRETER_TRANSLATE(b_cond_thumb), INTERPRETER_TRANSLATE(bl_1_thumb), INTERPRETER_TRANSLATE(bl_2_thumb), - INTERPRETER_TRANSLATE(blx_1_thumb)}; + INTERPRETER_TRANSLATE(blx_1_thumb), +}; const size_t arm_instruction_trans_len = sizeof(arm_instruction_trans) / sizeof(transop_fp_t); diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h index 66567c285..f31fb207c 100644 --- a/src/core/arm/skyeye_common/armstate.h +++ b/src/core/arm/skyeye_common/armstate.h @@ -237,10 +237,8 @@ private: void ResetMPCoreCP15Registers(); // Defines a reservation granule of 2 words, which protects the first 2 words starting at the - // tag. - // This is the smallest granule allowed by the v7 spec, and is coincidentally just large enough - // to - // support LDR/STREXD. + // tag. This is the smallest granule allowed by the v7 spec, and is coincidentally just large + // enough to support LDR/STREXD. static const u32 RESERVATION_GRANULE_MASK = 0xFFFFFFF8; u32 exclusive_tag; // The address for which the local monitor is in exclusive access mode diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp index 4d89743e7..2886f351f 100644 --- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp @@ -51,10 +51,10 @@ * =========================================================================== */ -#include "core/arm/skyeye_common/vfp/vfp.h" #include #include "common/logging/log.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" +#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/arm/skyeye_common/vfp/vfp_helper.h" static struct vfp_double vfp_double_default_qnan = { diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp index 3c21efe62..bf157e2c3 100644 --- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp @@ -280,13 +280,15 @@ static u32 vfp_single_fneg(ARMul_State* state, int sd, int unused, s32 m, u32 fp return 0; } -static const u16 sqrt_oddadjust[] = {0x0004, 0x0022, 0x005d, 0x00b1, 0x011d, 0x019f, - 0x0236, 0x02e0, 0x039c, 0x0468, 0x0545, 0x0631, - 0x072b, 0x0832, 0x0946, 0x0a67}; +static const u16 sqrt_oddadjust[] = { + 0x0004, 0x0022, 0x005d, 0x00b1, 0x011d, 0x019f, 0x0236, 0x02e0, + 0x039c, 0x0468, 0x0545, 0x0631, 0x072b, 0x0832, 0x0946, 0x0a67, +}; -static const u16 sqrt_evenadjust[] = {0x0a2d, 0x08af, 0x075a, 0x0629, 0x051a, 0x0429, - 0x0356, 0x029e, 0x0200, 0x0179, 0x0109, 0x00af, - 0x0068, 0x0034, 0x0012, 0x0002}; +static const u16 sqrt_evenadjust[] = { + 0x0a2d, 0x08af, 0x075a, 0x0629, 0x051a, 0x0429, 0x0356, 0x029e, + 0x0200, 0x0179, 0x0109, 0x00af, 0x0068, 0x0034, 0x0012, 0x0002, +}; u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand) { int index; diff --git a/src/core/core.cpp b/src/core/core.cpp index 4f9eca416..71a13dd33 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -28,8 +28,7 @@ void RunLoop(int tight_loop) { GDBStub::HandlePacket(); // If the loop is halted and we want to step, use a tiny (1) number of instructions to - // execute. - // Otherwise get out of the loop function. + // execute. Otherwise, get out of the loop function. if (GDBStub::GetCpuHaltFlag()) { if (GDBStub::GetCpuStepFlag()) { GDBStub::SetCpuStepFlag(false); diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index b7b988cf1..fb88ecaf2 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -23,11 +23,9 @@ int g_clock_rate_arm11 = 268123480; namespace CoreTiming { struct EventType { - EventType() { - } + EventType() {} - EventType(TimedCallback cb, const char* n) : callback(cb), name(n) { - } + EventType(TimedCallback cb, const char* n) : callback(cb), name(n) {} TimedCallback callback; const char* name; diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 79fde9710..7f64fe4e2 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -21,7 +21,13 @@ class FileBackend; class DirectoryBackend; // Path string type -enum LowPathType : u32 { Invalid = 0, Empty = 1, Binary = 2, Char = 3, Wchar = 4 }; +enum LowPathType : u32 { + Invalid = 0, + Empty = 1, + Binary = 2, + Char = 3, + Wchar = 4, +}; union Mode { u32 hex; @@ -32,12 +38,9 @@ union Mode { class Path { public: - Path() : type(Invalid) { - } - Path(const char* path) : type(Char), string(path) { - } - Path(std::vector binary_data) : type(Binary), binary(std::move(binary_data)) { - } + Path() : type(Invalid) {} + Path(const char* path) : type(Char), string(path) {} + Path(std::vector binary_data) : type(Binary), binary(std::move(binary_data)) {} Path(LowPathType type, u32 size, u32 pointer); LowPathType GetType() const { @@ -61,22 +64,18 @@ private: std::u16string u16str; }; +/// Parameters of the archive, as specified in the Create or Format call. struct ArchiveFormatInfo { - u32_le total_size; ///< The pre-defined size of the archive, as specified in the Create or - /// Format call - u32_le number_directories; ///< The pre-defined number of directories in the archive, as - /// specified in the Create or Format call - u32_le number_files; ///< The pre-defined number of files in the archive, as specified in the - /// Create or Format call - u8 duplicate_data; ///< Whether the archive should duplicate the data, as specified in the - /// Create or Format call + u32_le total_size; ///< The pre-defined size of the archive. + u32_le number_directories; ///< The pre-defined number of directories in the archive. + u32_le number_files; ///< The pre-defined number of files in the archive. + u8 duplicate_data; ///< Whether the archive should duplicate the data. }; static_assert(std::is_pod::value, "ArchiveFormatInfo is not POD"); class ArchiveBackend : NonCopyable { public: - virtual ~ArchiveBackend() { - } + virtual ~ArchiveBackend() {} /** * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.) @@ -153,8 +152,7 @@ public: class ArchiveFactory : NonCopyable { public: - virtual ~ArchiveFactory() { - } + virtual ~ArchiveFactory() {} /** * Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.) diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index 9a264091f..860f2fca8 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -48,11 +48,10 @@ ResultVal> ArchiveFactory_SaveData::Open(const P std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id); if (!FileUtil::Exists(concrete_mount_point)) { - // When a SaveData archive is created for the first time, it is not yet formatted - // and the save file/directory structure expected by the game has not yet been initialized. + // When a SaveData archive is created for the first time, it is not yet formatted and the + // save file/directory structure expected by the game has not yet been initialized. // Returning the NotFormatted error code will signal the game to provision the SaveData - // archive - // with the files and folders that it expects. + // archive with the files and folders that it expects. return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status); } diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp index fd9b84302..50fe004fe 100644 --- a/src/core/file_sys/archive_savedatacheck.cpp +++ b/src/core/file_sys/archive_savedatacheck.cpp @@ -30,8 +30,7 @@ static std::string GetSaveDataCheckPath(const std::string& mount_point, u32 high } ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory) - : mount_point(GetSaveDataCheckContainerPath(nand_directory)) { -} + : mount_point(GetSaveDataCheckContainerPath(nand_directory)) {} ResultVal> ArchiveFactory_SaveDataCheck::Open(const Path& path) { auto vec = path.AsBinary(); diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index 1fb858247..0261ab547 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp @@ -49,8 +49,7 @@ Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { } ArchiveFactory_SystemSaveData::ArchiveFactory_SystemSaveData(const std::string& nand_path) - : base_path(GetSystemSaveDataContainerPath(nand_path)) { -} + : base_path(GetSystemSaveDataContainerPath(nand_path)) {} ResultVal> ArchiveFactory_SystemSaveData::Open(const Path& path) { std::string fullpath = GetSystemSaveDataPath(base_path, path); diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory_backend.h index c402ee60b..9706e909b 100644 --- a/src/core/file_sys/directory_backend.h +++ b/src/core/file_sys/directory_backend.h @@ -38,10 +38,8 @@ static_assert(offsetof(Entry, file_size) == 0x220, "Wrong offset for file_size i class DirectoryBackend : NonCopyable { public: - DirectoryBackend() { - } - virtual ~DirectoryBackend() { - } + DirectoryBackend() {} + virtual ~DirectoryBackend() {} /** * Open the directory diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h index 3f620128f..64e36f5ea 100644 --- a/src/core/file_sys/disk_archive.h +++ b/src/core/file_sys/disk_archive.h @@ -29,8 +29,7 @@ namespace FileSys { */ class DiskArchive : public ArchiveBackend { public: - DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) { - } + DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) {} virtual std::string GetName() const override { return "DiskArchive: " + mount_point; diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h index 9eae697c2..3496facd4 100644 --- a/src/core/file_sys/file_backend.h +++ b/src/core/file_sys/file_backend.h @@ -16,10 +16,8 @@ namespace FileSys { class FileBackend : NonCopyable { public: - FileBackend() { - } - virtual ~FileBackend() { - } + FileBackend() {} + virtual ~FileBackend() {} /** * Open the file diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h index dab1958f6..0d15550da 100644 --- a/src/core/file_sys/ivfc_archive.h +++ b/src/core/file_sys/ivfc_archive.h @@ -30,8 +30,7 @@ namespace FileSys { class IVFCArchive : public ArchiveBackend { public: IVFCArchive(std::shared_ptr file, u64 offset, u64 size) - : romfs_file(file), data_offset(offset), data_size(size) { - } + : romfs_file(file), data_offset(offset), data_size(size) {} std::string GetName() const override; @@ -55,8 +54,7 @@ protected: class IVFCFile : public FileBackend { public: IVFCFile(std::shared_ptr file, u64 offset, u64 size) - : romfs_file(file), data_offset(offset), data_size(size) { - } + : romfs_file(file), data_offset(offset), data_size(size) {} ResultCode Open() override { return RESULT_SUCCESS; @@ -68,8 +66,7 @@ public: bool Close() const override { return false; } - void Flush() const override { - } + void Flush() const override {} private: std::shared_ptr romfs_file; diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h index 350a58594..1850ad261 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h @@ -14,10 +14,8 @@ namespace Applets { class Applet { public: - virtual ~Applet() { - } - Applet(Service::APT::AppletId id) : id(id) { - } + virtual ~Applet() {} + Applet(Service::APT::AppletId id) : id(id) {} /** * Creates an instance of the Applet subclass identified by the parameter. diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 144d6a152..457cbb1bd 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp @@ -67,8 +67,7 @@ ResultCode ErrEula::StartImpl(const Service::APT::AppletStartupParameter& parame return RESULT_SUCCESS; } -void ErrEula::Update() { -} +void ErrEula::Update() {} } // namespace Applets } // namespace HLE diff --git a/src/core/hle/applets/erreula.h b/src/core/hle/applets/erreula.h index dd1d1aee4..a7ec7ec01 100644 --- a/src/core/hle/applets/erreula.h +++ b/src/core/hle/applets/erreula.h @@ -12,8 +12,7 @@ namespace Applets { class ErrEula final : public Applet { public: - explicit ErrEula(Service::APT::AppletId id) : Applet(id) { - } + explicit ErrEula(Service::APT::AppletId id) : Applet(id) {} ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 19e603eda..79264d349 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -85,7 +85,6 @@ ResultCode MiiSelector::StartImpl(const Service::APT::AppletStartupParameter& pa return RESULT_SUCCESS; } -void MiiSelector::Update() { -} +void MiiSelector::Update() {} } } // namespace diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h index dba4abc8d..26966a271 100644 --- a/src/core/hle/applets/mii_selector.h +++ b/src/core/hle/applets/mii_selector.h @@ -66,8 +66,7 @@ ASSERT_REG_POSITION(unk_6C, 0x6C); class MiiSelector final : public Applet { public: - MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) { - } + MiiSelector(Service::APT::AppletId id) : Applet(id), started(false) {} ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h index f50673912..4e2f9de62 100644 --- a/src/core/hle/applets/swkbd.h +++ b/src/core/hle/applets/swkbd.h @@ -53,8 +53,7 @@ static_assert(sizeof(SoftwareKeyboardConfig) == 0x400, "Software Keyboard Config class SoftwareKeyboard final : public Applet { public: - SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) { - } + SoftwareKeyboard(Service::APT::AppletId id) : Applet(id), started(false) {} ResultCode ReceiveParameter(const Service::APT::MessageParameter& parameter) override; ResultCode StartImpl(const Service::APT::AppletStartupParameter& parameter) override; diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 2ff652f13..3506c2d48 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -16,10 +16,8 @@ namespace Kernel { -AddressArbiter::AddressArbiter() { -} -AddressArbiter::~AddressArbiter() { -} +AddressArbiter::AddressArbiter() {} +AddressArbiter::~AddressArbiter() {} SharedPtr AddressArbiter::Create(std::string name) { SharedPtr address_arbiter(new AddressArbiter); diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 5df769c6a..444ce8d45 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -10,9 +10,7 @@ namespace Kernel { -ClientPort::ClientPort() { -} -ClientPort::~ClientPort() { -} +ClientPort::ClientPort() {} +ClientPort::~ClientPort() {} } // namespace diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 63375818d..f056eb7c3 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -14,10 +14,8 @@ namespace Kernel { -Event::Event() { -} -Event::~Event() { -} +Event::Event() {} +Event::~Event() {} SharedPtr Event::Create(ResetType reset_type, std::string name) { SharedPtr evt(new Event); diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index cc39652d5..c683fcb80 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -58,8 +58,7 @@ enum { class Object : NonCopyable { public: - virtual ~Object() { - } + virtual ~Object() {} /// Returns a unique identifier for the object. For debugging purposes only. unsigned int GetObjectId() const { diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index f92810804..edb97d324 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -33,10 +33,8 @@ void ReleaseThreadMutexes(Thread* thread) { thread->held_mutexes.clear(); } -Mutex::Mutex() { -} -Mutex::~Mutex() { -} +Mutex::Mutex() {} +Mutex::~Mutex() {} SharedPtr Mutex::Create(bool initial_locked, std::string name) { SharedPtr mutex(new Mutex); diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index cc37e574c..b764f750f 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -26,10 +26,8 @@ SharedPtr CodeSet::Create(std::string name, u64 program_id) { return codeset; } -CodeSet::CodeSet() { -} -CodeSet::~CodeSet() { -} +CodeSet::CodeSet() {} +CodeSet::~CodeSet() {} u32 Process::next_process_id; @@ -282,10 +280,8 @@ ResultCode Process::LinearFree(VAddr target, u32 size) { return RESULT_SUCCESS; } -Kernel::Process::Process() { -} -Kernel::Process::~Process() { -} +Kernel::Process::Process() {} +Kernel::Process::~Process() {} SharedPtr g_current_process; } diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 7bd1c1e08..bb0baed6f 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -12,10 +12,8 @@ namespace Kernel { static SharedPtr resource_limits[4]; -ResourceLimit::ResourceLimit() { -} -ResourceLimit::~ResourceLimit() { -} +ResourceLimit::ResourceLimit() {} +ResourceLimit::~ResourceLimit() {} SharedPtr ResourceLimit::Create(std::string name) { SharedPtr resource_limit(new ResourceLimit); @@ -150,7 +148,6 @@ void ResourceLimitsInit() { resource_limits[static_cast(ResourceLimitCategory::OTHER)] = resource_limit; } -void ResourceLimitsShutdown() { -} +void ResourceLimitsShutdown() {} } // namespace diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h index c08e744e6..5d8b31a2d 100644 --- a/src/core/hle/kernel/resource_limit.h +++ b/src/core/hle/kernel/resource_limit.h @@ -92,8 +92,8 @@ public: s32 max_cpu_time = 0; // TODO(Subv): Increment these in their respective Kernel::T::Create functions, keeping in mind - // that - // APPLICATION resource limits should not be affected by the objects created by service modules. + // that APPLICATION resource limits should not be affected by the objects created by service + // modules. // Currently we have no way of distinguishing if a Create was called by the running application, // or by a service module. Approach this once we have separated the service modules into their // own processes diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index 71e41079b..16ac22f1d 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -10,10 +10,8 @@ namespace Kernel { -Semaphore::Semaphore() { -} -Semaphore::~Semaphore() { -} +Semaphore::Semaphore() {} +Semaphore::~Semaphore() {} ResultVal> Semaphore::Create(s32 initial_count, s32 max_count, std::string name) { diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index 7c690fa7f..57e93cad4 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp @@ -13,10 +13,8 @@ namespace Kernel { -ServerPort::ServerPort() { -} -ServerPort::~ServerPort() { -} +ServerPort::ServerPort() {} +ServerPort::~ServerPort() {} bool ServerPort::ShouldWait() { // If there are no pending sessions, we wait until a new one is added. @@ -27,8 +25,9 @@ void ServerPort::Acquire() { ASSERT_MSG(!ShouldWait(), "object unavailable!"); } -std::tuple, SharedPtr> -ServerPort::CreatePortPair(u32 max_sessions, std::string name) { +std::tuple, SharedPtr> ServerPort::CreatePortPair( + u32 max_sessions, std::string name) { + SharedPtr server_port(new ServerPort); SharedPtr client_port(new ClientPort); diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.h index e43d48674..c3f2ae177 100644 --- a/src/core/hle/kernel/server_port.h +++ b/src/core/hle/kernel/server_port.h @@ -23,8 +23,8 @@ public: * @param name Optional name of the ports * @return The created port tuple */ - static std::tuple, SharedPtr> - CreatePortPair(u32 max_sessions, std::string name = "UnknownPort"); + static std::tuple, SharedPtr> CreatePortPair( + u32 max_sessions, std::string name = "UnknownPort"); std::string GetTypeName() const override { return "ServerPort"; diff --git a/src/core/hle/kernel/session.cpp b/src/core/hle/kernel/session.cpp index 61457845a..8a2a7e3fd 100644 --- a/src/core/hle/kernel/session.cpp +++ b/src/core/hle/kernel/session.cpp @@ -7,8 +7,6 @@ namespace Kernel { -Session::Session() { -} -Session::~Session() { -} +Session::Session() {} +Session::~Session() {} } diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 74f40930c..bf511a338 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -12,10 +12,8 @@ namespace Kernel { -SharedMemory::SharedMemory() { -} -SharedMemory::~SharedMemory() { -} +SharedMemory::SharedMemory() {} +SharedMemory::~SharedMemory() {} SharedPtr SharedMemory::Create(SharedPtr owner_process, u32 size, MemoryPermission permissions, diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 59272715f..0df03c9d5 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -61,10 +61,8 @@ inline static u32 const NewThreadId() { return next_thread_id++; } -Thread::Thread() { -} -Thread::~Thread() { -} +Thread::Thread() {} +Thread::~Thread() {} Thread* GetCurrentThread() { return current_thread; diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 255cb1aca..427a81923 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -20,10 +20,8 @@ static int timer_callback_event_type; // us to simply use a pool index or similar. static Kernel::HandleTable timer_callback_handle_table; -Timer::Timer() { -} -Timer::~Timer() { -} +Timer::Timer() {} +Timer::~Timer() {} SharedPtr Timer::Create(ResetType reset_type, std::string name) { SharedPtr timer(new Timer); @@ -103,7 +101,6 @@ void TimersInit() { timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); } -void TimersShutdown() { -} +void TimersShutdown() {} } // namespace diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 6e3dd9cd2..492c1ffa6 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -213,8 +213,7 @@ union ResultCode { // error BitField<31, 1, u32> is_error; - explicit ResultCode(u32 raw) : raw(raw) { - } + explicit ResultCode(u32 raw) : raw(raw) {} ResultCode(ErrorDescription description_, ErrorModule module_, ErrorSummary summary_, ErrorLevel level_) : raw(0) { diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index b653523a4..528bb1848 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -186,8 +186,7 @@ void Init() { AddService(new AM_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace AM diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index bfc1ca6bd..827e60335 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_app.h" +#include "core/hle/service/am/am.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp index 3a597a34c..d9d9d78c8 100644 --- a/src/core/hle/service/am/am_net.cpp +++ b/src/core/hle/service/am/am_net.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_net.h" +#include "core/hle/service/am/am.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp index 8bb58cab7..6f441f9e7 100644 --- a/src/core/hle/service/am/am_sys.cpp +++ b/src/core/hle/service/am/am_sys.cpp @@ -2,33 +2,35 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_sys.h" +#include "core/hle/service/am/am.h" namespace Service { namespace AM { -const Interface::FunctionInfo FunctionTable[] = {{0x00010040, GetTitleCount, "GetTitleCount"}, - {0x00020082, GetTitleList, "GetTitleList"}, - {0x00030084, GetTitleInfo, "GetTitleInfo"}, - {0x000400C0, nullptr, "DeleteApplicationTitle"}, - {0x000500C0, nullptr, "GetTitleProductCode"}, - {0x000600C0, nullptr, "GetTitleExtDataId"}, - {0x00070080, DeleteTicket, "DeleteTicket"}, - {0x00080000, GetTicketCount, "GetTicketCount"}, - {0x00090082, GetTicketList, "GetTicketList"}, - {0x000A0000, nullptr, "GetDeviceID"}, - {0x000D0084, nullptr, "GetPendingTitleInfo"}, - {0x000E00C0, nullptr, "DeletePendingTitle"}, - {0x00140040, nullptr, "FinalizePendingTitles"}, - {0x00150040, nullptr, "DeleteAllPendingTitles"}, - {0x00180080, nullptr, "InitializeTitleDatabase"}, - {0x00190040, nullptr, "ReloadDBS"}, - {0x001A00C0, nullptr, "GetDSiWareExportSize"}, - {0x001B0144, nullptr, "ExportDSiWare"}, - {0x001C0084, nullptr, "ImportDSiWare"}, - {0x00230080, nullptr, "GetPendingTitleCount"}, - {0x002400C2, nullptr, "GetPendingTitleList"}}; +const Interface::FunctionInfo FunctionTable[] = { + {0x00010040, GetTitleCount, "GetTitleCount"}, + {0x00020082, GetTitleList, "GetTitleList"}, + {0x00030084, GetTitleInfo, "GetTitleInfo"}, + {0x000400C0, nullptr, "DeleteApplicationTitle"}, + {0x000500C0, nullptr, "GetTitleProductCode"}, + {0x000600C0, nullptr, "GetTitleExtDataId"}, + {0x00070080, DeleteTicket, "DeleteTicket"}, + {0x00080000, GetTicketCount, "GetTicketCount"}, + {0x00090082, GetTicketList, "GetTicketList"}, + {0x000A0000, nullptr, "GetDeviceID"}, + {0x000D0084, nullptr, "GetPendingTitleInfo"}, + {0x000E00C0, nullptr, "DeletePendingTitle"}, + {0x00140040, nullptr, "FinalizePendingTitles"}, + {0x00150040, nullptr, "DeleteAllPendingTitles"}, + {0x00180080, nullptr, "InitializeTitleDatabase"}, + {0x00190040, nullptr, "ReloadDBS"}, + {0x001A00C0, nullptr, "GetDSiWareExportSize"}, + {0x001B0144, nullptr, "ExportDSiWare"}, + {0x001C0084, nullptr, "ImportDSiWare"}, + {0x00230080, nullptr, "GetPendingTitleCount"}, + {0x002400C2, nullptr, "GetPendingTitleList"}, +}; AM_SYS_Interface::AM_SYS_Interface() { Register(FunctionTable); diff --git a/src/core/hle/service/am/am_u.cpp b/src/core/hle/service/am/am_u.cpp index 32d47741f..c40e56205 100644 --- a/src/core/hle/service/am/am_u.cpp +++ b/src/core/hle/service/am/am_u.cpp @@ -2,46 +2,48 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_u.h" +#include "core/hle/service/am/am.h" namespace Service { namespace AM { -const Interface::FunctionInfo FunctionTable[] = {{0x00010040, GetTitleCount, "GetTitleCount"}, - {0x00020082, GetTitleList, "GetTitleList"}, - {0x00030084, GetTitleInfo, "GetTitleInfo"}, - {0x000400C0, nullptr, "DeleteApplicationTitle"}, - {0x000500C0, nullptr, "GetTitleProductCode"}, - {0x000600C0, nullptr, "GetTitleExtDataId"}, - {0x00070080, DeleteTicket, "DeleteTicket"}, - {0x00080000, GetTicketCount, "GetTicketCount"}, - {0x00090082, GetTicketList, "GetTicketList"}, - {0x000A0000, nullptr, "GetDeviceID"}, - {0x000D0084, nullptr, "GetPendingTitleInfo"}, - {0x000E00C0, nullptr, "DeletePendingTitle"}, - {0x00140040, nullptr, "FinalizePendingTitles"}, - {0x00150040, nullptr, "DeleteAllPendingTitles"}, - {0x00180080, nullptr, "InitializeTitleDatabase"}, - {0x00190040, nullptr, "ReloadDBS"}, - {0x001A00C0, nullptr, "GetDSiWareExportSize"}, - {0x001B0144, nullptr, "ExportDSiWare"}, - {0x001C0084, nullptr, "ImportDSiWare"}, - {0x00230080, nullptr, "TitleIDListGetTotal2"}, - {0x002400C2, nullptr, "GetTitleIDList2"}, - {0x04010080, nullptr, "InstallFIRM"}, - {0x04020040, nullptr, "StartInstallCIADB0"}, - {0x04030000, nullptr, "StartInstallCIADB1"}, - {0x04040002, nullptr, "AbortCIAInstall"}, - {0x04050002, nullptr, "CloseCIAFinalizeInstall"}, - {0x04060002, nullptr, "CloseCIA"}, - {0x040700C2, nullptr, "FinalizeTitlesInstall"}, - {0x04080042, nullptr, "GetCiaFileInfo"}, - {0x040E00C2, nullptr, "InstallTitlesFinish"}, - {0x040F0000, nullptr, "InstallNATIVEFIRM"}, - {0x041000C0, nullptr, "DeleteTitle"}, - {0x04120000, nullptr, "Initialize"}, - {0x041700C0, nullptr, "MigrateAGBtoSAV"}}; +const Interface::FunctionInfo FunctionTable[] = { + {0x00010040, GetTitleCount, "GetTitleCount"}, + {0x00020082, GetTitleList, "GetTitleList"}, + {0x00030084, GetTitleInfo, "GetTitleInfo"}, + {0x000400C0, nullptr, "DeleteApplicationTitle"}, + {0x000500C0, nullptr, "GetTitleProductCode"}, + {0x000600C0, nullptr, "GetTitleExtDataId"}, + {0x00070080, DeleteTicket, "DeleteTicket"}, + {0x00080000, GetTicketCount, "GetTicketCount"}, + {0x00090082, GetTicketList, "GetTicketList"}, + {0x000A0000, nullptr, "GetDeviceID"}, + {0x000D0084, nullptr, "GetPendingTitleInfo"}, + {0x000E00C0, nullptr, "DeletePendingTitle"}, + {0x00140040, nullptr, "FinalizePendingTitles"}, + {0x00150040, nullptr, "DeleteAllPendingTitles"}, + {0x00180080, nullptr, "InitializeTitleDatabase"}, + {0x00190040, nullptr, "ReloadDBS"}, + {0x001A00C0, nullptr, "GetDSiWareExportSize"}, + {0x001B0144, nullptr, "ExportDSiWare"}, + {0x001C0084, nullptr, "ImportDSiWare"}, + {0x00230080, nullptr, "TitleIDListGetTotal2"}, + {0x002400C2, nullptr, "GetTitleIDList2"}, + {0x04010080, nullptr, "InstallFIRM"}, + {0x04020040, nullptr, "StartInstallCIADB0"}, + {0x04030000, nullptr, "StartInstallCIADB1"}, + {0x04040002, nullptr, "AbortCIAInstall"}, + {0x04050002, nullptr, "CloseCIAFinalizeInstall"}, + {0x04060002, nullptr, "CloseCIA"}, + {0x040700C2, nullptr, "FinalizeTitlesInstall"}, + {0x04080042, nullptr, "GetCiaFileInfo"}, + {0x040E00C2, nullptr, "InstallTitlesFinish"}, + {0x040F0000, nullptr, "InstallNATIVEFIRM"}, + {0x041000C0, nullptr, "DeleteTitle"}, + {0x04120000, nullptr, "Initialize"}, + {0x041700C0, nullptr, "MigrateAGBtoSAV"}, +}; AM_U_Interface::AM_U_Interface() { Register(FunctionTable); diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index c798e8752..dfc1e9c08 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -90,10 +90,8 @@ void GetSharedFont(Service::Interface* self) { cmd_buff[0] = IPC::MakeHeader(0x44, 2, 2); cmd_buff[1] = RESULT_SUCCESS.raw; // No error // Since the SharedMemory interface doesn't provide the address at which the memory was - // allocated, - // the real APT service calculates this address by scanning the entire address space (using - // svcQueryMemory) - // and searches for an allocation of the same size as the Shared Font. + // allocated, the real APT service calculates this address by scanning the entire address space + // (using svcQueryMemory) and searches for an allocation of the same size as the Shared Font. cmd_buff[2] = target_address; cmd_buff[3] = IPC::CopyHandleDesc(); cmd_buff[4] = Kernel::g_handle_table.Create(shared_font_mem).MoveFrom(); diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index fe8b8a7b8..7597b0d3e 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -183,12 +183,10 @@ void GetAppletInfo(Service::Interface* self); /** * APT::IsRegistered service function. This returns whether the specified AppID is registered with - * NS yet. - * An AppID is "registered" once the process associated with the AppID uses APT:Enable. Home Menu - * uses this - * command to determine when the launched process is running and to determine when to stop using GSP - * etc, - * while displaying the "Nintendo 3DS" loading screen. + * NS yet. An AppID is "registered" once the process associated with the AppID uses APT:Enable. Home + * Menu uses this command to determine when the launched process is running and to determine when to + * stop using GSP, etc., while displaying the "Nintendo 3DS" loading screen. + * * Inputs: * 1 : AppID * Outputs: @@ -264,10 +262,10 @@ void GlanceParameter(Service::Interface* self); * (same flag cleared by APT:ReceiveParameter). * Inputs: * 1 : Flag, when non-zero NS will compare the word after this one with a field in the NS - * state. + * state. * 2 : Unknown, this is the same as the first unknown field returned by APT:ReceiveParameter. * 3 : Flag, when non-zero NS will compare the word after this one with a field in the NS - * state. + * state. * 4 : AppID * Outputs: * 0 : Return header diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 7d47d7675..09198d52b 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt_a.h" +#include "core/hle/service/apt/apt.h" namespace Service { namespace APT { @@ -36,7 +36,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00550040, SetScreenCapPostPermission, "SetScreenCapPostPermission"}, {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, - {0x01020000, CheckNew3DS, "CheckNew3DS"}}; + {0x01020000, CheckNew3DS, "CheckNew3DS"}, +}; APT_A_Interface::APT_A_Interface() { Register(FunctionTable); diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index 76e71669c..f5afb78e8 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt_s.h" +#include "core/hle/service/apt/apt.h" namespace Service { namespace APT { @@ -96,7 +96,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x00580002, nullptr, "GetProgramID"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, - {0x01020000, CheckNew3DS, "CheckNew3DS"}}; + {0x01020000, CheckNew3DS, "CheckNew3DS"}, +}; APT_S_Interface::APT_S_Interface() { Register(FunctionTable); diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 9c6223dd7..184534b01 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt_u.h" +#include "core/hle/service/apt/apt.h" namespace Service { namespace APT { @@ -96,7 +96,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00560000, GetScreenCapPostPermission, "GetScreenCapPostPermission"}, {0x00580002, nullptr, "GetProgramID"}, {0x01010000, CheckNew3DSApp, "CheckNew3DSApp"}, - {0x01020000, CheckNew3DS, "CheckNew3DS"}}; + {0x01020000, CheckNew3DS, "CheckNew3DS"}, +}; APT_U_Interface::APT_U_Interface() { Register(FunctionTable); diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp index 867b31fbf..757a8c2c7 100644 --- a/src/core/hle/service/boss/boss.cpp +++ b/src/core/hle/service/boss/boss.cpp @@ -17,8 +17,7 @@ void Init() { AddService(new BOSS_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace BOSS diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index a87183493..ec9b835f1 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -24,14 +24,31 @@ enum class CameraSelect : u8 { In1Out1 = Out1 | In1, Out1Out2 = Out1 | Out2, In1Out2 = In1 | Out2, - All = Out1 | In1 | Out2 + All = Out1 | In1 | Out2, }; -enum class Effect : u8 { None = 0, Mono = 1, Sepia = 2, Negative = 3, Negafilm = 4, Sepia01 = 5 }; +enum class Effect : u8 { + None = 0, + Mono = 1, + Sepia = 2, + Negative = 3, + Negafilm = 4, + Sepia01 = 5, +}; -enum class Context : u8 { None = 0, A = 1, B = 2, Both = A | B }; +enum class Context : u8 { + None = 0, + A = 1, + B = 2, + Both = A | B, +}; -enum class Flip : u8 { None = 0, Horizontal = 1, Vertical = 2, Reverse = 3 }; +enum class Flip : u8 { + None = 0, + Horizontal = 1, + Vertical = 2, + Reverse = 3, +}; enum class Size : u8 { VGA = 0, @@ -42,7 +59,7 @@ enum class Size : u8 { DS_LCD = 5, DS_LCDx4 = 6, CTR_TOP_LCD = 7, - CTR_BOTTOM_LCD = QVGA + CTR_BOTTOM_LCD = QVGA, }; enum class FrameRate : u8 { @@ -58,10 +75,14 @@ enum class FrameRate : u8 { Rate_30_To_5 = 9, Rate_15_To_10 = 10, Rate_20_To_10 = 11, - Rate_30_To_10 = 12 + Rate_30_To_10 = 12, }; -enum class ShutterSoundType : u8 { Normal = 0, Movie = 1, MovieEnd = 2 }; +enum class ShutterSoundType : u8 { + Normal = 0, + Movie = 1, + MovieEnd = 2, +}; enum class WhiteBalance : u8 { BalanceAuto = 0, @@ -77,10 +98,16 @@ enum class WhiteBalance : u8 { BalanceDaylight = Balance5200K, BalanceCloudy = Balance6000K, BalanceHorizon = Balance6000K, - BalanceShade = Balance7000K + BalanceShade = Balance7000K, }; -enum class PhotoMode : u8 { Normal = 0, Portrait = 1, Landscape = 2, Nightview = 3, Letter0 = 4 }; +enum class PhotoMode : u8 { + Normal = 0, + Portrait = 1, + Landscape = 2, + Nightview = 3, + Letter0 = 4, +}; enum class LensCorrection : u8 { Off = 0, @@ -88,7 +115,7 @@ enum class LensCorrection : u8 { On90 = 2, Dark = Off, Normal = On70, - Bright = On90 + Bright = On90, }; enum class Contrast : u8 { @@ -105,10 +132,13 @@ enum class Contrast : u8 { Pattern11 = 11, Low = Pattern05, Normal = Pattern06, - High = Pattern07 + High = Pattern07, }; -enum class OutputFormat : u8 { YUV422 = 0, RGB565 = 1 }; +enum class OutputFormat : u8 { + YUV422 = 0, + RGB565 = 1, +}; /// Stereo camera calibration data. struct StereoCameraCalibrationData { diff --git a/src/core/hle/service/cam/cam_u.cpp b/src/core/hle/service/cam/cam_u.cpp index af2123e5b..125aa7d1f 100644 --- a/src/core/hle/service/cam/cam_u.cpp +++ b/src/core/hle/service/cam/cam_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_u.h" +#include "core/hle/service/cam/cam.h" namespace Service { namespace CAM { diff --git a/src/core/hle/service/cecd/cecd_u.cpp b/src/core/hle/service/cecd/cecd_u.cpp index 4b747de7b..f220bba12 100644 --- a/src/core/hle/service/cecd/cecd_u.cpp +++ b/src/core/hle/service/cecd/cecd_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cecd/cecd.h" #include "core/hle/service/cecd/cecd_u.h" +#include "core/hle/service/cecd/cecd.h" namespace Service { namespace CECD { diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index fe97a69d1..aff033bde 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -101,8 +101,9 @@ static const ConsoleCountryInfo COUNTRY_INFO = {{0, 0, 0}, UNITED_STATES_COUNTRY * Thanks Normmatt for providing this information */ static const std::array STEREO_CAMERA_SETTINGS = { - {62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, 10.0f, 5.0f, 55.58000183105469f, - 21.56999969482422f}}; + 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, + 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f, +}; static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes"); @@ -110,8 +111,9 @@ static const u32 CONFIG_SAVEFILE_SIZE = 0x8000; static std::array cfg_config_file_buffer; static Service::FS::ArchiveHandle cfg_system_save_data_archive; -static const std::vector cfg_system_savedata_id = {0x00, 0x00, 0x00, 0x00, - 0x17, 0x00, 0x01, 0x00}; +static const std::vector cfg_system_savedata_id = { + 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x01, 0x00, +}; void GetCountryCodeString(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); @@ -528,8 +530,7 @@ void Init() { LoadConfigNANDSaveFile(); } -void Shutdown() { -} +void Shutdown() {} void SetUsername(const std::u16string& name) { ASSERT(name.size() <= 10); diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index 8cb231d72..c7c2ab41d 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h @@ -79,7 +79,7 @@ static const std::array country_codes = {{ C("CN"), 0, 0, 0, 0, 0, 0, 0, // 160-167 C("AE"), C("IN"), C("EG"), C("OM"), C("QA"), C("KW"), C("SA"), C("SY"), // 168-175 C("BH"), C("JO"), 0, 0, 0, 0, 0, 0, // 176-183 - C("SM"), C("VA"), C("BM") // 184-186 + C("SM"), C("VA"), C("BM"), // 184-186 }}; /** @@ -218,8 +218,9 @@ void FormatConfig(Service::Interface* self); /** * Reads a block with the specified id and flag from the Config savegame buffer - * and writes the output to output. - * The input size must match exactly the size of the requested block + * and writes the output to output. The input size must match exactly the size of the requested + * block. + * * @param block_id The id of the block we want to read * @param size The size of the block we want to read * @param flag The requested block must have this flag set @@ -230,8 +231,8 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, void* output); /** * Reads data from input and writes to a block with the specified id and flag - * in the Config savegame buffer. - * The input size must match exactly the size of the target block + * in the Config savegame buffer. The input size must match exactly the size of the target block. + * * @param block_id The id of the block we want to write * @param size The size of the block we want to write * @param flag The target block must have this flag set @@ -242,8 +243,8 @@ ResultCode SetConfigInfoBlock(u32 block_id, u32 size, u32 flag, const void* inpu /** * Creates a block with the specified id and writes the input data to the cfg savegame buffer in - * memory. - * The config savegame file in the filesystem is not updated. + * memory. The config savegame file in the filesystem is not updated. + * * @param block_id The id of the block we want to create * @param size The size of the block we want to create * @param flags The flags of the new block diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp index 2ff52c8b8..ed0217e53 100644 --- a/src/core/hle/service/cfg/cfg_i.cpp +++ b/src/core/hle/service/cfg/cfg_i.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_i.h" +#include "core/hle/service/cfg/cfg.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/cfg/cfg_s.cpp b/src/core/hle/service/cfg/cfg_s.cpp index eed26dec7..51e7b9752 100644 --- a/src/core/hle/service/cfg/cfg_s.cpp +++ b/src/core/hle/service/cfg/cfg_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_s.h" +#include "core/hle/service/cfg/cfg.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp index f28217134..3f812291b 100644 --- a/src/core/hle/service/cfg/cfg_u.cpp +++ b/src/core/hle/service/cfg/cfg_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_u.h" +#include "core/hle/service/cfg/cfg.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/dlp/dlp.cpp b/src/core/hle/service/dlp/dlp.cpp index fd124e819..8f4b67a5d 100644 --- a/src/core/hle/service/dlp/dlp.cpp +++ b/src/core/hle/service/dlp/dlp.cpp @@ -17,8 +17,7 @@ void Init() { AddService(new DLP_SRVR_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace DLP } // namespace Service diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index 2cd8269de..a23f5896d 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -173,7 +173,9 @@ static void ThrowFatalError(Service::Interface* self) { cmd_buff[1] = 0; // No error } -const Interface::FunctionInfo FunctionTable[] = {{0x00010800, ThrowFatalError, "ThrowFatalError"}}; +const Interface::FunctionInfo FunctionTable[] = { + {0x00010800, ThrowFatalError, "ThrowFatalError"}, +}; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp index 1e9fe178f..050665b48 100644 --- a/src/core/hle/service/frd/frd.cpp +++ b/src/core/hle/service/frd/frd.cpp @@ -108,8 +108,7 @@ void Init() { AddService(new FRD_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace FRD diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp index bd1c9c16b..92b53f2ef 100644 --- a/src/core/hle/service/frd/frd_u.cpp +++ b/src/core/hle/service/frd/frd_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/frd/frd.h" #include "core/hle/service/frd/frd_u.h" +#include "core/hle/service/frd/frd.h" namespace Service { namespace FRD { diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 1b851eade..77fe5ab6c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -90,11 +90,9 @@ enum class DirectoryCommand : u32 { }; File::File(std::unique_ptr&& backend, const FileSys::Path& path) - : path(path), priority(0), backend(std::move(backend)) { -} + : path(path), priority(0), backend(std::move(backend)) {} -File::~File() { -} +File::~File() {} ResultVal File::SyncRequest() { u32* cmd_buff = Kernel::GetCommandBuffer(); @@ -205,11 +203,9 @@ ResultVal File::SyncRequest() { Directory::Directory(std::unique_ptr&& backend, const FileSys::Path& path) - : path(path), backend(std::move(backend)) { -} + : path(path), backend(std::move(backend)) {} -Directory::~Directory() { -} +Directory::~Directory() {} ResultVal Directory::SyncRequest() { u32* cmd_buff = Kernel::GetCommandBuffer(); diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index a0adad634..605832214 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -968,7 +968,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x086700C4, nullptr, "ControlSecureSave"}, {0x08680000, nullptr, "GetMediaType"}, {0x08690000, nullptr, "GetNandEraseCount"}, - {0x086A0082, nullptr, "ReadNandReport"}}; + {0x086A0082, nullptr, "ReadNandReport"}, +}; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index b273aac47..2dff1e16c 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -29,10 +29,9 @@ const static u32 REGS_BEGIN = 0x1EB00000; namespace GSP_GPU { -const ResultCode - ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED(ErrorDescription::OutofRangeOrMisalignedAddress, - ErrorModule::GX, ErrorSummary::InvalidArgument, - ErrorLevel::Usage); // 0xE0E02A01 +const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED( + ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument, + ErrorLevel::Usage); // 0xE0E02A01 const ResultCode ERR_GSP_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX, ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E02BF2 diff --git a/src/core/hle/service/gsp_lcd.cpp b/src/core/hle/service/gsp_lcd.cpp index 3922cd197..b916dd759 100644 --- a/src/core/hle/service/gsp_lcd.cpp +++ b/src/core/hle/service/gsp_lcd.cpp @@ -9,11 +9,15 @@ namespace GSP_LCD { -const Interface::FunctionInfo FunctionTable[] = {{0x000F0000, nullptr, "PowerOnAllBacklights"}, - {0x00100000, nullptr, "PowerOffAllBacklights"}, - {0x00110040, nullptr, "PowerOnBacklight"}, - {0x00120040, nullptr, "PowerOffBacklight"}, - {0x00130040, nullptr, "SetLedForceOff"}}; +const Interface::FunctionInfo FunctionTable[] = { + // clang-format off + {0x000F0000, nullptr, "PowerOnAllBacklights"}, + {0x00100000, nullptr, "PowerOffAllBacklights"}, + {0x00110040, nullptr, "PowerOnBacklight"}, + {0x00120040, nullptr, "PowerOffBacklight"}, + {0x00130040, nullptr, "SetLedForceOff"}, + // clang-format on +}; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index d915a3105..5a2edd3c0 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -40,11 +40,10 @@ static int enable_accelerometer_count = 0; // positive means enabled static int enable_gyroscope_count = 0; // positive means enabled static PadState GetCirclePadDirectionState(s16 circle_pad_x, s16 circle_pad_y) { - constexpr float TAN30 = 0.577350269, - TAN60 = - 1 / TAN30; // 30 degree and 60 degree are angular thresholds for directions - constexpr int CIRCLE_PAD_THRESHOLD_SQUARE = - 40 * 40; // a circle pad radius greater than 40 will trigger circle pad direction + // 30 degree and 60 degree are angular thresholds for directions + constexpr float TAN30 = 0.577350269, TAN60 = 1 / TAN30; + // a circle pad radius greater than 40 will trigger circle pad direction + constexpr int CIRCLE_PAD_THRESHOLD_SQUARE = 40 * 40; PadState state; state.hex = 0; diff --git a/src/core/hle/service/hid/hid_spvr.cpp b/src/core/hle/service/hid/hid_spvr.cpp index 09007e304..00a0902c8 100644 --- a/src/core/hle/service/hid/hid_spvr.cpp +++ b/src/core/hle/service/hid/hid_spvr.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/hid/hid.h" #include "core/hle/service/hid/hid_spvr.h" +#include "core/hle/service/hid/hid.h" namespace Service { namespace HID { diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp index 42591543c..433e175bb 100644 --- a/src/core/hle/service/hid/hid_user.cpp +++ b/src/core/hle/service/hid/hid_user.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/hid/hid.h" #include "core/hle/service/hid/hid_user.h" +#include "core/hle/service/hid/hid.h" namespace Service { namespace HID { diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp index 1f10ebd3d..5e7a011ff 100644 --- a/src/core/hle/service/ir/ir_rst.cpp +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ir/ir.h" #include "core/hle/service/ir/ir_rst.h" +#include "core/hle/service/ir/ir.h" namespace Service { namespace IR { diff --git a/src/core/hle/service/ir/ir_u.cpp b/src/core/hle/service/ir/ir_u.cpp index be4049da9..429615f31 100644 --- a/src/core/hle/service/ir/ir_u.cpp +++ b/src/core/hle/service/ir/ir_u.cpp @@ -8,15 +8,26 @@ namespace Service { namespace IR { const Interface::FunctionInfo FunctionTable[] = { - {0x00010000, nullptr, "Initialize"}, {0x00020000, nullptr, "Shutdown"}, - {0x00030042, nullptr, "StartSendTransfer"}, {0x00040000, nullptr, "WaitSendTransfer"}, - {0x000500C2, nullptr, "StartRecvTransfer"}, {0x00060000, nullptr, "WaitRecvTransfer"}, - {0x00070080, nullptr, "GetRecvTransferCount"}, {0x00080000, nullptr, "GetSendState"}, - {0x00090040, nullptr, "SetBitRate"}, {0x000A0000, nullptr, "GetBitRate"}, - {0x000B0040, nullptr, "SetIRLEDState"}, {0x000C0000, nullptr, "GetIRLEDRecvState"}, - {0x000D0000, nullptr, "GetSendFinishedEvent"}, {0x000E0000, nullptr, "GetRecvFinishedEvent"}, - {0x000F0000, nullptr, "GetTransferState"}, {0x00100000, nullptr, "GetErrorStatus"}, - {0x00110040, nullptr, "SetSleepModeActive"}, {0x00120040, nullptr, "SetSleepModeState"}, + // clang-format off + {0x00010000, nullptr, "Initialize"}, + {0x00020000, nullptr, "Shutdown"}, + {0x00030042, nullptr, "StartSendTransfer"}, + {0x00040000, nullptr, "WaitSendTransfer"}, + {0x000500C2, nullptr, "StartRecvTransfer"}, + {0x00060000, nullptr, "WaitRecvTransfer"}, + {0x00070080, nullptr, "GetRecvTransferCount"}, + {0x00080000, nullptr, "GetSendState"}, + {0x00090040, nullptr, "SetBitRate"}, + {0x000A0000, nullptr, "GetBitRate"}, + {0x000B0040, nullptr, "SetIRLEDState"}, + {0x000C0000, nullptr, "GetIRLEDRecvState"}, + {0x000D0000, nullptr, "GetSendFinishedEvent"}, + {0x000E0000, nullptr, "GetRecvFinishedEvent"}, + {0x000F0000, nullptr, "GetTransferState"}, + {0x00100000, nullptr, "GetErrorStatus"}, + {0x00110040, nullptr, "SetSleepModeActive"}, + {0x00120040, nullptr, "SetSleepModeState"}, + // clang-format off }; IR_U_Interface::IR_U_Interface() { diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp index 6cff1d544..cca71a0dd 100644 --- a/src/core/hle/service/ir/ir_user.cpp +++ b/src/core/hle/service/ir/ir_user.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ir/ir.h" #include "core/hle/service/ir/ir_user.h" +#include "core/hle/service/ir/ir.h" namespace Service { namespace IR { diff --git a/src/core/hle/service/ldr_ro/cro_helper.cpp b/src/core/hle/service/ldr_ro/cro_helper.cpp index 5757a4e64..b5da9a960 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.cpp +++ b/src/core/hle/service/ldr_ro/cro_helper.cpp @@ -22,21 +22,23 @@ static ResultCode CROFormatError(u32 description) { ErrorSummary::WrongArgument, ErrorLevel::Permanent); } -const std::array CROHelper::ENTRY_SIZE{ - {1, // code - 1, // data - 1, // module name - sizeof(SegmentEntry), sizeof(ExportNamedSymbolEntry), sizeof(ExportIndexedSymbolEntry), - 1, // export strings - sizeof(ExportTreeEntry), sizeof(ImportModuleEntry), sizeof(ExternalRelocationEntry), - sizeof(ImportNamedSymbolEntry), sizeof(ImportIndexedSymbolEntry), - sizeof(ImportAnonymousSymbolEntry), - 1, // import strings - sizeof(StaticAnonymousSymbolEntry), sizeof(InternalRelocationEntry), - sizeof(StaticRelocationEntry)}}; - -const std::array CROHelper::FIX_BARRIERS{ - {Fix0Barrier, Fix1Barrier, Fix2Barrier, Fix3Barrier}}; +const std::array CROHelper::ENTRY_SIZE{{ + 1, // code + 1, // data + 1, // module name + sizeof(SegmentEntry), sizeof(ExportNamedSymbolEntry), sizeof(ExportIndexedSymbolEntry), + 1, // export strings + sizeof(ExportTreeEntry), sizeof(ImportModuleEntry), sizeof(ExternalRelocationEntry), + sizeof(ImportNamedSymbolEntry), sizeof(ImportIndexedSymbolEntry), + sizeof(ImportAnonymousSymbolEntry), + 1, // import strings + sizeof(StaticAnonymousSymbolEntry), sizeof(InternalRelocationEntry), + sizeof(StaticRelocationEntry), +}}; + +const std::array CROHelper::FIX_BARRIERS{{ + Fix0Barrier, Fix1Barrier, Fix2Barrier, Fix3Barrier, +}}; VAddr CROHelper::SegmentTagToAddress(SegmentTag segment_tag) const { u32 segment_num = GetField(SegmentNum); @@ -204,13 +206,14 @@ ResultCode CROHelper::RebaseHeader(u32 cro_size) { return error; // verifies that all offsets are in the correct order - constexpr std::array OFFSET_ORDER = { - {CodeOffset, ModuleNameOffset, SegmentTableOffset, ExportNamedSymbolTableOffset, - ExportTreeTableOffset, ExportIndexedSymbolTableOffset, ExportStringsOffset, - ImportModuleTableOffset, ExternalRelocationTableOffset, ImportNamedSymbolTableOffset, - ImportIndexedSymbolTableOffset, ImportAnonymousSymbolTableOffset, ImportStringsOffset, - StaticAnonymousSymbolTableOffset, InternalRelocationTableOffset, - StaticRelocationTableOffset, DataOffset, FileSize}}; + constexpr std::array OFFSET_ORDER = {{ + CodeOffset, ModuleNameOffset, SegmentTableOffset, ExportNamedSymbolTableOffset, + ExportTreeTableOffset, ExportIndexedSymbolTableOffset, ExportStringsOffset, + ImportModuleTableOffset, ExternalRelocationTableOffset, ImportNamedSymbolTableOffset, + ImportIndexedSymbolTableOffset, ImportAnonymousSymbolTableOffset, ImportStringsOffset, + StaticAnonymousSymbolTableOffset, InternalRelocationTableOffset, + StaticRelocationTableOffset, DataOffset, FileSize, + }}; u32 prev_offset = GetField(OFFSET_ORDER[0]); u32 cur_offset; diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h index e4457d4be..e1b8221bd 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.h +++ b/src/core/hle/service/ldr_ro/cro_helper.h @@ -40,8 +40,7 @@ static constexpr u32 CRO_HASH_SIZE = 0x80; /// Represents a loaded module (CRO) with interfaces manipulating it. class CROHelper final { public: - explicit CROHelper(VAddr cro_address) : module_address(cro_address) { - } + explicit CROHelper(VAddr cro_address) : module_address(cro_address) {} std::string ModuleName() const { return Memory::ReadCString(GetField(ModuleNameOffset), GetField(ModuleNameSize)); @@ -152,8 +151,7 @@ private: /** * Each item in this enum represents a u32 field in the header begin from address+0x80, - * successively. - * We don't directly use a struct here, to avoid GetPointer, reinterpret_cast, or + * successively. We don't directly use a struct here, to avoid GetPointer, reinterpret_cast, or * Read/WriteBlock repeatedly. */ enum HeaderField { @@ -234,8 +232,7 @@ private: BitField<4, 28, u32_le> offset_into_segment; SegmentTag() = default; - explicit SegmentTag(u32 raw_) : raw(raw_) { - } + explicit SegmentTag(u32 raw_) : raw(raw_) {} }; /// Information of a segment in this module. diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp index ae5d3921f..a8fc2c015 100644 --- a/src/core/hle/service/ldr_ro/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp @@ -750,11 +750,17 @@ static void Shutdown(Service::Interface* self) { } const Interface::FunctionInfo FunctionTable[] = { - {0x000100C2, Initialize, "Initialize"}, {0x00020082, LoadCRR, "LoadCRR"}, - {0x00030042, UnloadCRR, "UnloadCRR"}, {0x000402C2, LoadCRO, "LoadCRO"}, - {0x000500C2, UnloadCRO, "UnloadCRO"}, {0x00060042, LinkCRO, "LinkCRO"}, - {0x00070042, UnlinkCRO, "UnlinkCRO"}, {0x00080042, Shutdown, "Shutdown"}, + // clang-format off + {0x000100C2, Initialize, "Initialize"}, + {0x00020082, LoadCRR, "LoadCRR"}, + {0x00030042, UnloadCRR, "UnloadCRR"}, + {0x000402C2, LoadCRO, "LoadCRO"}, + {0x000500C2, UnloadCRO, "UnloadCRO"}, + {0x00060042, LinkCRO, "LinkCRO"}, + {0x00070042, UnlinkCRO, "UnlinkCRO"}, + {0x00080042, Shutdown, "Shutdown"}, {0x000902C2, LoadCRO, "LoadCRO_New"}, + // clang-format on }; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/ndm/ndm.cpp b/src/core/hle/service/ndm/ndm.cpp index 9f1536aef..fcfa4b336 100644 --- a/src/core/hle/service/ndm/ndm.cpp +++ b/src/core/hle/service/ndm/ndm.cpp @@ -11,12 +11,16 @@ namespace Service { namespace NDM { -enum : u32 { DEFAULT_RETRY_INTERVAL = 10, DEFAULT_SCAN_INTERVAL = 30 }; +enum : u32 { + DEFAULT_RETRY_INTERVAL = 10, + DEFAULT_SCAN_INTERVAL = 30, +}; static DaemonMask daemon_bit_mask = DaemonMask::Default; static DaemonMask default_daemon_bit_mask = DaemonMask::Default; -static std::array daemon_status = {DaemonStatus::Idle, DaemonStatus::Idle, - DaemonStatus::Idle, DaemonStatus::Idle}; +static std::array daemon_status = { + DaemonStatus::Idle, DaemonStatus::Idle, DaemonStatus::Idle, DaemonStatus::Idle, +}; static ExclusiveState exclusive_state = ExclusiveState::None; static u32 scan_interval = DEFAULT_SCAN_INTERVAL; static u32 retry_interval = DEFAULT_RETRY_INTERVAL; @@ -227,8 +231,7 @@ void Init() { AddService(new NDM_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace NDM } // namespace Service diff --git a/src/core/hle/service/ndm/ndm.h b/src/core/hle/service/ndm/ndm.h index fb574541d..979e7fcf1 100644 --- a/src/core/hle/service/ndm/ndm.h +++ b/src/core/hle/service/ndm/ndm.h @@ -12,7 +12,12 @@ class Interface; namespace NDM { -enum class Daemon : u32 { Cec = 0, Boss = 1, Nim = 2, Friend = 3 }; +enum class Daemon : u32 { + Cec = 0, + Boss = 1, + Nim = 2, + Friend = 3, +}; enum class DaemonMask : u32 { None = 0, @@ -21,7 +26,7 @@ enum class DaemonMask : u32 { Nim = (1 << static_cast(Daemon::Nim)), Friend = (1 << static_cast(Daemon::Friend)), Default = Cec | Friend, - All = Cec | Boss | Nim | Friend + All = Cec | Boss | Nim | Friend, }; enum class DaemonStatus : u32 { Busy = 0, Idle = 1, Suspending = 2, Suspended = 3 }; diff --git a/src/core/hle/service/ndm/ndm_u.cpp b/src/core/hle/service/ndm/ndm_u.cpp index f5c7a341a..4fc93850d 100644 --- a/src/core/hle/service/ndm/ndm_u.cpp +++ b/src/core/hle/service/ndm/ndm_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ndm/ndm.h" #include "core/hle/service/ndm/ndm_u.h" +#include "core/hle/service/ndm/ndm.h" namespace Service { namespace NDM { diff --git a/src/core/hle/service/news/news.cpp b/src/core/hle/service/news/news.cpp index 983e0777c..e09ea5681 100644 --- a/src/core/hle/service/news/news.cpp +++ b/src/core/hle/service/news/news.cpp @@ -19,8 +19,7 @@ void Init() { AddService(new NEWS_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace NEWS diff --git a/src/core/hle/service/news/news_s.cpp b/src/core/hle/service/news/news_s.cpp index dda3d0f6a..0e4b650f3 100644 --- a/src/core/hle/service/news/news_s.cpp +++ b/src/core/hle/service/news/news_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/news/news.h" #include "core/hle/service/news/news_s.h" +#include "core/hle/service/news/news.h" namespace Service { namespace NEWS { diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index f3c01d6e6..a7b76ed67 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -31,8 +31,7 @@ void Init() { AddService(new NIM_U_Interface); } -void Shutdown() { -} +void Shutdown() {} } // namespace NIM diff --git a/src/core/hle/service/nim/nim_u.cpp b/src/core/hle/service/nim/nim_u.cpp index 7e07d02e8..a4fd9781f 100644 --- a/src/core/hle/service/nim/nim_u.cpp +++ b/src/core/hle/service/nim/nim_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/nim/nim.h" #include "core/hle/service/nim/nim_u.h" +#include "core/hle/service/nim/nim.h" namespace Service { namespace NIM { diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 80fa09f5f..29b9071c8 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -144,8 +144,7 @@ void Init() { } } -void Shutdown() { -} +void Shutdown() {} } // namespace PTM } // namespace Service diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp index 693158dbf..590660f60 100644 --- a/src/core/hle/service/ptm/ptm_sysm.cpp +++ b/src/core/hle/service/ptm/ptm_sysm.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ptm/ptm.h" #include "core/hle/service/ptm/ptm_sysm.h" +#include "core/hle/service/ptm/ptm.h" namespace Service { namespace PTM { diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp index 65e868393..155e10df1 100644 --- a/src/core/hle/service/ptm/ptm_u.cpp +++ b/src/core/hle/service/ptm/ptm_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ptm/ptm.h" #include "core/hle/service/ptm/ptm_u.h" +#include "core/hle/service/ptm/ptm.h" namespace Service { namespace PTM { diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 695b286c0..302ab55b7 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -63,82 +63,84 @@ static const s32 SOCKET_ERROR_VALUE = -1; namespace SOC_U { /// Holds the translation from system network errors to 3DS network errors -static const std::unordered_map error_map = {{{E2BIG, 1}, - {ERRNO(EACCES), 2}, - {ERRNO(EADDRINUSE), 3}, - {ERRNO(EADDRNOTAVAIL), 4}, - {ERRNO(EAFNOSUPPORT), 5}, - {ERRNO(EAGAIN), 6}, - {ERRNO(EALREADY), 7}, - {ERRNO(EBADF), 8}, - {EBADMSG, 9}, - {EBUSY, 10}, - {ECANCELED, 11}, - {ECHILD, 12}, - {ERRNO(ECONNABORTED), 13}, - {ERRNO(ECONNREFUSED), 14}, - {ERRNO(ECONNRESET), 15}, - {EDEADLK, 16}, - {ERRNO(EDESTADDRREQ), 17}, - {EDOM, 18}, - {ERRNO(EDQUOT), 19}, - {EEXIST, 20}, - {ERRNO(EFAULT), 21}, - {EFBIG, 22}, - {ERRNO(EHOSTUNREACH), 23}, - {EIDRM, 24}, - {EILSEQ, 25}, - {ERRNO(EINPROGRESS), 26}, - {ERRNO(EINTR), 27}, - {ERRNO(EINVAL), 28}, - {EIO, 29}, - {ERRNO(EISCONN), 30}, - {EISDIR, 31}, - {ERRNO(ELOOP), 32}, - {ERRNO(EMFILE), 33}, - {EMLINK, 34}, - {ERRNO(EMSGSIZE), 35}, - {ERRNO(EMULTIHOP), 36}, - {ERRNO(ENAMETOOLONG), 37}, - {ERRNO(ENETDOWN), 38}, - {ERRNO(ENETRESET), 39}, - {ERRNO(ENETUNREACH), 40}, - {ENFILE, 41}, - {ERRNO(ENOBUFS), 42}, - {ENODATA, 43}, - {ENODEV, 44}, - {ENOENT, 45}, - {ENOEXEC, 46}, - {ENOLCK, 47}, - {ENOLINK, 48}, - {ENOMEM, 49}, - {ENOMSG, 50}, - {ERRNO(ENOPROTOOPT), 51}, - {ENOSPC, 52}, - {ENOSR, 53}, - {ENOSTR, 54}, - {ENOSYS, 55}, - {ERRNO(ENOTCONN), 56}, - {ENOTDIR, 57}, - {ERRNO(ENOTEMPTY), 58}, - {ERRNO(ENOTSOCK), 59}, - {ENOTSUP, 60}, - {ENOTTY, 61}, - {ENXIO, 62}, - {ERRNO(EOPNOTSUPP), 63}, - {EOVERFLOW, 64}, - {EPERM, 65}, - {EPIPE, 66}, - {EPROTO, 67}, - {ERRNO(EPROTONOSUPPORT), 68}, - {ERRNO(EPROTOTYPE), 69}, - {ERANGE, 70}, - {EROFS, 71}, - {ESPIPE, 72}, - {ESRCH, 73}, - {ERRNO(ESTALE), 74}, - {ETIME, 75}, - {ERRNO(ETIMEDOUT), 76}}}; +static const std::unordered_map error_map = {{ + {E2BIG, 1}, + {ERRNO(EACCES), 2}, + {ERRNO(EADDRINUSE), 3}, + {ERRNO(EADDRNOTAVAIL), 4}, + {ERRNO(EAFNOSUPPORT), 5}, + {ERRNO(EAGAIN), 6}, + {ERRNO(EALREADY), 7}, + {ERRNO(EBADF), 8}, + {EBADMSG, 9}, + {EBUSY, 10}, + {ECANCELED, 11}, + {ECHILD, 12}, + {ERRNO(ECONNABORTED), 13}, + {ERRNO(ECONNREFUSED), 14}, + {ERRNO(ECONNRESET), 15}, + {EDEADLK, 16}, + {ERRNO(EDESTADDRREQ), 17}, + {EDOM, 18}, + {ERRNO(EDQUOT), 19}, + {EEXIST, 20}, + {ERRNO(EFAULT), 21}, + {EFBIG, 22}, + {ERRNO(EHOSTUNREACH), 23}, + {EIDRM, 24}, + {EILSEQ, 25}, + {ERRNO(EINPROGRESS), 26}, + {ERRNO(EINTR), 27}, + {ERRNO(EINVAL), 28}, + {EIO, 29}, + {ERRNO(EISCONN), 30}, + {EISDIR, 31}, + {ERRNO(ELOOP), 32}, + {ERRNO(EMFILE), 33}, + {EMLINK, 34}, + {ERRNO(EMSGSIZE), 35}, + {ERRNO(EMULTIHOP), 36}, + {ERRNO(ENAMETOOLONG), 37}, + {ERRNO(ENETDOWN), 38}, + {ERRNO(ENETRESET), 39}, + {ERRNO(ENETUNREACH), 40}, + {ENFILE, 41}, + {ERRNO(ENOBUFS), 42}, + {ENODATA, 43}, + {ENODEV, 44}, + {ENOENT, 45}, + {ENOEXEC, 46}, + {ENOLCK, 47}, + {ENOLINK, 48}, + {ENOMEM, 49}, + {ENOMSG, 50}, + {ERRNO(ENOPROTOOPT), 51}, + {ENOSPC, 52}, + {ENOSR, 53}, + {ENOSTR, 54}, + {ENOSYS, 55}, + {ERRNO(ENOTCONN), 56}, + {ENOTDIR, 57}, + {ERRNO(ENOTEMPTY), 58}, + {ERRNO(ENOTSOCK), 59}, + {ENOTSUP, 60}, + {ENOTTY, 61}, + {ENXIO, 62}, + {ERRNO(EOPNOTSUPP), 63}, + {EOVERFLOW, 64}, + {EPERM, 65}, + {EPIPE, 66}, + {EPROTO, 67}, + {ERRNO(EPROTONOSUPPORT), 68}, + {ERRNO(EPROTOTYPE), 69}, + {ERANGE, 70}, + {EROFS, 71}, + {ESPIPE, 72}, + {ESRCH, 73}, + {ERRNO(ESTALE), 74}, + {ETIME, 75}, + {ERRNO(ETIMEDOUT), 76}, +}}; /// Converts a network error from platform-specific to 3ds-specific static int TranslateError(int error) { diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp index 47c4a8cb0..78ab922ca 100644 --- a/src/core/hle/service/ssl_c.cpp +++ b/src/core/hle/service/ssl_c.cpp @@ -79,7 +79,8 @@ const Interface::FunctionInfo FunctionTable[] = { {0x00190080, nullptr, "ContextSetClientCert"}, {0x001B0080, nullptr, "ContextClearOpt"}, {0x001E0040, nullptr, "DestroyContext"}, - {0x001F0082, nullptr, "ContextInitSharedmem"}}; + {0x001F0082, nullptr, "ContextInitSharedmem"}, +}; //////////////////////////////////////////////////////////////////////////////////////////////////// // Interface class diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 278548e0e..d3c6d073e 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -73,8 +73,8 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) { return RESULT_SUCCESS; } -ResultCode -ConversionConfiguration::SetStandardCoefficient(StandardCoefficient standard_coefficient) { +ResultCode ConversionConfiguration::SetStandardCoefficient( + StandardCoefficient standard_coefficient) { size_t index = static_cast(standard_coefficient); if (index >= ARRAY_SIZE(standard_coefficients)) { return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM, diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index db224c9aa..71f44cbc4 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -82,8 +82,7 @@ template void Write(u32 addr, const u16 data); template void Write(u32 addr, const u8 data); /// Update hardware -void Update() { -} +void Update() {} /// Initialize hardware void Init() { diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp index 5a68d7e65..838b14163 100644 --- a/src/core/hw/y2r.cpp +++ b/src/core/hw/y2r.cpp @@ -61,7 +61,7 @@ static void ConvertYUVToRGB(InputFormat input_format, const u8* input_Y, const u s32 cY = c[0] * Y; s32 r = cY + c[1] * V; - s32 g = cY - c[3] * U - c[2] * V; + s32 g = cY - c[2] * V - c[3] * U; s32 b = cY + c[4] * U; const s32 rounding_offset = 0x18; @@ -144,16 +144,30 @@ static void SendData(const u32* input, ConversionBuffer& buf, int amount_of_data } } -static const u8 linear_lut[64] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, +static const u8 linear_lut[TILE_SIZE] = { + // clang-format off + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + // clang-format on }; -static const u8 morton_lut[64] = { - 0, 1, 4, 5, 16, 17, 20, 21, 2, 3, 6, 7, 18, 19, 22, 23, 8, 9, 12, 13, 24, 25, - 28, 29, 10, 11, 14, 15, 26, 27, 30, 31, 32, 33, 36, 37, 48, 49, 52, 53, 34, 35, 38, 39, - 50, 51, 54, 55, 40, 41, 44, 45, 56, 57, 60, 61, 42, 43, 46, 47, 58, 59, 62, 63, +static const u8 morton_lut[TILE_SIZE] = { + // clang-format off + 0, 1, 4, 5, 16, 17, 20, 21, + 2, 3, 6, 7, 18, 19, 22, 23, + 8, 9, 12, 13, 24, 25, 28, 29, + 10, 11, 14, 15, 26, 27, 30, 31, + 32, 33, 36, 37, 48, 49, 52, 53, + 34, 35, 38, 39, 50, 51, 54, 55, + 40, 41, 44, 45, 56, 57, 60, 61, + 42, 43, 46, 47, 58, 59, 62, 63, + // clang-format on }; static void RotateTile0(const ImageTile& input, ImageTile& output, int height, diff --git a/src/core/loader/3dsx.h b/src/core/loader/3dsx.h index 09a788a1c..8d15ba555 100644 --- a/src/core/loader/3dsx.h +++ b/src/core/loader/3dsx.h @@ -19,8 +19,7 @@ class AppLoader_THREEDSX final : public AppLoader { public: AppLoader_THREEDSX(FileUtil::IOFile&& file, const std::string& filename, const std::string& filepath) - : AppLoader(std::move(file)), filename(std::move(filename)), filepath(filepath) { - } + : AppLoader(std::move(file)), filename(std::move(filename)), filepath(filepath) {} /** * Returns the type of the file diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 0b1456c64..04a9b482d 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h @@ -18,8 +18,7 @@ namespace Loader { class AppLoader_ELF final : public AppLoader { public: AppLoader_ELF(FileUtil::IOFile&& file, std::string filename) - : AppLoader(std::move(file)), filename(std::move(filename)) { - } + : AppLoader(std::move(file)), filename(std::move(filename)) {} /** * Returns the type of the file diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 5f48d2ffe..fdfee835c 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -81,10 +81,8 @@ constexpr u32 MakeMagic(char a, char b, char c, char d) { /// Interface for loading an application class AppLoader : NonCopyable { public: - AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) { - } - virtual ~AppLoader() { - } + AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) {} + virtual ~AppLoader() {} /** * Returns the type of this file diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 0cd70f70c..f53f8100e 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -164,8 +164,7 @@ namespace Loader { class AppLoader_NCCH final : public AppLoader { public: AppLoader_NCCH(FileUtil::IOFile&& file, const std::string& filepath) - : AppLoader(std::move(file)), filepath(filepath) { - } + : AppLoader(std::move(file)), filepath(filepath) {} /** * Returns the type of the file diff --git a/src/core/tracer/citrace.h b/src/core/tracer/citrace.h index ac26e872b..215f86359 100644 --- a/src/core/tracer/citrace.h +++ b/src/core/tracer/citrace.h @@ -76,7 +76,12 @@ struct CTMemoryLoad { struct CTRegisterWrite { u32 physical_address; - enum : u32 { SIZE_8 = 0xD1, SIZE_16 = 0xD2, SIZE_32 = 0xD3, SIZE_64 = 0xD4 } size; + enum : u32 { + SIZE_8 = 0xD1, + SIZE_16 = 0xD2, + SIZE_32 = 0xD3, + SIZE_64 = 0xD4, + } size; // TODO: Make it clearer which bits of this member are used for sizes other than 32 bits u64 value; diff --git a/src/core/tracer/recorder.cpp b/src/core/tracer/recorder.cpp index 8fd0018c4..11a289b2c 100644 --- a/src/core/tracer/recorder.cpp +++ b/src/core/tracer/recorder.cpp @@ -12,8 +12,7 @@ namespace CiTrace { -Recorder::Recorder(const InitialState& initial_state) : initial_state(initial_state) { -} +Recorder::Recorder(const InitialState& initial_state) : initial_state(initial_state) {} void Recorder::Finish(const std::string& filename) { // Setup CiTrace header diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index 747285866..82178d249 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -30,8 +30,7 @@ public: ClippingEdge(Math::Vec4 coeffs, Math::Vec4 bias = Math::Vec4( float24::FromFloat32(0), float24::FromFloat32(0), float24::FromFloat32(0), float24::FromFloat32(0))) - : coeffs(coeffs), bias(bias) { - } + : coeffs(coeffs), bias(bias) {} bool IsInside(const OutputVertex& vertex) const { return Math::Dot(vertex.pos + bias, coeffs) <= float24::FromFloat32(0); diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 415b5f74c..04a4ee3a2 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -44,7 +44,8 @@ static u32 default_attr_write_buffer[3]; // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF static const u32 expand_bits_to_bytes[] = { 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, - 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff}; + 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff, +}; MICROPROFILE_DEFINE(GPU_Drawing, "GPU", "Drawing", MP_RGB(50, 50, 240)); diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 1cb868ead..194e5833c 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -155,7 +155,8 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, {OutputAttributes::TEXCOORD2_V, {OutputRegisterInfo::TEXCOORD2, 2}}, {OutputAttributes::VIEW_X, {OutputRegisterInfo::VIEW, 1}}, {OutputAttributes::VIEW_Y, {OutputRegisterInfo::VIEW, 2}}, - {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}}}; + {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}}, + }; for (const auto& semantic : std::vector{ output_attributes[i].map_x, output_attributes[i].map_y, output_attributes[i].map_z, @@ -529,14 +530,16 @@ const Math::Vec4 LookupTexture(const u8* source, int x, int y, const Texture unsigned table_index = static_cast((x < 2) ? table_index_1.Value() : table_index_2.Value()); - static const std::array, 8> etc1_modifier_table = {{{{2, 8}}, - {{5, 17}}, - {{9, 29}}, - {{13, 42}}, - {{18, 60}}, - {{24, 80}}, - {{33, 106}}, - {{47, 183}}}}; + static const std::array, 8> etc1_modifier_table = {{ + {{2, 8}}, + {{5, 17}}, + {{9, 29}}, + {{13, 42}}, + {{18, 60}}, + {{24, 80}}, + {{33, 106}}, + {{47, 183}}, + }}; int modifier = etc1_modifier_table.at(table_index).at(GetTableSubIndex(texel)); if (GetNegationFlag(texel)) @@ -713,9 +716,9 @@ static std::string GetTevStageConfigSourceString(const Pica::Regs::TevStageConfi return src_it->second; } -static std::string -GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& source, - const Pica::Regs::TevStageConfig::ColorModifier modifier) { +static std::string GetTevStageConfigColorSourceString( + const Pica::Regs::TevStageConfig::Source& source, + const Pica::Regs::TevStageConfig::ColorModifier modifier) { using ColorModifier = Pica::Regs::TevStageConfig::ColorModifier; static const std::map color_modifier_map = { {ColorModifier::SourceColor, "%source.rgb"}, @@ -739,9 +742,9 @@ GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& sou return ReplacePattern(modifier_str, "%source", src_str); } -static std::string -GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& source, - const Pica::Regs::TevStageConfig::AlphaModifier modifier) { +static std::string GetTevStageConfigAlphaSourceString( + const Pica::Regs::TevStageConfig::Source& source, + const Pica::Regs::TevStageConfig::AlphaModifier modifier) { using AlphaModifier = Pica::Regs::TevStageConfig::AlphaModifier; static const std::map alpha_modifier_map = { {AlphaModifier::SourceAlpha, "%source.a"}, @@ -763,8 +766,8 @@ GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& sou return ReplacePattern(modifier_str, "%source", src_str); } -static std::string -GetTevStageConfigOperationString(const Pica::Regs::TevStageConfig::Operation& operation) { +static std::string GetTevStageConfigOperationString( + const Pica::Regs::TevStageConfig::Operation& operation) { using Operation = Pica::Regs::TevStageConfig::Operation; static const std::map combiner_map = { {Operation::Replace, "%source1"}, diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 1a58f40ff..fe3ed247d 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -87,15 +87,13 @@ public: * @param data Optional data pointer (if unused, this is a nullptr) * @note This function will perform nothing unless it is overridden in the child class. */ - virtual void OnPicaBreakPointHit(Event, void*) { - } + virtual void OnPicaBreakPointHit(Event, void*) {} /** * Action to perform when emulation is resumed from a breakpoint. * @note This function will perform nothing unless it is overridden in the child class. */ - virtual void OnPicaResume() { - } + virtual void OnPicaResume() {} protected: /** diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index e3ba80d8f..aea391619 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -15,8 +15,7 @@ public: // Base class for all objects which need to be notified about GPU events class DebuggerObserver { public: - DebuggerObserver() : observed(nullptr) { - } + DebuggerObserver() : observed(nullptr) {} virtual ~DebuggerObserver() { if (observed) diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 1d1a686e0..b2db609ec 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -176,7 +176,10 @@ struct Regs { MirroredRepeat = 3, }; - enum TextureFilter : u32 { Nearest = 0, Linear = 1 }; + enum TextureFilter : u32 { + Nearest = 0, + Linear = 1, + }; union { u32 raw; @@ -300,9 +303,11 @@ struct Regs { const TextureFormat format; }; const std::array GetTextures() const { - return {{{texture0_enable.ToBool(), texture0, texture0_format}, - {texture1_enable.ToBool(), texture1, texture1_format}, - {texture2_enable.ToBool(), texture2, texture2_format}}}; + return {{ + {texture0_enable.ToBool(), texture0, texture0_format}, + {texture1_enable.ToBool(), texture1, texture1_format}, + {texture2_enable.ToBool(), texture2, texture2_format}, + }}; } // 0xc0-0xff: Texture Combiner (akin to glTexEnv) @@ -523,7 +528,7 @@ struct Regs { Decrement = 4, Invert = 5, IncrementWrap = 6, - DecrementWrap = 7 + DecrementWrap = 7, }; struct { @@ -1173,7 +1178,10 @@ struct Regs { INSERT_PADDING_WORDS(0x07); - enum class GPUMode : u32 { Drawing = 0, Configuring = 1 }; + enum class GPUMode : u32 { + Drawing = 0, + Configuring = 1, + }; GPUMode gpu_mode; @@ -1249,7 +1257,10 @@ struct Regs { INSERT_PADDING_WORDS(0x2); struct { - enum Format : u32 { FLOAT24 = 0, FLOAT32 = 1 }; + enum Format : u32 { + FLOAT24 = 0, + FLOAT32 = 1, + }; bool IsFloat32() const { return format == FLOAT32; diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 343edb191..901cca26b 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -12,8 +12,7 @@ namespace Pica { template PrimitiveAssembler::PrimitiveAssembler(Regs::TriangleTopology topology) - : topology(topology), buffer_index(0) { -} + : topology(topology), buffer_index(0) {} template void PrimitiveAssembler::SubmitVertex(VertexType& vtx, diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index dbdc37ce6..f815d6cf0 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -268,10 +268,8 @@ static u8 PerformStencilAction(Regs::StencilAction action, u8 old_stencil, u8 re // NOTE: Assuming that rasterizer coordinates are 12.4 fixed-point values struct Fix12P4 { - Fix12P4() { - } - Fix12P4(u16 val) : val(val) { - } + Fix12P4() {} + Fix12P4(u16 val) : val(val) {} static u16 FracMask() { return 0xF; @@ -491,7 +489,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader 255), (u8)( GetInterpolatedAttribute(v0.color.a(), v1.color.a(), v2.color.a()).ToFloat32() * - 255)}; + 255), + }; Math::Vec2 uv[3]; uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u()); @@ -604,7 +603,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader Math::Vec4 combiner_buffer = {0, 0, 0, 0}; Math::Vec4 next_combiner_buffer = { regs.tev_combiner_buffer_color.r, regs.tev_combiner_buffer_color.g, - regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a}; + regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a, + }; for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); ++tev_stage_index) { @@ -841,18 +841,16 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader Math::Vec3 color_result[3] = { GetColorModifier(tev_stage.color_modifier1, GetSource(tev_stage.color_source1)), GetColorModifier(tev_stage.color_modifier2, GetSource(tev_stage.color_source2)), - GetColorModifier(tev_stage.color_modifier3, - GetSource(tev_stage.color_source3))}; + GetColorModifier(tev_stage.color_modifier3, GetSource(tev_stage.color_source3)), + }; auto color_output = ColorCombine(tev_stage.color_op, color_result); // alpha combiner - std::array alpha_result = { - {GetAlphaModifier(tev_stage.alpha_modifier1, - GetSource(tev_stage.alpha_source1)), - GetAlphaModifier(tev_stage.alpha_modifier2, - GetSource(tev_stage.alpha_source2)), - GetAlphaModifier(tev_stage.alpha_modifier3, - GetSource(tev_stage.alpha_source3))}}; + std::array alpha_result = {{ + GetAlphaModifier(tev_stage.alpha_modifier1, GetSource(tev_stage.alpha_source1)), + GetAlphaModifier(tev_stage.alpha_modifier2, GetSource(tev_stage.alpha_source2)), + GetAlphaModifier(tev_stage.alpha_modifier3, GetSource(tev_stage.alpha_source3)), + }}; auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result); combiner_output[0] = @@ -1083,7 +1081,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader static_cast(output_merger.blend_const.r), static_cast(output_merger.blend_const.g), static_cast(output_merger.blend_const.b), - static_cast(output_merger.blend_const.a)}; + static_cast(output_merger.blend_const.a), + }; switch (factor) { case Regs::BlendFactor::Zero: @@ -1267,11 +1266,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader LogicOp(combiner_output.a(), dest.a(), output_merger.logic_op)); } - const Math::Vec4 result = {output_merger.red_enable ? blend_output.r() : dest.r(), - output_merger.green_enable ? blend_output.g() : dest.g(), - output_merger.blue_enable ? blend_output.b() : dest.b(), - output_merger.alpha_enable ? blend_output.a() - : dest.a()}; + const Math::Vec4 result = { + output_merger.red_enable ? blend_output.r() : dest.r(), + output_merger.green_enable ? blend_output.g() : dest.g(), + output_merger.blue_enable ? blend_output.b() : dest.b(), + output_merger.alpha_enable ? blend_output.a() : dest.a(), + }; if (regs.framebuffer.allow_color_write != 0) DrawPixel(x >> 4, y >> 4, result); diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index ce834bd30..c7bd29f12 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -20,8 +20,7 @@ namespace VideoCore { class RasterizerInterface { public: - virtual ~RasterizerInterface() { - } + virtual ~RasterizerInterface() {} /// Queues the primitive formed by the given vertices for rendering virtual void AddTriangle(const Pica::Shader::OutputVertex& v0, diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 22e2f9815..daacdb167 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -17,8 +17,7 @@ public: /// Used to reference a framebuffer enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; - virtual ~RendererBase() { - } + virtual ~RendererBase() {} /// Swap buffers (render frame) virtual void SwapBuffers() = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 5021f48bc..37977464d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -136,8 +136,7 @@ RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) { SyncDepthWriteMask(); } -RasterizerOpenGL::~RasterizerOpenGL() { -} +RasterizerOpenGL::~RasterizerOpenGL() {} /** * This is a helper function to resolve an issue with opposite quaternions being interpolated by @@ -1156,9 +1155,10 @@ void RasterizerOpenGL::SyncBlendColor() { void RasterizerOpenGL::SyncFogColor() { const auto& regs = Pica::g_state.regs; - uniform_block_data.data.fog_color = {regs.fog_color.r.Value() / 255.0f, - regs.fog_color.g.Value() / 255.0f, - regs.fog_color.b.Value() / 255.0f}; + uniform_block_data.data.fog_color = { + regs.fog_color.r.Value() / 255.0f, regs.fog_color.g.Value() / 255.0f, + regs.fog_color.b.Value() / 255.0f, + }; uniform_block_data.dirty = true; } diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 70e9e64ef..60d70539c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -41,12 +41,9 @@ struct ScreenInfo; * two separate shaders sharing the same key. * * We use a union because "implicitly-defined copy/move constructor for a union X copies the object - * representation of X." - * and "implicitly-defined copy assignment operator for a union X copies the object representation - * (3.9) of X." - * = Bytewise copy instead of memberwise copy. - * This is important because the padding bytes are included in the hash and comparison between - * objects. + * representation of X." and "implicitly-defined copy assignment operator for a union X copies the + * object representation (3.9) of X." = Bytewise copy instead of memberwise copy. This is important + * because the padding bytes are included in the hash and comparison between objects. */ union PicaShaderConfig { diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 8f1477bcd..ec3300ca6 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -522,8 +522,8 @@ CachedSurface* RasterizerCacheOpenGL::GetSurfaceRect(const CachedSurface& params return GetSurface(params, match_res_scale, load_if_create); } -CachedSurface* -RasterizerCacheOpenGL::GetTextureSurface(const Pica::Regs::FullTextureConfig& config) { +CachedSurface* RasterizerCacheOpenGL::GetTextureSurface( + const Pica::Regs::FullTextureConfig& config) { Pica::DebugUtils::TextureInfo info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format); diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index db5b649da..b2272bda8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -212,8 +212,8 @@ public: /// Gets the color and depth surfaces and rect (resolution scaled) based on the framebuffer /// configuration - std::tuple> - GetFramebufferSurfaces(const Pica::Regs::FramebufferConfig& config); + std::tuple> GetFramebufferSurfaces( + const Pica::Regs::FramebufferConfig& config); /// Attempt to get a surface that exactly matches the fill region and format CachedSurface* TryGetFillSurface(const GPU::Regs::MemoryFillConfig& config); diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index f86cffee5..9392c67b8 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -293,9 +293,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) { case CompareFunc::LessThanOrEqual: case CompareFunc::GreaterThan: case CompareFunc::GreaterThanOrEqual: { - static const char* op[] = { - "!=", "==", ">=", ">", "<=", "<", - }; + static const char* op[] = {"!=", "==", ">=", ">", "<=", "<"}; unsigned index = (unsigned)func - (unsigned)CompareFunc::Equal; out += "int(last_tex_env_out.a * 255.0f) " + std::string(op[index]) + " alphatest_ref"; break; diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index a604e94d4..415358b6c 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -26,7 +26,7 @@ namespace PicaToGL { inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) { static const GLenum filter_mode_table[] = { GL_NEAREST, // TextureFilter::Nearest - GL_LINEAR // TextureFilter::Linear + GL_LINEAR, // TextureFilter::Linear }; // Range check table for input @@ -55,7 +55,7 @@ inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) { GL_CLAMP_TO_EDGE, // WrapMode::ClampToEdge GL_CLAMP_TO_BORDER, // WrapMode::ClampToBorder GL_REPEAT, // WrapMode::Repeat - GL_MIRRORED_REPEAT // WrapMode::MirroredRepeat + GL_MIRRORED_REPEAT, // WrapMode::MirroredRepeat }; // Range check table for input @@ -192,7 +192,7 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { GL_DECR, // StencilAction::Decrement GL_INVERT, // StencilAction::Invert GL_INCR_WRAP, // StencilAction::IncrementWrap - GL_DECR_WRAP // StencilAction::DecrementWrap + GL_DECR_WRAP, // StencilAction::DecrementWrap }; // Range check table for input @@ -207,12 +207,16 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) { } inline GLvec4 ColorRGBA8(const u32 color) { - return {{(color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, - (color >> 16 & 0xFF) / 255.0f, (color >> 24 & 0xFF) / 255.0f}}; + return {{ + (color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, (color >> 16 & 0xFF) / 255.0f, + (color >> 24 & 0xFF) / 255.0f, + }}; } inline std::array LightColor(const Pica::Regs::LightColor& color) { - return {{color.r / 255.0f, color.g / 255.0f, color.b / 255.0f}}; + return {{ + color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, + }}; } } // namespace diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 3cabda8f9..a1d08e04d 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -87,15 +87,13 @@ struct ScreenRectVertex { * by a 3x2 matrix. */ static std::array MakeOrthographicMatrix(const float width, const float height) { - std::array matrix; - - matrix[0] = 2.f / width; - matrix[2] = 0.f; - matrix[4] = -1.f; - matrix[1] = 0.f; - matrix[3] = -2.f / height; - matrix[5] = 1.f; + std::array matrix; // Laid out in column-major order + + // clang-format off + matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f; + matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f; // Last matrix row is implicitly assumed to be [0, 0, 1]. + // clang-format on return matrix; } @@ -107,8 +105,7 @@ RendererOpenGL::RendererOpenGL() { } /// RendererOpenGL destructor -RendererOpenGL::~RendererOpenGL() { -} +RendererOpenGL::~RendererOpenGL() {} /// Swap buffers (render frame) void RendererOpenGL::SwapBuffers() { @@ -215,8 +212,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram // Update existing texture // TODO: Test what happens on hardware when you change the framebuffer dimensions so that - // they - // differ from the LCD resolution. + // they differ from the LCD resolution. // TODO: Applications could theoretically crash Citra here by specifying too large // framebuffer sizes. We should make sure that this cannot happen. glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, framebuffer.width, framebuffer.height, @@ -231,10 +227,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram } /** - * Fills active OpenGL texture with the given RGB color. - * Since the color is solid, the texture can be 1x1 but will stretch across whatever it's rendered - * on. - * This has the added benefit of being *really fast*. + * Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can + * be 1x1 but will stretch across whatever it's rendered on. */ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, const TextureInfo& texture) { @@ -424,8 +418,7 @@ void RendererOpenGL::DrawScreens() { } /// Updates the framerate -void RendererOpenGL::UpdateFramerate() { -} +void RendererOpenGL::UpdateFramerate() {} /** * Set the emulator window to use for renderer @@ -513,5 +506,4 @@ bool RendererOpenGL::Init() { } /// Shutdown the renderer -void RendererOpenGL::ShutDown() { -} +void RendererOpenGL::ShutDown() {} diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index faeb519ec..762b790c1 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -81,11 +81,14 @@ private: OGLVertexArray vertex_array; OGLBuffer vertex_buffer; OGLShader shader; - std::array - screen_infos; ///< Display information for top and bottom screens respectively + + /// Display information for top and bottom screens respectively + std::array screen_infos; + // Shader uniform location indices GLuint uniform_modelview_matrix; GLuint uniform_color_texture; + // Shader attribute input indices GLuint attrib_position; GLuint attrib_tex_coord; diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 852c5a9a0..c38bdcc3c 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -96,8 +96,8 @@ void ShaderSetup::Setup() { #ifdef ARCHITECTURE_x86_64 if (VideoCore::g_shader_jit_enabled) { u64 cache_key = - (Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^ - Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data))); + Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^ + Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data)); auto iter = shader_map.find(cache_key); if (iter != shader_map.end()) { diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 830d933a8..79c716b6e 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -358,8 +358,7 @@ struct ShaderSetup { /** * Performs any shader unit setup that only needs to happen once per shader (as opposed to once - * per - * vertex, which would happen within the `Run` function). + * per vertex, which would happen within the `Run` function). */ void Setup(); diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 681ff9728..41df8a2fd 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -80,9 +80,8 @@ void RunInterpreter(const ShaderSetup& setup, UnitState& state, unsigned auto call = [&program_counter, &call_stack](UnitState& state, u32 offset, u32 num_instructions, u32 return_offset, u8 repeat_count, u8 loop_increment) { - program_counter = - offset - - 1; // -1 to make sure when incrementing the PC we end up at the correct offset + // -1 to make sure when incrementing the PC we end up at the correct offset + program_counter = offset - 1; ASSERT(call_stack.size() < call_stack.capacity()); call_stack.push_back( {offset + num_instructions, return_offset, repeat_count, loop_increment, offset}); diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index 04e04ba1a..d1b2ce8d5 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -590,8 +590,7 @@ void JitShader::Compile_RSQ(Instruction instr) { Compile_DestEnable(instr, SRC1); } -void JitShader::Compile_NOP(Instruction instr) { -} +void JitShader::Compile_NOP(Instruction instr) {} void JitShader::Compile_END(Instruction instr) { ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8); diff --git a/src/video_core/swrasterizer.h b/src/video_core/swrasterizer.h index bca9780e5..12dc56bef 100644 --- a/src/video_core/swrasterizer.h +++ b/src/video_core/swrasterizer.h @@ -19,15 +19,10 @@ namespace VideoCore { class SWRasterizer : public RasterizerInterface { void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1, const Pica::Shader::OutputVertex& v2) override; - void DrawTriangles() override { - } - void NotifyPicaRegisterChanged(u32 id) override { - } - void FlushAll() override { - } - void FlushRegion(PAddr addr, u32 size) override { - } - void FlushAndInvalidateRegion(PAddr addr, u32 size) override { - } + void DrawTriangles() override {} + void NotifyPicaRegisterChanged(u32 id) override {} + void FlushAll() override {} + void FlushRegion(PAddr addr, u32 size) override {} + void FlushAndInvalidateRegion(PAddr addr, u32 size) override {} }; } -- cgit v1.2.3 From ebdae19fd226104baec712b9da9939ff82ef3c3a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 21 Sep 2016 00:21:23 +0900 Subject: Remove empty newlines in #include blocks. This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation. --- src/.clang-format | 2 ++ src/audio_core/audio_core.cpp | 4 +-- src/audio_core/codec.cpp | 4 +-- src/audio_core/codec.h | 1 - src/audio_core/hle/common.h | 1 - src/audio_core/hle/dsp.cpp | 3 +- src/audio_core/hle/dsp.h | 2 -- src/audio_core/hle/filter.cpp | 4 +-- src/audio_core/hle/filter.h | 2 -- src/audio_core/hle/mixers.cpp | 1 - src/audio_core/hle/mixers.h | 1 - src/audio_core/hle/pipe.cpp | 5 +--- src/audio_core/hle/pipe.h | 1 - src/audio_core/hle/source.cpp | 5 +--- src/audio_core/hle/source.h | 2 -- src/audio_core/interpolate.cpp | 1 - src/audio_core/interpolate.h | 1 - src/audio_core/null_sink.h | 1 - src/audio_core/sdl2_sink.cpp | 7 ++--- src/audio_core/sdl2_sink.h | 1 - src/audio_core/sink.h | 1 - src/audio_core/sink_details.cpp | 4 +-- src/audio_core/time_stretch.cpp | 5 +--- src/audio_core/time_stretch.h | 1 - src/citra/citra.cpp | 7 ++--- src/citra/config.cpp | 10 ++----- src/citra/config.h | 1 - src/citra/emu_window/emu_window_sdl2.cpp | 8 +----- src/citra/emu_window/emu_window_sdl2.h | 1 - src/citra_qt/bootmanager.cpp | 3 -- src/citra_qt/bootmanager.h | 2 -- src/citra_qt/config.cpp | 4 +-- src/citra_qt/config.h | 3 +- src/citra_qt/configure_audio.cpp | 6 ++-- src/citra_qt/configure_audio.h | 2 +- src/citra_qt/configure_debug.cpp | 3 +- src/citra_qt/configure_debug.h | 2 +- src/citra_qt/configure_dialog.cpp | 3 +- src/citra_qt/configure_dialog.h | 2 +- src/citra_qt/configure_general.cpp | 3 +- src/citra_qt/configure_general.h | 2 +- src/citra_qt/configure_graphics.cpp | 3 +- src/citra_qt/configure_graphics.h | 2 +- src/citra_qt/configure_input.cpp | 5 ++-- src/citra_qt/configure_input.h | 2 +- src/citra_qt/configure_system.cpp | 3 +- src/citra_qt/configure_system.h | 2 +- src/citra_qt/debugger/callstack.cpp | 5 +--- src/citra_qt/debugger/disassembler.cpp | 5 +--- src/citra_qt/debugger/disassembler.h | 4 +-- src/citra_qt/debugger/graphics.cpp | 3 +- src/citra_qt/debugger/graphics.h | 1 - .../debugger/graphics_breakpoint_observer.cpp | 3 +- .../debugger/graphics_breakpoint_observer.h | 1 - src/citra_qt/debugger/graphics_breakpoints.cpp | 4 +-- src/citra_qt/debugger/graphics_breakpoints.h | 2 -- src/citra_qt/debugger/graphics_breakpoints_p.h | 2 -- src/citra_qt/debugger/graphics_cmdlists.cpp | 5 +--- src/citra_qt/debugger/graphics_cmdlists.h | 1 - src/citra_qt/debugger/graphics_surface.cpp | 6 +--- src/citra_qt/debugger/graphics_surface.h | 3 +- src/citra_qt/debugger/graphics_tracing.cpp | 11 ++------ src/citra_qt/debugger/graphics_vertex_shader.cpp | 5 +--- src/citra_qt/debugger/graphics_vertex_shader.h | 4 +-- src/citra_qt/debugger/profiler.cpp | 4 +-- src/citra_qt/debugger/profiler.h | 4 +-- src/citra_qt/debugger/registers.cpp | 4 +-- src/citra_qt/debugger/registers.h | 3 +- src/citra_qt/game_list.cpp | 11 +++----- src/citra_qt/game_list_p.h | 4 --- src/citra_qt/hotkeys.cpp | 4 +-- src/citra_qt/main.cpp | 18 ++++-------- src/citra_qt/main.h | 3 +- src/citra_qt/ui_settings.h | 3 +- src/citra_qt/util/spinbox.cpp | 5 ++-- src/citra_qt/util/util.cpp | 3 +- src/common/assert.h | 3 +- src/common/bit_field.h | 1 - src/common/break_points.cpp | 3 +- src/common/break_points.h | 1 - src/common/chunk_file.h | 1 - src/common/code_block.h | 1 - src/common/common_funcs.h | 1 - src/common/emu_window.cpp | 4 +-- src/common/emu_window.h | 2 -- src/common/file_util.cpp | 1 - src/common/file_util.h | 2 -- src/common/hash.cpp | 1 - src/common/key_map.cpp | 3 +- src/common/logging/backend.cpp | 3 +- src/common/logging/backend.h | 1 - src/common/logging/filter.cpp | 3 +- src/common/logging/filter.h | 1 - src/common/logging/text_formatter.cpp | 5 ++-- src/common/misc.cpp | 1 - src/common/profiler.cpp | 1 - src/common/profiler_reporting.h | 1 - src/common/string_util.cpp | 4 +-- src/common/string_util.h | 1 - src/common/swap.h | 2 -- src/common/symbols.h | 1 - src/common/thread.cpp | 2 -- src/common/thread.h | 1 - src/common/thread_queue_list.h | 1 - src/common/timer.cpp | 2 -- src/common/x64/cpu_detect.cpp | 4 +-- src/common/x64/emitter.cpp | 8 ++---- src/common/x64/emitter.h | 1 - src/core/arm/disassembler/arm_disasm.cpp | 4 +-- src/core/arm/disassembler/arm_disasm.h | 1 - src/core/arm/disassembler/load_symbol_map.cpp | 4 +-- src/core/arm/dynarmic/arm_dynarmic.cpp | 6 ++-- src/core/arm/dynarmic/arm_dynarmic.h | 3 -- src/core/arm/dyncom/arm_dyncom.cpp | 11 +++----- src/core/arm/dyncom/arm_dyncom.h | 2 -- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 7 ++--- src/core/arm/dyncom/arm_dyncom_trans.cpp | 4 +-- src/core/arm/dyncom/arm_dyncom_trans.h | 3 ++ src/core/arm/skyeye_common/armstate.h | 1 - src/core/arm/skyeye_common/armsupp.cpp | 3 +- src/core/arm/skyeye_common/vfp/vfp.cpp | 3 +- src/core/arm/skyeye_common/vfp/vfpdouble.cpp | 2 +- src/core/arm/skyeye_common/vfp/vfpsingle.cpp | 4 +-- src/core/core.cpp | 4 +-- src/core/core_timing.cpp | 4 +-- src/core/core_timing.h | 6 ++-- src/core/file_sys/archive_backend.cpp | 4 +-- src/core/file_sys/archive_backend.h | 2 -- src/core/file_sys/archive_extsavedata.cpp | 4 +-- src/core/file_sys/archive_extsavedata.h | 2 -- src/core/file_sys/archive_romfs.cpp | 4 +-- src/core/file_sys/archive_romfs.h | 2 -- src/core/file_sys/archive_savedata.cpp | 4 +-- src/core/file_sys/archive_savedata.h | 1 - src/core/file_sys/archive_savedatacheck.cpp | 4 +-- src/core/file_sys/archive_savedatacheck.h | 1 - src/core/file_sys/archive_sdmc.cpp | 4 +-- src/core/file_sys/archive_sdmc.h | 1 - src/core/file_sys/archive_systemsavedata.cpp | 4 +-- src/core/file_sys/archive_systemsavedata.h | 2 -- src/core/file_sys/directory_backend.h | 1 - src/core/file_sys/disk_archive.cpp | 4 +-- src/core/file_sys/disk_archive.h | 2 -- src/core/file_sys/file_backend.h | 1 - src/core/file_sys/ivfc_archive.cpp | 4 +-- src/core/file_sys/ivfc_archive.h | 2 -- src/core/gdbstub/gdbstub.h | 1 - src/core/hle/applets/applet.cpp | 4 +-- src/core/hle/applets/applet.h | 1 - src/core/hle/applets/erreula.cpp | 3 +- src/core/hle/applets/mii_selector.cpp | 5 +--- src/core/hle/applets/mii_selector.h | 1 - src/core/hle/applets/swkbd.cpp | 5 +--- src/core/hle/applets/swkbd.h | 1 - src/core/hle/config_mem.h | 1 - src/core/hle/function_wrappers.h | 2 +- src/core/hle/hle.cpp | 3 +- src/core/hle/kernel/address_arbiter.cpp | 6 ++-- src/core/hle/kernel/address_arbiter.h | 1 - src/core/hle/kernel/client_port.cpp | 3 +- src/core/hle/kernel/client_port.h | 2 -- src/core/hle/kernel/event.cpp | 4 +-- src/core/hle/kernel/event.h | 1 - src/core/hle/kernel/kernel.cpp | 4 +-- src/core/hle/kernel/kernel.h | 5 +--- src/core/hle/kernel/memory.cpp | 5 +--- src/core/hle/kernel/memory.h | 2 -- src/core/hle/kernel/mutex.cpp | 5 +--- src/core/hle/kernel/mutex.h | 2 -- src/core/hle/kernel/process.cpp | 4 +-- src/core/hle/kernel/process.h | 3 -- src/core/hle/kernel/resource_limit.cpp | 4 +-- src/core/hle/kernel/resource_limit.h | 1 - src/core/hle/kernel/semaphore.cpp | 3 +- src/core/hle/kernel/semaphore.h | 2 -- src/core/hle/kernel/server_port.cpp | 4 +-- src/core/hle/kernel/server_port.h | 2 -- src/core/hle/kernel/session.h | 2 -- src/core/hle/kernel/shared_memory.cpp | 4 +-- src/core/hle/kernel/shared_memory.h | 2 -- src/core/hle/kernel/thread.cpp | 4 +-- src/core/hle/kernel/thread.h | 4 --- src/core/hle/kernel/timer.cpp | 4 +-- src/core/hle/kernel/timer.h | 1 - src/core/hle/kernel/vm_manager.cpp | 4 +-- src/core/hle/kernel/vm_manager.h | 2 -- src/core/hle/result.h | 1 - src/core/hle/service/ac_u.cpp | 3 +- src/core/hle/service/am/am.cpp | 4 +-- src/core/hle/service/apt/apt.cpp | 12 ++++---- src/core/hle/service/apt/apt.h | 1 - src/core/hle/service/apt/bcfnt/bcfnt.h | 1 - src/core/hle/service/cam/cam.cpp | 3 +- src/core/hle/service/cam/cam.h | 1 - src/core/hle/service/cecd/cecd.cpp | 3 +- src/core/hle/service/cfg/cfg.cpp | 4 +-- src/core/hle/service/cfg/cfg.h | 1 - src/core/hle/service/dsp_dsp.cpp | 5 +--- src/core/hle/service/dsp_dsp.h | 1 - src/core/hle/service/err_f.cpp | 3 +- src/core/hle/service/frd/frd.cpp | 3 +- src/core/hle/service/fs/archive.cpp | 5 +--- src/core/hle/service/fs/archive.h | 2 -- src/core/hle/service/fs/fs_user.cpp | 3 +- src/core/hle/service/gsp_gpu.cpp | 5 +--- src/core/hle/service/gsp_gpu.h | 2 -- src/core/hle/service/hid/hid.cpp | 12 +++----- src/core/hle/service/hid/hid.h | 1 - src/core/hle/service/ir/ir.cpp | 3 +- src/core/hle/service/ldr_ro/cro_helper.cpp | 3 +- src/core/hle/service/ldr_ro/cro_helper.h | 2 -- src/core/hle/service/ldr_ro/ldr_ro.cpp | 3 +- .../hle/service/ldr_ro/memory_synchronizer.cpp | 4 +-- src/core/hle/service/ldr_ro/memory_synchronizer.h | 1 - src/core/hle/service/news/news.cpp | 3 +- src/core/hle/service/nim/nim.cpp | 3 +- src/core/hle/service/nim/nim_u.h | 2 +- src/core/hle/service/nwm_uds.cpp | 3 +- src/core/hle/service/service.cpp | 32 ++++++++++------------ src/core/hle/service/service.h | 3 -- src/core/hle/service/soc_u.cpp | 4 +-- src/core/hle/service/soc_u.h | 1 - src/core/hle/service/srv.cpp | 3 +- src/core/hle/service/ssl_c.cpp | 3 +- src/core/hle/service/y2r_u.cpp | 4 +-- src/core/hle/service/y2r_u.h | 2 -- src/core/hle/shared_page.cpp | 3 +- src/core/hle/shared_page.h | 1 - src/core/hle/svc.cpp | 6 +--- src/core/hw/gpu.cpp | 15 +++------- src/core/hw/gpu.h | 1 - src/core/hw/hw.cpp | 3 +- src/core/hw/lcd.cpp | 5 +--- src/core/hw/lcd.h | 1 - src/core/hw/y2r.cpp | 4 +-- src/core/loader/3dsx.cpp | 4 +-- src/core/loader/3dsx.h | 1 - src/core/loader/elf.cpp | 4 +-- src/core/loader/elf.h | 1 - src/core/loader/loader.cpp | 2 -- src/core/loader/loader.h | 1 - src/core/loader/ncch.cpp | 4 +-- src/core/loader/ncch.h | 2 -- src/core/loader/smdh.cpp | 5 +--- src/core/loader/smdh.h | 1 - src/core/memory.cpp | 5 +--- src/core/memory.h | 1 - src/core/memory_setup.h | 1 - src/core/mmio.h | 1 - src/core/settings.cpp | 3 -- src/core/settings.h | 1 - src/core/system.cpp | 4 +-- src/core/tracer/recorder.cpp | 4 +-- src/core/tracer/recorder.h | 5 +--- src/video_core/clipper.cpp | 5 +--- src/video_core/command_processor.cpp | 5 +--- src/video_core/command_processor.h | 1 - src/video_core/debug_utils/debug_utils.cpp | 2 -- src/video_core/debug_utils/debug_utils.h | 2 -- src/video_core/gpu_debugger.h | 1 - src/video_core/pica.cpp | 3 +- src/video_core/pica_state.h | 2 -- src/video_core/pica_types.h | 1 - src/video_core/primitive_assembly.cpp | 3 +- src/video_core/primitive_assembly.h | 1 - src/video_core/rasterizer.cpp | 5 +--- src/video_core/rasterizer_interface.h | 1 - src/video_core/renderer_base.cpp | 3 +- src/video_core/renderer_base.h | 2 -- src/video_core/renderer_opengl/gl_rasterizer.cpp | 6 +--- src/video_core/renderer_opengl/gl_rasterizer.h | 4 --- .../renderer_opengl/gl_rasterizer_cache.cpp | 6 +--- .../renderer_opengl/gl_rasterizer_cache.h | 4 --- .../renderer_opengl/gl_resource_manager.h | 3 -- src/video_core/renderer_opengl/gl_shader_gen.cpp | 4 +-- src/video_core/renderer_opengl/gl_shader_util.cpp | 4 +-- src/video_core/renderer_opengl/gl_state.cpp | 4 +-- src/video_core/renderer_opengl/pica_to_gl.h | 3 -- src/video_core/renderer_opengl/renderer_opengl.cpp | 6 +--- src/video_core/renderer_opengl/renderer_opengl.h | 4 --- src/video_core/shader/shader.cpp | 7 +---- src/video_core/shader/shader.h | 4 --- src/video_core/shader/shader_interpreter.cpp | 5 +--- src/video_core/shader/shader_jit_x64.cpp | 6 +--- src/video_core/shader/shader_jit_x64.h | 3 -- src/video_core/swrasterizer.h | 1 - src/video_core/vertex_loader.cpp | 6 +--- src/video_core/vertex_loader.h | 1 - src/video_core/video_core.cpp | 4 +-- 289 files changed, 214 insertions(+), 731 deletions(-) (limited to 'src/common') diff --git a/src/.clang-format b/src/.clang-format index f9a5d1378..fc1bbb297 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -50,6 +50,8 @@ IncludeCategories: Priority: 1 - Regex: '^\<(boost|catch|dynarmic|glad|inih|nihstro)/' Priority: 3 + - Regex: '^\<(SDL|SoundTouch|Q)' + Priority: 3 - Regex: '^\<' Priority: 2 IndentCaseLabels: false diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp index 0b36dbb03..c54a4b99a 100644 --- a/src/audio_core/audio_core.cpp +++ b/src/audio_core/audio_core.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/audio_core.h" #include #include - -#include "audio_core/audio_core.h" #include "audio_core/hle/dsp.h" #include "audio_core/hle/pipe.h" #include "audio_core/null_sink.h" #include "audio_core/sink.h" #include "audio_core/sink_details.h" - #include "core/core_timing.h" #include "core/hle/kernel/vm_manager.h" #include "core/hle/service/dsp_dsp.h" diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index 4edfe9be0..fd189a176 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/codec.h" #include #include #include #include - -#include "audio_core/codec.h" - #include "common/assert.h" #include "common/common_types.h" #include "common/math_util.h" diff --git a/src/audio_core/codec.h b/src/audio_core/codec.h index 77bbf98b5..2b0c395e6 100644 --- a/src/audio_core/codec.h +++ b/src/audio_core/codec.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace Codec { diff --git a/src/audio_core/hle/common.h b/src/audio_core/hle/common.h index 8e7e5c3cd..7fbc3ad9a 100644 --- a/src/audio_core/hle/common.h +++ b/src/audio_core/hle/common.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace DSP { diff --git a/src/audio_core/hle/dsp.cpp b/src/audio_core/hle/dsp.cpp index aaa3a280f..aa64dae97 100644 --- a/src/audio_core/hle/dsp.cpp +++ b/src/audio_core/hle/dsp.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/hle/dsp.h" #include #include - -#include "audio_core/hle/dsp.h" #include "audio_core/hle/mixers.h" #include "audio_core/hle/pipe.h" #include "audio_core/hle/source.h" diff --git a/src/audio_core/hle/dsp.h b/src/audio_core/hle/dsp.h index f4c4b01e2..0a0f60ac1 100644 --- a/src/audio_core/hle/dsp.h +++ b/src/audio_core/hle/dsp.h @@ -8,9 +8,7 @@ #include #include #include - #include "audio_core/hle/common.h" - #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" diff --git a/src/audio_core/hle/filter.cpp b/src/audio_core/hle/filter.cpp index da2a4684e..edf95f686 100644 --- a/src/audio_core/hle/filter.cpp +++ b/src/audio_core/hle/filter.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/hle/filter.h" #include #include - #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" -#include "audio_core/hle/filter.h" - #include "common/common_types.h" #include "common/math_util.h" diff --git a/src/audio_core/hle/filter.h b/src/audio_core/hle/filter.h index 73d5ce670..4281a5898 100644 --- a/src/audio_core/hle/filter.h +++ b/src/audio_core/hle/filter.h @@ -5,10 +5,8 @@ #pragma once #include - #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" - #include "common/common_types.h" namespace DSP { diff --git a/src/audio_core/hle/mixers.cpp b/src/audio_core/hle/mixers.cpp index 126f328bc..6cc81dfca 100644 --- a/src/audio_core/hle/mixers.cpp +++ b/src/audio_core/hle/mixers.cpp @@ -7,7 +7,6 @@ #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" #include "audio_core/hle/mixers.h" - #include "common/assert.h" #include "common/logging/log.h" #include "common/math_util.h" diff --git a/src/audio_core/hle/mixers.h b/src/audio_core/hle/mixers.h index 537c3a3b9..bf4e865ae 100644 --- a/src/audio_core/hle/mixers.h +++ b/src/audio_core/hle/mixers.h @@ -5,7 +5,6 @@ #pragma once #include - #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" diff --git a/src/audio_core/hle/pipe.cpp b/src/audio_core/hle/pipe.cpp index f2b6d6552..cab30c8aa 100644 --- a/src/audio_core/hle/pipe.cpp +++ b/src/audio_core/hle/pipe.cpp @@ -2,16 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/hle/pipe.h" #include #include - #include "audio_core/hle/dsp.h" -#include "audio_core/hle/pipe.h" - #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hle/service/dsp_dsp.h" namespace DSP { diff --git a/src/audio_core/hle/pipe.h b/src/audio_core/hle/pipe.h index 6d7fd92ab..ac053c029 100644 --- a/src/audio_core/hle/pipe.h +++ b/src/audio_core/hle/pipe.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace DSP { diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index 249acc449..9e6b36fcd 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -2,17 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/hle/source.h" #include #include - #include "audio_core/codec.h" #include "audio_core/hle/common.h" -#include "audio_core/hle/source.h" #include "audio_core/interpolate.h" - #include "common/assert.h" #include "common/logging/log.h" - #include "core/memory.h" namespace DSP { diff --git a/src/audio_core/hle/source.h b/src/audio_core/hle/source.h index a1ab15520..3d725f2a3 100644 --- a/src/audio_core/hle/source.h +++ b/src/audio_core/hle/source.h @@ -7,13 +7,11 @@ #include #include #include - #include "audio_core/codec.h" #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" #include "audio_core/hle/filter.h" #include "audio_core/interpolate.h" - #include "common/common_types.h" namespace DSP { diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp index cb1c58a67..8a5d4181a 100644 --- a/src/audio_core/interpolate.cpp +++ b/src/audio_core/interpolate.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include "audio_core/interpolate.h" - #include "common/assert.h" #include "common/math_util.h" diff --git a/src/audio_core/interpolate.h b/src/audio_core/interpolate.h index 2d2e60311..dd06fdda9 100644 --- a/src/audio_core/interpolate.h +++ b/src/audio_core/interpolate.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace AudioInterp { diff --git a/src/audio_core/null_sink.h b/src/audio_core/null_sink.h index 9931c4778..e7668438c 100644 --- a/src/audio_core/null_sink.h +++ b/src/audio_core/null_sink.h @@ -5,7 +5,6 @@ #pragma once #include - #include "audio_core/audio_core.h" #include "audio_core/sink.h" diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp index 65aac877a..2520796cb 100644 --- a/src/audio_core/sdl2_sink.cpp +++ b/src/audio_core/sdl2_sink.cpp @@ -2,15 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/sdl2_sink.h" #include +#include #include - #include - #include "audio_core/audio_core.h" -#include "audio_core/sdl2_sink.h" - -#include #include "common/assert.h" #include "common/logging/log.h" diff --git a/src/audio_core/sdl2_sink.h b/src/audio_core/sdl2_sink.h index b13827214..ccd0f7c7e 100644 --- a/src/audio_core/sdl2_sink.h +++ b/src/audio_core/sdl2_sink.h @@ -6,7 +6,6 @@ #include #include - #include "audio_core/sink.h" namespace AudioCore { diff --git a/src/audio_core/sink.h b/src/audio_core/sink.h index f5ce55a6b..08f3bab5b 100644 --- a/src/audio_core/sink.h +++ b/src/audio_core/sink.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" namespace AudioCore { diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink_details.cpp index ff529f4cf..1dc5e862e 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink_details.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/sink_details.h" #include #include - #include "audio_core/null_sink.h" -#include "audio_core/sink_details.h" - #ifdef HAVE_SDL2 #include "audio_core/sdl2_sink.h" #endif diff --git a/src/audio_core/time_stretch.cpp b/src/audio_core/time_stretch.cpp index f44807c84..26059f503 100644 --- a/src/audio_core/time_stretch.cpp +++ b/src/audio_core/time_stretch.cpp @@ -2,15 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "audio_core/time_stretch.h" #include #include #include - #include - #include "audio_core/audio_core.h" -#include "audio_core/time_stretch.h" - #include "common/common_types.h" #include "common/logging/log.h" #include "common/math_util.h" diff --git a/src/audio_core/time_stretch.h b/src/audio_core/time_stretch.h index 42a213679..fa81718ed 100644 --- a/src/audio_core/time_stretch.h +++ b/src/audio_core/time_stretch.h @@ -5,7 +5,6 @@ #include #include #include - #include "common/common_types.h" namespace AudioCore { diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 1b8f8cffe..e47375f88 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -21,22 +21,19 @@ #include #endif +#include "citra/config.h" +#include "citra/emu_window/emu_window_sdl2.h" #include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" #include "common/scm_rev.h" #include "common/scope_exit.h" #include "common/string_util.h" - #include "core/core.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" #include "core/settings.h" #include "core/system.h" - -#include "citra/config.h" -#include "citra/emu_window/emu_window_sdl2.h" - #include "video_core/video_core.h" static void PrintHelp(const char* argv0) { diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 77679bd88..58aef7a9a 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -2,21 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "config.h" #include - -#include - #include - +#include #include "citra/default_ini.h" - #include "common/file_util.h" #include "common/logging/log.h" - #include "core/settings.h" -#include "config.h" - Config::Config() { // TODO: Don't hardcode the path; let the frontend decide where to put the config files. sdl2_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "sdl2-config.ini"; diff --git a/src/citra/config.h b/src/citra/config.h index 8bd2b294b..b1c31f59c 100644 --- a/src/citra/config.h +++ b/src/citra/config.h @@ -6,7 +6,6 @@ #include #include - #include class Config { diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index 42f2a7553..7df054208 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp @@ -5,22 +5,16 @@ #include #include #include - #define SDL_MAIN_HANDLED #include - #include - +#include "citra/emu_window/emu_window_sdl2.h" #include "common/key_map.h" #include "common/logging/log.h" #include "common/scm_rev.h" #include "common/string_util.h" - #include "core/hle/service/hid/hid.h" #include "core/settings.h" - -#include "citra/emu_window/emu_window_sdl2.h" - #include "video_core/video_core.h" void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { diff --git a/src/citra/emu_window/emu_window_sdl2.h b/src/citra/emu_window/emu_window_sdl2.h index d4d86821d..e4d14ef12 100644 --- a/src/citra/emu_window/emu_window_sdl2.h +++ b/src/citra/emu_window/emu_window_sdl2.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/emu_window.h" struct SDL_Window; diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 53d035b32..0abae86c3 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -9,16 +9,13 @@ #endif #include "citra_qt/bootmanager.h" - #include "common/key_map.h" #include "common/microprofile.h" #include "common/scm_rev.h" #include "common/string_util.h" - #include "core/core.h" #include "core/settings.h" #include "core/system.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/video_core.h" diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 59241684d..67228b94f 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -5,10 +5,8 @@ #include #include #include - #include #include - #include "common/emu_window.h" #include "common/thread.h" diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index d25bdcf9f..e3648572f 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -2,11 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "citra_qt/config.h" +#include #include "citra_qt/ui_settings.h" - #include "common/file_util.h" Config::Config() { diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h index db76fa870..79c901804 100644 --- a/src/citra_qt/config.h +++ b/src/citra_qt/config.h @@ -4,9 +4,8 @@ #pragma once -#include #include - +#include #include "core/settings.h" class QSettings; diff --git a/src/citra_qt/configure_audio.cpp b/src/citra_qt/configure_audio.cpp index 944047d05..ba976252e 100644 --- a/src/citra_qt/configure_audio.cpp +++ b/src/citra_qt/configure_audio.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/sink_details.h" - #include "citra_qt/configure_audio.h" -#include "ui_configure_audio.h" - +#include "audio_core/sink_details.h" #include "core/settings.h" +#include "ui_configure_audio.h" ConfigureAudio::ConfigureAudio(QWidget* parent) : QWidget(parent), ui(std::make_unique()) { diff --git a/src/citra_qt/configure_audio.h b/src/citra_qt/configure_audio.h index e836910aa..51df2e27b 100644 --- a/src/citra_qt/configure_audio.h +++ b/src/citra_qt/configure_audio.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureAudio; diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configure_debug.cpp index dde8d670e..dcc398eee 100644 --- a/src/citra_qt/configure_debug.cpp +++ b/src/citra_qt/configure_debug.cpp @@ -3,9 +3,8 @@ // Refer to the license.txt file included. #include "citra_qt/configure_debug.h" -#include "ui_configure_debug.h" - #include "core/settings.h" +#include "ui_configure_debug.h" ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { ui->setupUi(this); diff --git a/src/citra_qt/configure_debug.h b/src/citra_qt/configure_debug.h index e9c6960e2..d167eb996 100644 --- a/src/citra_qt/configure_debug.h +++ b/src/citra_qt/configure_debug.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureDebug; diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp index c33c95540..d6a4e8af1 100644 --- a/src/citra_qt/configure_dialog.cpp +++ b/src/citra_qt/configure_dialog.cpp @@ -4,9 +4,8 @@ #include "citra_qt/configure_dialog.h" #include "citra_qt/config.h" -#include "ui_configure.h" - #include "core/settings.h" +#include "ui_configure.h" ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ConfigureDialog) { ui->setupUi(this); diff --git a/src/citra_qt/configure_dialog.h b/src/citra_qt/configure_dialog.h index e4e450691..21fa1f501 100644 --- a/src/citra_qt/configure_dialog.h +++ b/src/citra_qt/configure_dialog.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureDialog; diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 3e6f76bfe..27139fb30 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp @@ -4,10 +4,9 @@ #include "citra_qt/configure_general.h" #include "citra_qt/ui_settings.h" -#include "ui_configure_general.h" - #include "core/settings.h" #include "core/system.h" +#include "ui_configure_general.h" ConfigureGeneral::ConfigureGeneral(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureGeneral) { diff --git a/src/citra_qt/configure_general.h b/src/citra_qt/configure_general.h index 196474ae3..447552d8c 100644 --- a/src/citra_qt/configure_general.h +++ b/src/citra_qt/configure_general.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureGeneral; diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp index bde6727cc..19c1f75c2 100644 --- a/src/citra_qt/configure_graphics.cpp +++ b/src/citra_qt/configure_graphics.cpp @@ -3,10 +3,9 @@ // Refer to the license.txt file included. #include "citra_qt/configure_graphics.h" -#include "ui_configure_graphics.h" - #include "core/settings.h" #include "core/system.h" +#include "ui_configure_graphics.h" ConfigureGraphics::ConfigureGraphics(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureGraphics) { diff --git a/src/citra_qt/configure_graphics.h b/src/citra_qt/configure_graphics.h index 906d534a6..5497a55f7 100644 --- a/src/citra_qt/configure_graphics.h +++ b/src/citra_qt/configure_graphics.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureGraphics; diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configure_input.cpp index 7900134ca..7039301e3 100644 --- a/src/citra_qt/configure_input.cpp +++ b/src/citra_qt/configure_input.cpp @@ -2,11 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include "citra_qt/configure_input.h" #include #include - -#include "citra_qt/configure_input.h" +#include ConfigureInput::ConfigureInput(QWidget* parent) : QWidget(parent), ui(std::make_unique()) { diff --git a/src/citra_qt/configure_input.h b/src/citra_qt/configure_input.h index 5d9624bb0..5183b904d 100644 --- a/src/citra_qt/configure_input.h +++ b/src/citra_qt/configure_input.h @@ -4,9 +4,9 @@ #pragma once +#include #include #include - #include "citra_qt/config.h" #include "core/settings.h" #include "ui_configure_input.h" diff --git a/src/citra_qt/configure_system.cpp b/src/citra_qt/configure_system.cpp index 732e15dda..873d314ec 100644 --- a/src/citra_qt/configure_system.cpp +++ b/src/citra_qt/configure_system.cpp @@ -4,11 +4,10 @@ #include "citra_qt/configure_system.h" #include "citra_qt/ui_settings.h" -#include "ui_configure_system.h" - #include "core/hle/service/cfg/cfg.h" #include "core/hle/service/fs/archive.h" #include "core/system.h" +#include "ui_configure_system.h" static const std::array days_in_month = {{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, diff --git a/src/citra_qt/configure_system.h b/src/citra_qt/configure_system.h index 3a0754bb5..db0ead13c 100644 --- a/src/citra_qt/configure_system.h +++ b/src/citra_qt/configure_system.h @@ -4,8 +4,8 @@ #pragma once -#include #include +#include namespace Ui { class ConfigureSystem; diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp index db266b506..14bd1c77c 100644 --- a/src/citra_qt/debugger/callstack.cpp +++ b/src/citra_qt/debugger/callstack.cpp @@ -2,13 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "citra_qt/debugger/callstack.h" - +#include #include "common/common_types.h" #include "common/symbols.h" - #include "core/arm/arm_interface.h" #include "core/arm/disassembler/arm_disasm.h" #include "core/core.h" diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index 803e8b172..7a5d3e2f1 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp @@ -2,16 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/disassembler.h" #include - #include "citra_qt/bootmanager.h" -#include "citra_qt/debugger/disassembler.h" #include "citra_qt/hotkeys.h" #include "citra_qt/util/util.h" - #include "common/break_points.h" #include "common/symbols.h" - #include "core/arm/arm_interface.h" #include "core/arm/disassembler/arm_disasm.h" #include "core/core.h" diff --git a/src/citra_qt/debugger/disassembler.h b/src/citra_qt/debugger/disassembler.h index 1f5607788..2ca6c2bd4 100644 --- a/src/citra_qt/debugger/disassembler.h +++ b/src/citra_qt/debugger/disassembler.h @@ -6,11 +6,9 @@ #include #include - -#include "ui_disassembler.h" - #include "common/break_points.h" #include "common/common_types.h" +#include "ui_disassembler.h" class QAction; class EmuThread; diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp index b79c063db..31b54e855 100644 --- a/src/citra_qt/debugger/graphics.cpp +++ b/src/citra_qt/debugger/graphics.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "citra_qt/debugger/graphics.h" +#include #include "citra_qt/util/util.h" extern GraphicsDebugger g_debugger; diff --git a/src/citra_qt/debugger/graphics.h b/src/citra_qt/debugger/graphics.h index 7d681b97d..bedf3e596 100644 --- a/src/citra_qt/debugger/graphics.h +++ b/src/citra_qt/debugger/graphics.h @@ -6,7 +6,6 @@ #include #include - #include "video_core/gpu_debugger.h" class GPUCommandStreamItemModel : public QAbstractListModel, diff --git a/src/citra_qt/debugger/graphics_breakpoint_observer.cpp b/src/citra_qt/debugger/graphics_breakpoint_observer.cpp index 25a398ece..ad11552d7 100644 --- a/src/citra_qt/debugger/graphics_breakpoint_observer.cpp +++ b/src/citra_qt/debugger/graphics_breakpoint_observer.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "citra_qt/debugger/graphics_breakpoint_observer.h" +#include BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr debug_context, const QString& title, QWidget* parent) diff --git a/src/citra_qt/debugger/graphics_breakpoint_observer.h b/src/citra_qt/debugger/graphics_breakpoint_observer.h index 8d0871f27..e77df4f5b 100644 --- a/src/citra_qt/debugger/graphics_breakpoint_observer.h +++ b/src/citra_qt/debugger/graphics_breakpoint_observer.h @@ -5,7 +5,6 @@ #pragma once #include - #include "video_core/debug_utils/debug_utils.h" /** diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index b31eba533..e1d1b4911 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/graphics_breakpoints.h" #include #include #include #include #include - -#include "citra_qt/debugger/graphics_breakpoints.h" #include "citra_qt/debugger/graphics_breakpoints_p.h" - #include "common/assert.h" BreakPointModel::BreakPointModel(std::shared_ptr debug_context, QObject* parent) diff --git a/src/citra_qt/debugger/graphics_breakpoints.h b/src/citra_qt/debugger/graphics_breakpoints.h index 2371b0e39..5fc40c916 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.h +++ b/src/citra_qt/debugger/graphics_breakpoints.h @@ -5,9 +5,7 @@ #pragma once #include - #include - #include "video_core/debug_utils/debug_utils.h" class QLabel; diff --git a/src/citra_qt/debugger/graphics_breakpoints_p.h b/src/citra_qt/debugger/graphics_breakpoints_p.h index 5f321ede2..dc64706bd 100644 --- a/src/citra_qt/debugger/graphics_breakpoints_p.h +++ b/src/citra_qt/debugger/graphics_breakpoints_p.h @@ -5,9 +5,7 @@ #pragma once #include - #include - #include "video_core/debug_utils/debug_utils.h" class BreakPointModel : public QAbstractListModel { diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index b088ad29d..35be9b9bd 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/graphics_cmdlists.h" #include #include #include @@ -13,13 +14,9 @@ #include #include #include - -#include "citra_qt/debugger/graphics_cmdlists.h" #include "citra_qt/util/spinbox.h" #include "citra_qt/util/util.h" - #include "common/vector_math.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/citra_qt/debugger/graphics_cmdlists.h b/src/citra_qt/debugger/graphics_cmdlists.h index b2242eca4..fa2b9122b 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.h +++ b/src/citra_qt/debugger/graphics_cmdlists.h @@ -6,7 +6,6 @@ #include #include - #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu_debugger.h" diff --git a/src/citra_qt/debugger/graphics_surface.cpp b/src/citra_qt/debugger/graphics_surface.cpp index bb998acc4..496fce59d 100644 --- a/src/citra_qt/debugger/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics_surface.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/graphics_surface.h" #include #include #include @@ -11,15 +12,10 @@ #include #include #include - -#include "citra_qt/debugger/graphics_surface.h" #include "citra_qt/util/spinbox.h" - #include "common/color.h" - #include "core/hw/gpu.h" #include "core/memory.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/utils.h" diff --git a/src/citra_qt/debugger/graphics_surface.h b/src/citra_qt/debugger/graphics_surface.h index 5881ae60a..21e6b5b8b 100644 --- a/src/citra_qt/debugger/graphics_surface.h +++ b/src/citra_qt/debugger/graphics_surface.h @@ -4,10 +4,9 @@ #pragma once -#include "citra_qt/debugger/graphics_breakpoint_observer.h" - #include #include +#include "citra_qt/debugger/graphics_breakpoint_observer.h" class QComboBox; class QSpinBox; diff --git a/src/citra_qt/debugger/graphics_tracing.cpp b/src/citra_qt/debugger/graphics_tracing.cpp index b6f638b60..944150b8e 100644 --- a/src/citra_qt/debugger/graphics_tracing.cpp +++ b/src/citra_qt/debugger/graphics_tracing.cpp @@ -2,29 +2,22 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/graphics_tracing.h" #include #include #include #include - -#include - #include #include #include #include #include - -#include "citra_qt/debugger/graphics_tracing.h" - +#include #include "common/common_types.h" - #include "core/hw/gpu.h" #include "core/hw/lcd.h" #include "core/tracer/recorder.h" - #include "nihstro/float24.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 0f02bc3da..3b3ffe5c6 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/graphics_vertex_shader.h" #include #include - #include #include #include @@ -15,10 +15,7 @@ #include #include #include - -#include "citra_qt/debugger/graphics_vertex_shader.h" #include "citra_qt/util/util.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/shader/shader.h" diff --git a/src/citra_qt/debugger/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics_vertex_shader.h index 96692d82c..ec42f24bb 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.h +++ b/src/citra_qt/debugger/graphics_vertex_shader.h @@ -5,11 +5,9 @@ #pragma once #include - +#include #include "citra_qt/debugger/graphics_breakpoint_observer.h" - #include "nihstro/parser_shbin.h" - #include "video_core/shader/shader.h" class QLabel; diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 97a377513..39d2d6e39 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/debugger/profiler.h" #include #include #include - -#include "citra_qt/debugger/profiler.h" #include "citra_qt/util/util.h" - #include "common/common_types.h" #include "common/microprofile.h" #include "common/profiler_reporting.h" diff --git a/src/citra_qt/debugger/profiler.h b/src/citra_qt/debugger/profiler.h index d0a90fdee..d8c6487aa 100644 --- a/src/citra_qt/debugger/profiler.h +++ b/src/citra_qt/debugger/profiler.h @@ -7,11 +7,9 @@ #include #include #include - -#include "ui_profiler.h" - #include "common/microprofile.h" #include "common/profiler_reporting.h" +#include "ui_profiler.h" class ProfilerModel : public QAbstractItemModel { Q_OBJECT diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index 87c8c3418..13842dac3 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp @@ -2,11 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include - #include "citra_qt/debugger/registers.h" +#include #include "citra_qt/util/util.h" - #include "core/arm/arm_interface.h" #include "core/core.h" diff --git a/src/citra_qt/debugger/registers.h b/src/citra_qt/debugger/registers.h index cba601731..54c9a8155 100644 --- a/src/citra_qt/debugger/registers.h +++ b/src/citra_qt/debugger/registers.h @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "ui_registers.h" - #include +#include "ui_registers.h" class QTreeWidget; class QTreeWidgetItem; diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 9f9c22a44..16d31be77 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -2,19 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "game_list.h" #include #include #include - -#include "game_list.h" -#include "game_list_p.h" -#include "ui_settings.h" - -#include "core/loader/loader.h" - #include "common/common_paths.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/loader/loader.h" +#include "game_list_p.h" +#include "ui_settings.h" GameList::GameList(QWidget* parent) { QVBoxLayout* layout = new QVBoxLayout; diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index c8a9ee5db..60ab4cf02 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -5,18 +5,14 @@ #pragma once #include - #include #include #include #include - #include "citra_qt/util/util.h" #include "common/color.h" #include "common/string_util.h" - #include "core/loader/smdh.h" - #include "video_core/utils.h" /** diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 3e38223ee..9037f20f2 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/hotkeys.h" #include - #include #include #include - -#include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" struct Hotkey { diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e10314856..82667446b 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -5,25 +5,15 @@ #include #include #include - #include - #define QT_NO_OPENGL #include #include #include #include -#include "qhexedit.h" - #include "citra_qt/bootmanager.h" #include "citra_qt/config.h" #include "citra_qt/configure_dialog.h" -#include "citra_qt/game_list.h" -#include "citra_qt/hotkeys.h" -#include "citra_qt/main.h" -#include "citra_qt/ui_settings.h" - -// Debugger #include "citra_qt/debugger/callstack.h" #include "citra_qt/debugger/disassembler.h" #include "citra_qt/debugger/graphics.h" @@ -35,7 +25,10 @@ #include "citra_qt/debugger/profiler.h" #include "citra_qt/debugger/ramview.h" #include "citra_qt/debugger/registers.h" - +#include "citra_qt/game_list.h" +#include "citra_qt/hotkeys.h" +#include "citra_qt/main.h" +#include "citra_qt/ui_settings.h" #include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" @@ -45,14 +38,13 @@ #include "common/scm_rev.h" #include "common/scope_exit.h" #include "common/string_util.h" - #include "core/arm/disassembler/load_symbol_map.h" #include "core/core.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" #include "core/settings.h" #include "core/system.h" - +#include "qhexedit.h" #include "video_core/video_core.h" GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 10157310e..c4349513f 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -5,9 +5,8 @@ #ifndef _CITRA_QT_MAIN_HXX_ #define _CITRA_QT_MAIN_HXX_ -#include #include - +#include #include "ui_main.h" class Config; diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h index 30f031831..ed7fdff7e 100644 --- a/src/citra_qt/ui_settings.h +++ b/src/citra_qt/ui_settings.h @@ -4,12 +4,11 @@ #pragma once +#include #include #include #include -#include - namespace UISettings { using ContextualShortcut = std::pair; diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index 5868f3b91..0bda21502 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -28,11 +28,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "citra_qt/util/spinbox.h" +#include #include #include -#include - -#include "citra_qt/util/spinbox.h" #include "common/assert.h" CSpinBox::CSpinBox(QWidget* parent) diff --git a/src/citra_qt/util/util.cpp b/src/citra_qt/util/util.cpp index bf44d78ff..e77d3796c 100644 --- a/src/citra_qt/util/util.cpp +++ b/src/citra_qt/util/util.cpp @@ -2,11 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/util/util.h" #include #include -#include "citra_qt/util/util.h" - QFont GetMonospaceFont() { QFont font("monospace"); // Automatic fallback to a monospace font on on platforms without a font called "monospace" diff --git a/src/common/assert.h b/src/common/assert.h index 70214efae..04e80c87a 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_funcs.h" #include "common/logging/log.h" @@ -54,4 +53,4 @@ __declspec(noinline, noreturn) #endif #define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!") -#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__) \ No newline at end of file +#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__) diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 8d45743e2..030f7caeb 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h @@ -33,7 +33,6 @@ #include #include #include - #include "common/common_funcs.h" /* diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 3218db314..4b64a6c7b 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -3,10 +3,9 @@ // Refer to the license.txt file included. #include "common/break_points.h" -#include "common/logging/log.h" - #include #include +#include "common/logging/log.h" bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const { auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; diff --git a/src/common/break_points.h b/src/common/break_points.h index 1a5b7d296..e15b9f842 100644 --- a/src/common/break_points.h +++ b/src/common/break_points.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" class DebugInterface; diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h index 2bf3c774b..5145a3657 100644 --- a/src/common/chunk_file.h +++ b/src/common/chunk_file.h @@ -35,7 +35,6 @@ #include #include #include - #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" diff --git a/src/common/code_block.h b/src/common/code_block.h index 099088925..6a55a8e30 100644 --- a/src/common/code_block.h +++ b/src/common/code_block.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" #include "common/memory_util.h" diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 7032c2117..b141e79ed 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -7,7 +7,6 @@ #if !defined(ARCHITECTURE_x86_64) && !defined(_M_ARM) #include // for exit #endif - #include "common_types.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index c86f663a8..6fd6f1987 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "emu_window.h" #include #include - #include "common/assert.h" #include "common/key_map.h" - -#include "emu_window.h" #include "video_core/video_core.h" void EmuWindow::ButtonPressed(Service::HID::PadState pad) { diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 20131300d..67df63e06 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -6,10 +6,8 @@ #include #include - #include "common/common_types.h" #include "common/math_util.h" - #include "core/hle/service/hid/hid.h" /** diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 96afe2ca0..a0cae11e3 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -16,7 +16,6 @@ #include #include // for SHGetFolderPath #include - #include "common/string_util.h" // 64 bit offsets for windows diff --git a/src/common/file_util.h b/src/common/file_util.h index b15021a63..204b06f14 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -11,9 +11,7 @@ #include #include #include - #include "common/common_types.h" - #ifdef _MSC_VER #include "common/string_util.h" #endif diff --git a/src/common/hash.cpp b/src/common/hash.cpp index a46c92553..5aa5118eb 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -5,7 +5,6 @@ #if defined(_MSC_VER) #include #endif - #include "common_funcs.h" #include "common_types.h" #include "hash.h" diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp index e882f5f52..8380ce489 100644 --- a/src/common/key_map.cpp +++ b/src/common/key_map.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/key_map.h" #include - #include "common/emu_window.h" -#include "common/key_map.h" namespace KeyMap { diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index b3d6598e4..b4a312948 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -2,13 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/logging/backend.h" #include #include #include - #include "common/assert.h" #include "common/common_funcs.h" // snprintf compatibility define -#include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" #include "common/logging/text_formatter.h" diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index 3fe88e4f6..c4fe2acbf 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h @@ -8,7 +8,6 @@ #include #include #include - #include "common/logging/log.h" namespace Log { diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 186e0b621..9aa72cecc 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/logging/filter.h" #include - #include "common/logging/backend.h" -#include "common/logging/filter.h" #include "common/string_util.h" namespace Log { diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h index db526fead..b51df61de 100644 --- a/src/common/logging/filter.h +++ b/src/common/logging/filter.h @@ -7,7 +7,6 @@ #include #include #include - #include "common/logging/log.h" namespace Log { diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 955358553..d61c1696b 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -10,12 +10,11 @@ #include #endif +#include "common/assert.h" +#include "common/common_funcs.h" #include "common/logging/backend.h" #include "common/logging/log.h" #include "common/logging/text_formatter.h" - -#include "common/assert.h" -#include "common/common_funcs.h" #include "common/string_util.h" namespace Log { diff --git a/src/common/misc.cpp b/src/common/misc.cpp index 5938e6289..7be2235b0 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include - #ifdef _WIN32 #include #else diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index 231a0afc1..b40e7205d 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp @@ -5,7 +5,6 @@ #include #include #include - #include "common/assert.h" #include "common/profiler_reporting.h" #include "common/synchronized_wrapper.h" diff --git a/src/common/profiler_reporting.h b/src/common/profiler_reporting.h index fa1ac883f..e9ce6d41c 100644 --- a/src/common/profiler_reporting.h +++ b/src/common/profiler_reporting.h @@ -7,7 +7,6 @@ #include #include #include - #include "common/synchronized_wrapper.h" namespace Common { diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 9ccd6f135..968854bae 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,17 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/string_util.h" #include #include #include #include #include #include - #include "common/common_paths.h" #include "common/logging/log.h" -#include "common/string_util.h" - #ifdef _MSC_VER #include #include diff --git a/src/common/string_util.h b/src/common/string_util.h index 6ffd735f4..075bf4ecb 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -10,7 +10,6 @@ #include #include #include - #include "common/common_types.h" namespace Common { diff --git a/src/common/swap.h b/src/common/swap.h index 72c50d789..e241c9f73 100644 --- a/src/common/swap.h +++ b/src/common/swap.h @@ -24,9 +24,7 @@ #elif defined(__FreeBSD__) #include #endif - #include - #include "common/common_types.h" // GCC 4.6+ diff --git a/src/common/symbols.h b/src/common/symbols.h index 6044c9db6..f5a48e05a 100644 --- a/src/common/symbols.h +++ b/src/common/symbols.h @@ -7,7 +7,6 @@ #include #include #include - #include "common/common_types.h" struct TSymbol { diff --git a/src/common/thread.cpp b/src/common/thread.cpp index bee607ce9..6e7b39b9a 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include "common/thread.h" - #ifdef __APPLE__ #include #elif defined(_WIN32) @@ -16,7 +15,6 @@ #endif #include #endif - #ifndef _WIN32 #include #endif diff --git a/src/common/thread.h b/src/common/thread.h index 499c151c2..9c08be7e3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -8,7 +8,6 @@ #include #include #include - #include "common/common_types.h" // Support for C++11's thread_local keyword was surprisingly spotty in compilers until very diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 0dcf785b6..edd0e4a3f 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -6,7 +6,6 @@ #include #include - #include namespace Common { diff --git a/src/common/timer.cpp b/src/common/timer.cpp index 27560eb0b..e843cbd9c 100644 --- a/src/common/timer.cpp +++ b/src/common/timer.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include - #ifdef _WIN32 #include #include @@ -11,7 +10,6 @@ #else #include #endif - #include "common/common_types.h" #include "common/string_util.h" #include "common/timer.h" diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index 19f1a4030..ac37c42bc 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "cpu_detect.h" #include #include #include - #include "common/common_types.h" -#include "cpu_detect.h" - namespace Common { #ifndef _MSC_VER diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp index 7cf350b4a..b69e4bd5e 100644 --- a/src/common/x64/emitter.cpp +++ b/src/common/x64/emitter.cpp @@ -15,16 +15,14 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "emitter.h" #include #include - +#include "abi.h" #include "common/assert.h" #include "common/logging/log.h" #include "common/memory_util.h" - -#include "abi.h" #include "cpu_detect.h" -#include "emitter.h" namespace Gen { @@ -222,7 +220,7 @@ void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp void OpArg::WriteRest(XEmitter* emit, int extraBytes, X64Reg _operandReg, bool warn_64bit_offset) const { if (_operandReg == INVALID_REG) - _operandReg = (X64Reg)this->operandReg; + _operandReg = (X64Reg) this->operandReg; int mod = 0; int ireg = indexReg; bool SIB = false; diff --git a/src/common/x64/emitter.h b/src/common/x64/emitter.h index 6c9dc3d6b..7d7cdde16 100644 --- a/src/common/x64/emitter.h +++ b/src/common/x64/emitter.h @@ -18,7 +18,6 @@ #pragma once #include - #include "common/assert.h" #include "common/bit_set.h" #include "common/code_block.h" diff --git a/src/core/arm/disassembler/arm_disasm.cpp b/src/core/arm/disassembler/arm_disasm.cpp index b3b9971e8..068f395ac 100644 --- a/src/core/arm/disassembler/arm_disasm.cpp +++ b/src/core/arm/disassembler/arm_disasm.cpp @@ -1,12 +1,10 @@ // Copyright 2006 The Android Open Source Project +#include "core/arm/disassembler/arm_disasm.h" #include #include - #include "common/common_types.h" #include "common/string_util.h" - -#include "core/arm/disassembler/arm_disasm.h" #include "core/arm/skyeye_common/armsupp.h" static const char* cond_names[] = {"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", diff --git a/src/core/arm/disassembler/arm_disasm.h b/src/core/arm/disassembler/arm_disasm.h index 031f973d6..300e228ed 100644 --- a/src/core/arm/disassembler/arm_disasm.h +++ b/src/core/arm/disassembler/arm_disasm.h @@ -3,7 +3,6 @@ #pragma once #include - #include "common/common_types.h" // Note: this list of opcodes must match the list used to initialize diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp index 58e8e6fa1..e602d4511 100644 --- a/src/core/arm/disassembler/load_symbol_map.cpp +++ b/src/core/arm/disassembler/load_symbol_map.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/arm/disassembler/load_symbol_map.h" #include #include #include - #include "common/file_util.h" #include "common/symbols.h" -#include "core/arm/disassembler/load_symbol_map.h" - /* * Loads a symbol map file for use with the disassembler * @param filename String filename path of symbol map file diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index a521aec7c..b57d9e65b 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/arm/dynarmic/arm_dynarmic.h" +#include #include "common/assert.h" #include "common/microprofile.h" - -#include - -#include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index d493cabd5..ced86d29b 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h @@ -5,11 +5,8 @@ #pragma once #include - #include - #include "common/common_types.h" - #include "core/arm/arm_interface.h" #include "core/arm/skyeye_common/armstate.h" diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index 912560402..bc9ba2941 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -2,18 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/arm/dyncom/arm_dyncom.h" #include #include - -#include "core/arm/skyeye_common/armstate.h" -#include "core/arm/skyeye_common/armsupp.h" -#include "core/arm/skyeye_common/vfp/vfp.h" - -#include "core/arm/dyncom/arm_dyncom.h" #include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/arm/dyncom/arm_dyncom_run.h" #include "core/arm/dyncom/arm_dyncom_trans.h" - +#include "core/arm/skyeye_common/armstate.h" +#include "core/arm/skyeye_common/armsupp.h" +#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h index 70f71a828..65db1f0f9 100644 --- a/src/core/arm/dyncom/arm_dyncom.h +++ b/src/core/arm/dyncom/arm_dyncom.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "core/arm/arm_interface.h" #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/armstate.h" diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 211d49edb..4f83d8332 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -4,27 +4,24 @@ #define CITRA_IGNORE_EXIT(x) +#include "core/arm/dyncom/arm_dyncom_interpreter.h" #include #include - #include "common/common_types.h" #include "common/logging/log.h" #include "common/microprofile.h" - #include "core/arm/disassembler/arm_disasm.h" #include "core/arm/dyncom/arm_dyncom_dec.h" -#include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/arm/dyncom/arm_dyncom_run.h" #include "core/arm/dyncom/arm_dyncom_thumb.h" #include "core/arm/dyncom/arm_dyncom_trans.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/armsupp.h" #include "core/arm/skyeye_common/vfp/vfp.h" +#include "core/gdbstub/gdbstub.h" #include "core/hle/svc.h" #include "core/memory.h" -#include "core/gdbstub/gdbstub.h" - #define RM BITS(sht_oper, 0, 3) #define RS BITS(sht_oper, 8, 11) diff --git a/src/core/arm/dyncom/arm_dyncom_trans.cpp b/src/core/arm/dyncom/arm_dyncom_trans.cpp index 526cf28f3..5f3644c28 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.cpp +++ b/src/core/arm/dyncom/arm_dyncom_trans.cpp @@ -1,10 +1,8 @@ +#include "core/arm/dyncom/arm_dyncom_trans.h" #include - #include "common/assert.h" #include "common/common_types.h" - #include "core/arm/dyncom/arm_dyncom_interpreter.h" -#include "core/arm/dyncom/arm_dyncom_trans.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/armsupp.h" #include "core/arm/skyeye_common/vfp/vfp.h" diff --git a/src/core/arm/dyncom/arm_dyncom_trans.h b/src/core/arm/dyncom/arm_dyncom_trans.h index 6fdb3d248..b1ec90662 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.h +++ b/src/core/arm/dyncom/arm_dyncom_trans.h @@ -1,3 +1,6 @@ +#include +#include "common/common_types.h" + struct ARMul_State; typedef unsigned int (*shtop_fp_t)(ARMul_State* cpu, unsigned int sht_oper); diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h index f31fb207c..1a707ff7e 100644 --- a/src/core/arm/skyeye_common/armstate.h +++ b/src/core/arm/skyeye_common/armstate.h @@ -19,7 +19,6 @@ #include #include - #include "common/common_types.h" #include "core/arm/skyeye_common/arm_regformat.h" diff --git a/src/core/arm/skyeye_common/armsupp.cpp b/src/core/arm/skyeye_common/armsupp.cpp index e70be29a7..b76942e47 100644 --- a/src/core/arm/skyeye_common/armsupp.cpp +++ b/src/core/arm/skyeye_common/armsupp.cpp @@ -15,11 +15,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "core/arm/skyeye_common/armsupp.h" #include "common/logging/log.h" - #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/armstate.h" -#include "core/arm/skyeye_common/armsupp.h" // Unsigned sum of absolute difference u8 ARMul_UnsignedAbsoluteDifference(u8 left, u8 right) { diff --git a/src/core/arm/skyeye_common/vfp/vfp.cpp b/src/core/arm/skyeye_common/vfp/vfp.cpp index 859937645..8ac1fb95e 100644 --- a/src/core/arm/skyeye_common/vfp/vfp.cpp +++ b/src/core/arm/skyeye_common/vfp/vfp.cpp @@ -20,13 +20,12 @@ /* Note: this file handles interface with arm core and vfp registers */ +#include "core/arm/skyeye_common/vfp/vfp.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" -#include "core/arm/skyeye_common/vfp/vfp.h" void VFPInit(ARMul_State* state) { state->VFP[VFP_FPSID] = VFP_FPSID_IMPLMEN << 24 | VFP_FPSID_SW << 23 | VFP_FPSID_SUBARCH << 16 | diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp index 2886f351f..4d89743e7 100644 --- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp @@ -51,10 +51,10 @@ * =========================================================================== */ +#include "core/arm/skyeye_common/vfp/vfp.h" #include #include "common/logging/log.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" -#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/arm/skyeye_common/vfp/vfp_helper.h" static struct vfp_double vfp_double_default_qnan = { diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp index bf157e2c3..35f9d84d5 100644 --- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp @@ -51,15 +51,13 @@ * =========================================================================== */ +#include "core/arm/skyeye_common/vfp/vfp.h" #include #include - #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/arm/skyeye_common/vfp/asm_vfp.h" -#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/arm/skyeye_common/vfp/vfp_helper.h" static struct vfp_single vfp_single_default_qnan = { diff --git a/src/core/core.cpp b/src/core/core.cpp index 71a13dd33..346b6a0ae 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/core.h" #include - #include "common/logging/log.h" - #include "core/arm/arm_interface.h" #include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dyncom/arm_dyncom.h" -#include "core/core.h" #include "core/core_timing.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/hle.h" diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index fb88ecaf2..4f38403e3 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -2,17 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/core.h" #include #include #include #include - #include "common/chunk_file.h" #include "common/logging/log.h" #include "common/string_util.h" - #include "core/arm/arm_interface.h" -#include "core/core.h" #include "core/core_timing.h" int g_clock_rate_arm11 = 268123480; diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 64fd8dcd0..b72a1b500 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -4,7 +4,9 @@ #pragma once +#include #include +#include "common/common_types.h" // This is a system to schedule events into the emulated machine's future. Time is measured // in main CPU clock cycles. @@ -19,10 +21,6 @@ // inside callback: // ScheduleEvent(periodInCycles - cycles_late, callback, "whatever") -#include - -#include "common/common_types.h" - extern int g_clock_rate_arm11; inline s64 msToCycles(int ms) { diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 6ea920ec1..5c02fb748 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_backend.h" #include #include #include - #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/file_sys/archive_backend.h" #include "core/memory.h" namespace FileSys { diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 7f64fe4e2..d69c3c785 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -8,11 +8,9 @@ #include #include #include - #include "common/bit_field.h" #include "common/common_types.h" #include "common/swap.h" - #include "core/hle/result.h" namespace FileSys { diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp index 6b4af28bf..ed9fecd64 100644 --- a/src/core/file_sys/archive_extsavedata.cpp +++ b/src/core/file_sys/archive_extsavedata.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_extsavedata.h" #include #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_extsavedata.h b/src/core/file_sys/archive_extsavedata.h index 2b942817e..6a3431e94 100644 --- a/src/core/file_sys/archive_extsavedata.h +++ b/src/core/file_sys/archive_extsavedata.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 87455eb95..7c0e1da21 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_romfs.h" #include #include - #include "common/common_types.h" #include "common/logging/log.h" - -#include "core/file_sys/archive_romfs.h" #include "core/file_sys/ivfc_archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index 3c68a6b1c..8a8082a05 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -7,9 +7,7 @@ #include #include #include - #include "common/common_types.h" - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" #include "core/loader/loader.h" diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index 860f2fca8..829f97743 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_savedata.h" #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/file_sys/archive_savedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/kernel/process.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h index 4ac324985..6a372865a 100644 --- a/src/core/file_sys/archive_savedata.h +++ b/src/core/file_sys/archive_savedata.h @@ -6,7 +6,6 @@ #include #include - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp index 50fe004fe..8bdf24b1f 100644 --- a/src/core/file_sys/archive_savedatacheck.cpp +++ b/src/core/file_sys/archive_savedatacheck.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_savedatacheck.h" #include #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/file_sys/archive_savedatacheck.h" #include "core/file_sys/ivfc_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_savedatacheck.h b/src/core/file_sys/archive_savedatacheck.h index 4a4259260..e9cafbed9 100644 --- a/src/core/file_sys/archive_savedatacheck.h +++ b/src/core/file_sys/archive_savedatacheck.h @@ -6,7 +6,6 @@ #include #include - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index c1a28df6c..887cfbb0f 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_sdmc.h" #include #include - #include "common/file_util.h" #include "common/logging/log.h" - -#include "core/file_sys/archive_sdmc.h" #include "core/file_sys/disk_archive.h" #include "core/settings.h" diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index 2523c3979..88e855351 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -6,7 +6,6 @@ #include #include - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index 0261ab547..b3dfcf897 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/archive_systemsavedata.h" #include #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/string_util.h" - -#include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_systemsavedata.h b/src/core/file_sys/archive_systemsavedata.h index 61a002a7d..a24b89f2b 100644 --- a/src/core/file_sys/archive_systemsavedata.h +++ b/src/core/file_sys/archive_systemsavedata.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/file_sys/archive_backend.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory_backend.h index 9706e909b..b55e382ef 100644 --- a/src/core/file_sys/directory_backend.h +++ b/src/core/file_sys/directory_backend.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp index c084303c1..7e88473bd 100644 --- a/src/core/file_sys/disk_archive.cpp +++ b/src/core/file_sys/disk_archive.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/disk_archive.h" #include #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" -#include "core/file_sys/disk_archive.h" - //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h index 64e36f5ea..2165f27f9 100644 --- a/src/core/file_sys/disk_archive.h +++ b/src/core/file_sys/disk_archive.h @@ -8,10 +8,8 @@ #include #include #include - #include "common/common_types.h" #include "common/file_util.h" - #include "core/file_sys/archive_backend.h" #include "core/file_sys/directory_backend.h" #include "core/file_sys/file_backend.h" diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h index 3496facd4..ed997537f 100644 --- a/src/core/file_sys/file_backend.h +++ b/src/core/file_sys/file_backend.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" #include "core/hle/result.h" diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp index 235a962e9..5add3254b 100644 --- a/src/core/file_sys/ivfc_archive.cpp +++ b/src/core/file_sys/ivfc_archive.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/file_sys/ivfc_archive.h" #include #include - #include "common/common_types.h" #include "common/logging/log.h" -#include "core/file_sys/ivfc_archive.h" - //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h index 0d15550da..0df6cf83a 100644 --- a/src/core/file_sys/ivfc_archive.h +++ b/src/core/file_sys/ivfc_archive.h @@ -8,10 +8,8 @@ #include #include #include - #include "common/common_types.h" #include "common/file_util.h" - #include "core/file_sys/archive_backend.h" #include "core/file_sys/directory_backend.h" #include "core/file_sys/file_backend.h" diff --git a/src/core/gdbstub/gdbstub.h b/src/core/gdbstub/gdbstub.h index fddc27a3e..a7483bb10 100644 --- a/src/core/gdbstub/gdbstub.h +++ b/src/core/gdbstub/gdbstub.h @@ -6,7 +6,6 @@ #pragma once #include - #include "common/common_types.h" namespace GDBStub { diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp index 2b4bd939d..35e683cb3 100644 --- a/src/core/hle/applets/applet.cpp +++ b/src/core/hle/applets/applet.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/applets/applet.h" #include #include #include #include - #include "common/assert.h" #include "common/common_types.h" - #include "core/core_timing.h" -#include "core/hle/applets/applet.h" #include "core/hle/applets/erreula.h" #include "core/hle/applets/mii_selector.h" #include "core/hle/applets/swkbd.h" diff --git a/src/core/hle/applets/applet.h b/src/core/hle/applets/applet.h index 1850ad261..bfdcad126 100644 --- a/src/core/hle/applets/applet.h +++ b/src/core/hle/applets/applet.h @@ -5,7 +5,6 @@ #pragma once #include - #include "core/hle/result.h" #include "core/hle/service/apt/apt.h" diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 457cbb1bd..9ad77994c 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/string_util.h" - #include "core/hle/applets/erreula.h" +#include "common/string_util.h" #include "core/hle/service/apt/apt.h" namespace HLE { diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 79264d349..53d5b4ab4 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -2,18 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/applets/mii_selector.h" #include #include - #include "common/assert.h" #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/hle/applets/mii_selector.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" - #include "video_core/video_core.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/applets/mii_selector.h b/src/core/hle/applets/mii_selector.h index 26966a271..e3ab9f0cd 100644 --- a/src/core/hle/applets/mii_selector.h +++ b/src/core/hle/applets/mii_selector.h @@ -6,7 +6,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" - #include "core/hle/applets/applet.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index cf2775968..b26107332 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -2,21 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/applets/swkbd.h" #include #include - #include "common/assert.h" #include "common/logging/log.h" #include "common/string_util.h" - -#include "core/hle/applets/swkbd.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" #include "core/hle/service/gsp_gpu.h" #include "core/hle/service/hid/hid.h" #include "core/memory.h" - #include "video_core/video_core.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h index 4e2f9de62..ea0b1fba9 100644 --- a/src/core/hle/applets/swkbd.h +++ b/src/core/hle/applets/swkbd.h @@ -6,7 +6,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" - #include "core/hle/applets/applet.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" diff --git a/src/core/hle/config_mem.h b/src/core/hle/config_mem.h index 50664dac6..42fa6d789 100644 --- a/src/core/hle/config_mem.h +++ b/src/core/hle/config_mem.h @@ -12,7 +12,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" - #include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index d5d989c29..8ce0f6d2b 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h @@ -5,8 +5,8 @@ #pragma once #include "common/common_types.h" - #include "core/arm/arm_interface.h" +#include "core/core.h" #include "core/hle/hle.h" #include "core/hle/result.h" #include "core/hle/svc.h" diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 480a73e80..5749068d6 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/hle.h" #include "common/assert.h" #include "common/logging/log.h" - #include "core/arm/arm_interface.h" #include "core/core.h" -#include "core/hle/hle.h" #include "core/hle/service/service.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 3506c2d48..bcb4ee46f 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/address_arbiter.h" #include "common/common_types.h" #include "common/logging/log.h" - -#include "core/memory.h" - #include "core/hle/hle.h" -#include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/thread.h" +#include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Kernel namespace diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h index 1a03993b2..6a7af93a9 100644 --- a/src/core/hle/kernel/address_arbiter.h +++ b/src/core/hle/kernel/address_arbiter.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" // Address arbiters are an underlying kernel synchronization object that can be created/used via diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 444ce8d45..eed333995 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/assert.h" - #include "core/hle/kernel/client_port.h" +#include "common/assert.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/server_port.h" diff --git a/src/core/hle/kernel/client_port.h b/src/core/hle/kernel/client_port.h index 70e0d56cc..d28147718 100644 --- a/src/core/hle/kernel/client_port.h +++ b/src/core/hle/kernel/client_port.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index f056eb7c3..cf8e6fa17 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/event.h" #include #include #include - #include "common/assert.h" - -#include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index e333a46ce..6fe74065d 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 1fd7c0326..49bf95618 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/kernel.h" #include - #include "common/assert.h" #include "common/logging/log.h" - #include "core/hle/config_mem.h" -#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index c683fcb80..0e95f7ff0 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -4,16 +4,13 @@ #pragma once -#include - #include #include #include #include #include - +#include #include "common/common_types.h" - #include "core/hle/hle.h" #include "core/hle/result.h" diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp index 89a72808a..d13bc74c6 100644 --- a/src/core/hle/kernel/memory.cpp +++ b/src/core/hle/kernel/memory.cpp @@ -2,18 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/memory.h" #include #include #include #include - #include "audio_core/audio_core.h" - #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hle/config_mem.h" -#include "core/hle/kernel/memory.h" #include "core/hle/kernel/vm_manager.h" #include "core/hle/result.h" #include "core/hle/shared_page.h" diff --git a/src/core/hle/kernel/memory.h b/src/core/hle/kernel/memory.h index b941c24b6..4e1856a41 100644 --- a/src/core/hle/kernel/memory.h +++ b/src/core/hle/kernel/memory.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "core/hle/kernel/process.h" namespace Kernel { diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index edb97d324..4cd237b44 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -2,15 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/mutex.h" #include #include - #include - #include "common/assert.h" - #include "core/hle/kernel/kernel.h" -#include "core/hle/kernel/mutex.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index cf6a51fdf..53c3dc1f1 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index b764f750f..a94d74263 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/process.h" #include - #include "common/assert.h" #include "common/common_funcs.h" #include "common/logging/log.h" - #include "core/hle/kernel/memory.h" -#include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/thread.h" #include "core/hle/kernel/vm_manager.h" diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 070b2b558..b566950b0 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h @@ -8,12 +8,9 @@ #include #include #include - #include - #include "common/bit_field.h" #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/vm_manager.h" diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index bb0baed6f..64c91cc62 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/resource_limit.h" #include - #include "common/logging/log.h" -#include "core/hle/kernel/resource_limit.h" - namespace Kernel { static SharedPtr resource_limits[4]; diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h index 5d8b31a2d..6cdfbcf8d 100644 --- a/src/core/hle/kernel/resource_limit.h +++ b/src/core/hle/kernel/resource_limit.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index 16ac22f1d..2a9ced5b9 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/semaphore.h" #include "common/assert.h" - #include "core/hle/kernel/kernel.h" -#include "core/hle/kernel/semaphore.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index ed7d9a85c..e01908a25 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index 57e93cad4..12a709cee 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/server_port.h" #include - #include "common/assert.h" - #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" -#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.h index c3f2ae177..fa9448ca0 100644 --- a/src/core/hle/kernel/server_port.h +++ b/src/core/hle/kernel/server_port.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" namespace Kernel { diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index 8e4e010b8..ec025f732 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h @@ -5,10 +5,8 @@ #pragma once #include - #include "common/assert.h" #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" #include "core/hle/result.h" diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index bf511a338..8ab916e5b 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/shared_memory.h" #include - #include "common/logging/log.h" - #include "core/hle/kernel/memory.h" -#include "core/hle/kernel/shared_memory.h" #include "core/memory.h" namespace Kernel { diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h index afb142380..94b335ed1 100644 --- a/src/core/hle/kernel/shared_memory.h +++ b/src/core/hle/kernel/shared_memory.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/process.h" #include "core/hle/result.h" diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 0df03c9d5..0185c3ae3 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -2,16 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/thread.h" #include #include #include - #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/math_util.h" #include "common/thread_queue_list.h" - #include "core/arm/arm_interface.h" #include "core/arm/skyeye_common/armstate.h" #include "core/core.h" @@ -21,7 +20,6 @@ #include "core/hle/kernel/memory.h" #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/process.h" -#include "core/hle/kernel/thread.h" #include "core/hle/result.h" #include "core/memory.h" diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 2ed5cf74e..f63131716 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -6,13 +6,9 @@ #include #include - #include - #include "common/common_types.h" - #include "core/core.h" - #include "core/hle/hle.h" #include "core/hle/kernel/kernel.h" #include "core/hle/result.h" diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 427a81923..7432f3567 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/timer.h" #include - #include "common/assert.h" #include "common/logging/log.h" - #include "core/core_timing.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" -#include "core/hle/kernel/timer.h" namespace Kernel { diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h index 97cd0d63c..59a77aad3 100644 --- a/src/core/hle/kernel/timer.h +++ b/src/core/hle/kernel/timer.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 4ad86cf48..488898641 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -2,11 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/kernel/vm_manager.h" #include - #include "common/assert.h" - -#include "core/hle/kernel/vm_manager.h" #include "core/memory.h" #include "core/memory_setup.h" #include "core/mmio.h" diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index fbcd9870f..9055664b2 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h @@ -7,9 +7,7 @@ #include #include #include - #include "common/common_types.h" - #include "core/hle/result.h" #include "core/mmio.h" diff --git a/src/core/hle/result.h b/src/core/hle/result.h index 492c1ffa6..7f8d8e00d 100644 --- a/src/core/hle/result.h +++ b/src/core/hle/result.h @@ -6,7 +6,6 @@ #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/common_funcs.h" diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp index 887b57529..0b61bfae8 100644 --- a/src/core/hle/service/ac_u.cpp +++ b/src/core/hle/service/ac_u.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ac_u.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/ac_u.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace AC_U diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 528bb1848..e9adfaa1b 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -2,11 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/am/am.h" #include - #include "common/logging/log.h" - -#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_app.h" #include "core/hle/service/am/am_net.h" #include "core/hle/service/am/am_sys.h" diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index dfc1e9c08..6240286bb 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -2,12 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/apt/apt.h" #include "common/common_paths.h" #include "common/file_util.h" #include "common/logging/log.h" - #include "core/hle/applets/applet.h" -#include "core/hle/service/apt/apt.h" +#include "core/hle/kernel/event.h" +#include "core/hle/kernel/mutex.h" +#include "core/hle/kernel/process.h" +#include "core/hle/kernel/shared_memory.h" #include "core/hle/service/apt/apt_a.h" #include "core/hle/service/apt/apt_s.h" #include "core/hle/service/apt/apt_u.h" @@ -16,11 +19,6 @@ #include "core/hle/service/ptm/ptm.h" #include "core/hle/service/service.h" -#include "core/hle/kernel/event.h" -#include "core/hle/kernel/mutex.h" -#include "core/hle/kernel/process.h" -#include "core/hle/kernel/shared_memory.h" - namespace Service { namespace APT { diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 7597b0d3e..a118cda1f 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -6,7 +6,6 @@ #include "common/common_types.h" #include "common/swap.h" - #include "core/hle/kernel/kernel.h" namespace Service { diff --git a/src/core/hle/service/apt/bcfnt/bcfnt.h b/src/core/hle/service/apt/bcfnt/bcfnt.h index 8936dcf63..453bf7606 100644 --- a/src/core/hle/service/apt/bcfnt/bcfnt.h +++ b/src/core/hle/service/apt/bcfnt/bcfnt.h @@ -5,7 +5,6 @@ #pragma once #include "common/swap.h" - #include "core/hle/kernel/shared_memory.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index ec1f9c749..be2e42963 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/cam/cam.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_c.h" #include "core/hle/service/cam/cam_q.h" #include "core/hle/service/cam/cam_s.h" diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index ec9b835f1..c9b6f8acf 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -7,7 +7,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" - #include "core/hle/kernel/kernel.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index 65a1d850b..4d8916bdf 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/cecd/cecd.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/cecd/cecd.h" #include "core/hle/service/cecd/cecd_s.h" #include "core/hle/service/cecd/cecd_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index aff033bde..1f706751f 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -2,17 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/cfg/cfg.h" #include - #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" #include "common/swap.h" - #include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/file_backend.h" #include "core/hle/result.h" -#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_i.h" #include "core/hle/service/cfg/cfg_s.h" #include "core/hle/service/cfg/cfg_u.h" diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h index c7c2ab41d..fb47c2aa5 100644 --- a/src/core/hle/service/cfg/cfg.h +++ b/src/core/hle/service/cfg/cfg.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" union ResultCode; diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 70e92c30c..3f2f09f60 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp @@ -2,16 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/dsp_dsp.h" #include #include - #include "audio_core/hle/pipe.h" - #include "common/hash.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/dsp_dsp.h" using DspPipe = DSP::HLE::DspPipe; diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h index 22f6687cc..3e97da6eb 100644 --- a/src/core/hle/service/dsp_dsp.h +++ b/src/core/hle/service/dsp_dsp.h @@ -5,7 +5,6 @@ #pragma once #include - #include "core/hle/service/service.h" namespace DSP { diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index a23f5896d..ff606d883 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/err_f.h" #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" -#include "core/hle/service/err_f.h" - //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace ERR_F diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp index 050665b48..bd89b522b 100644 --- a/src/core/hle/service/frd/frd.cpp +++ b/src/core/hle/service/frd/frd.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/string_util.h" - #include "core/hle/service/frd/frd.h" +#include "common/string_util.h" #include "core/hle/service/frd/frd_a.h" #include "core/hle/service/frd/frd_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 77fe5ab6c..b945b255e 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -2,20 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/fs/archive.h" #include #include #include #include #include #include - #include - #include "common/assert.h" #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" - #include "core/file_sys/archive_backend.h" #include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/archive_savedata.h" @@ -26,7 +24,6 @@ #include "core/file_sys/file_backend.h" #include "core/hle/hle.h" #include "core/hle/result.h" -#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/fs_user.h" #include "core/hle/service/service.h" #include "core/memory.h" diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index aad540ff9..533be34a4 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/file_sys/archive_backend.h" #include "core/hle/kernel/session.h" #include "core/hle/result.h" diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index 605832214..92578270b 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -2,16 +2,15 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/fs/fs_user.h" #include "common/assert.h" #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/scope_exit.h" #include "common/string_util.h" - #include "core/hle/result.h" #include "core/hle/service/fs/archive.h" -#include "core/hle/service/fs/fs_user.h" #include "core/settings.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 2dff1e16c..ba148eaf1 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "gsp_gpu.h" #include "common/bit_field.h" #include "common/microprofile.h" - #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" @@ -12,12 +12,9 @@ #include "core/hw/hw.h" #include "core/hw/lcd.h" #include "core/memory.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu_debugger.h" -#include "gsp_gpu.h" - // Main graphics debugger object - TODO: Here is probably not the best place for this GraphicsDebugger g_debugger; diff --git a/src/core/hle/service/gsp_gpu.h b/src/core/hle/service/gsp_gpu.h index e028123f3..79a72f77d 100644 --- a/src/core/hle/service/gsp_gpu.h +++ b/src/core/hle/service/gsp_gpu.h @@ -6,10 +6,8 @@ #include #include - #include "common/bit_field.h" #include "common/common_types.h" - #include "core/hle/result.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5a2edd3c0..a050e81f7 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -2,20 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/hid/hid.h" #include - #include "common/emu_window.h" #include "common/logging/log.h" - -#include "core/hle/service/hid/hid.h" -#include "core/hle/service/hid/hid_spvr.h" -#include "core/hle/service/hid/hid_user.h" -#include "core/hle/service/service.h" - #include "core/core_timing.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" - +#include "core/hle/service/hid/hid_spvr.h" +#include "core/hle/service/hid/hid_user.h" +#include "core/hle/service/service.h" #include "video_core/video_core.h" namespace Service { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index f54ffd8be..7904e7355 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -5,7 +5,6 @@ #pragma once #include - #ifndef _MSC_VER #include #endif diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index fc048ae88..459fe0691 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ir/ir.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" - -#include "core/hle/service/ir/ir.h" #include "core/hle/service/ir/ir_rst.h" #include "core/hle/service/ir/ir_u.h" #include "core/hle/service/ir/ir_user.h" diff --git a/src/core/hle/service/ldr_ro/cro_helper.cpp b/src/core/hle/service/ldr_ro/cro_helper.cpp index b5da9a960..f583f5c31 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.cpp +++ b/src/core/hle/service/ldr_ro/cro_helper.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ldr_ro/cro_helper.h" #include "common/alignment.h" #include "common/logging/log.h" #include "common/scope_exit.h" -#include "core/hle/service/ldr_ro/cro_helper.h" - //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace LDR_RO diff --git a/src/core/hle/service/ldr_ro/cro_helper.h b/src/core/hle/service/ldr_ro/cro_helper.h index e1b8221bd..6a0d0d3bf 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.h +++ b/src/core/hle/service/ldr_ro/cro_helper.h @@ -6,10 +6,8 @@ #include #include - #include "common/common_types.h" #include "common/swap.h" - #include "core/hle/result.h" #include "core/memory.h" diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp index a8fc2c015..3faa2e5d7 100644 --- a/src/core/hle/service/ldr_ro/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp @@ -2,15 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ldr_ro/ldr_ro.h" #include "common/alignment.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/arm/arm_interface.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/vm_manager.h" #include "core/hle/service/ldr_ro/cro_helper.h" -#include "core/hle/service/ldr_ro/ldr_ro.h" #include "core/hle/service/ldr_ro/memory_synchronizer.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp index aed6d3365..a3e590dfd 100644 --- a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp +++ b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ldr_ro/memory_synchronizer.h" #include - #include "common/assert.h" -#include "core/hle/service/ldr_ro/memory_synchronizer.h" - //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace LDR_RO diff --git a/src/core/hle/service/ldr_ro/memory_synchronizer.h b/src/core/hle/service/ldr_ro/memory_synchronizer.h index 92f267912..883ee4acf 100644 --- a/src/core/hle/service/ldr_ro/memory_synchronizer.h +++ b/src/core/hle/service/ldr_ro/memory_synchronizer.h @@ -5,7 +5,6 @@ #pragma once #include - #include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/news/news.cpp b/src/core/hle/service/news/news.cpp index e09ea5681..f22c49f52 100644 --- a/src/core/hle/service/news/news.cpp +++ b/src/core/hle/service/news/news.cpp @@ -2,9 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/logging/log.h" - #include "core/hle/service/news/news.h" +#include "common/logging/log.h" #include "core/hle/service/news/news_s.h" #include "core/hle/service/news/news_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index a7b76ed67..60505545c 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/nim/nim.h" #include "common/common_types.h" #include "common/logging/log.h" - -#include "core/hle/service/nim/nim.h" #include "core/hle/service/nim/nim_aoc.h" #include "core/hle/service/nim/nim_s.h" #include "core/hle/service/nim/nim_u.h" diff --git a/src/core/hle/service/nim/nim_u.h b/src/core/hle/service/nim/nim_u.h index bc89dc0f3..c4b74985a 100644 --- a/src/core/hle/service/nim/nim_u.h +++ b/src/core/hle/service/nim/nim_u.h @@ -1,6 +1,6 @@ // Copyright 2015 Citra Emulator Project // Licensed under GPLv2 or any later version -// Refer to the license.txt file included.. +// Refer to the license.txt file included. #pragma once diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index ed417fa9a..3b608dcbb 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp @@ -2,11 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/nwm_uds.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/nwm_uds.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace NWM_UDS diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index a531aad87..eff51af04 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -2,44 +2,42 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/service.h" #include "common/logging/log.h" #include "common/string_util.h" - #include "core/hle/service/ac_u.h" #include "core/hle/service/act_a.h" #include "core/hle/service/act_u.h" -#include "core/hle/service/csnd_snd.h" -#include "core/hle/service/dsp_dsp.h" -#include "core/hle/service/err_f.h" -#include "core/hle/service/gsp_gpu.h" -#include "core/hle/service/gsp_lcd.h" -#include "core/hle/service/http_c.h" -#include "core/hle/service/mic_u.h" -#include "core/hle/service/ns_s.h" -#include "core/hle/service/nwm_uds.h" -#include "core/hle/service/pm_app.h" -#include "core/hle/service/service.h" -#include "core/hle/service/soc_u.h" -#include "core/hle/service/srv.h" -#include "core/hle/service/ssl_c.h" -#include "core/hle/service/y2r_u.h" - #include "core/hle/service/am/am.h" #include "core/hle/service/apt/apt.h" #include "core/hle/service/boss/boss.h" #include "core/hle/service/cam/cam.h" #include "core/hle/service/cecd/cecd.h" #include "core/hle/service/cfg/cfg.h" +#include "core/hle/service/csnd_snd.h" #include "core/hle/service/dlp/dlp.h" +#include "core/hle/service/dsp_dsp.h" +#include "core/hle/service/err_f.h" #include "core/hle/service/frd/frd.h" #include "core/hle/service/fs/archive.h" +#include "core/hle/service/gsp_gpu.h" +#include "core/hle/service/gsp_lcd.h" #include "core/hle/service/hid/hid.h" +#include "core/hle/service/http_c.h" #include "core/hle/service/ir/ir.h" #include "core/hle/service/ldr_ro/ldr_ro.h" +#include "core/hle/service/mic_u.h" #include "core/hle/service/ndm/ndm.h" #include "core/hle/service/news/news.h" #include "core/hle/service/nim/nim.h" +#include "core/hle/service/ns_s.h" +#include "core/hle/service/nwm_uds.h" +#include "core/hle/service/pm_app.h" #include "core/hle/service/ptm/ptm.h" +#include "core/hle/service/soc_u.h" +#include "core/hle/service/srv.h" +#include "core/hle/service/ssl_c.h" +#include "core/hle/service/y2r_u.h" namespace Service { diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index cd216f27e..39b5ffaae 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -7,11 +7,8 @@ #include #include #include - #include - #include "common/common_types.h" - #include "core/hle/kernel/session.h" #include "core/hle/result.h" diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 302ab55b7..1eab61e52 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -2,20 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/soc_u.h" #include #include #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/scope_exit.h" - #include "core/hle/kernel/session.h" #include "core/hle/result.h" -#include "core/hle/service/soc_u.h" #include "core/memory.h" #ifdef _WIN32 diff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.h index a091f597c..8d02ed30f 100644 --- a/src/core/hle/service/soc_u.h +++ b/src/core/hle/service/soc_u.h @@ -5,7 +5,6 @@ #pragma once #include - #include "core/hle/service/service.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index fda9d8acf..241a5da94 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -2,11 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/srv.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" -#include "core/hle/service/srv.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace SRV diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp index 78ab922ca..16ec3d116 100644 --- a/src/core/hle/service/ssl_c.cpp +++ b/src/core/hle/service/ssl_c.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/ssl_c.h" #include - #include "common/common_types.h" -#include "core/hle/service/ssl_c.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace SSL_C diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index d3c6d073e..38e15b5d0 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -2,15 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/service/y2r_u.h" #include - #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" -#include "core/hle/service/y2r_u.h" #include "core/hw/y2r.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/y2r_u.h b/src/core/hle/service/y2r_u.h index 95fa2fdb7..1b47b5322 100644 --- a/src/core/hle/service/y2r_u.h +++ b/src/core/hle/service/y2r_u.h @@ -6,9 +6,7 @@ #include #include - #include "common/common_types.h" - #include "core/hle/result.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 453fcf7ec..74a9031c5 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hle/shared_page.h" #include #include #include - #include "core/core_timing.h" -#include "core/hle/shared_page.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/shared_page.h b/src/core/hle/shared_page.h index b3b10be31..106e47efc 100644 --- a/src/core/hle/shared_page.h +++ b/src/core/hle/shared_page.h @@ -13,7 +13,6 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" - #include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 9d0a9c54c..02b397eba 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -3,16 +3,14 @@ // Refer to the license.txt file included. #include - #include "common/logging/log.h" #include "common/microprofile.h" #include "common/scope_exit.h" #include "common/string_util.h" #include "common/symbols.h" - #include "core/arm/arm_interface.h" #include "core/core_timing.h" - +#include "core/hle/function_wrappers.h" #include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/event.h" @@ -26,8 +24,6 @@ #include "core/hle/kernel/thread.h" #include "core/hle/kernel/timer.h" #include "core/hle/kernel/vm_manager.h" - -#include "core/hle/function_wrappers.h" #include "core/hle/result.h" #include "core/hle/service/service.h" diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index bf2c066f4..776c8fef7 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -2,36 +2,29 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hw/gpu.h" #include #include #include - #include "common/color.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/microprofile.h" #include "common/vector_math.h" - #include "core/core_timing.h" -#include "core/memory.h" -#include "core/settings.h" - #include "core/hle/service/gsp_gpu.h" #include "core/hle/service/hid/hid.h" - -#include "core/hw/gpu.h" #include "core/hw/hw.h" - +#include "core/memory.h" +#include "core/settings.h" #include "core/tracer/recorder.h" - #include "video_core/command_processor.h" +#include "video_core/debug_utils/debug_utils.h" #include "video_core/rasterizer_interface.h" #include "video_core/renderer_base.h" #include "video_core/utils.h" #include "video_core/video_core.h" -#include "video_core/debug_utils/debug_utils.h" - namespace GPU { Regs g_regs; diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index 077b6255f..32ddc5697 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -6,7 +6,6 @@ #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/common_funcs.h" diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 71f44cbc4..0f84d5adb 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -2,11 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hw/hw.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hw/gpu.h" -#include "core/hw/hw.h" #include "core/hw/lcd.h" namespace HW { diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp index 0e3aa7cfd..5231e4cc5 100644 --- a/src/core/hw/lcd.cpp +++ b/src/core/hw/lcd.cpp @@ -2,14 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hw/lcd.h" #include - #include "common/common_types.h" #include "common/logging/log.h" - #include "core/hw/hw.h" -#include "core/hw/lcd.h" - #include "core/tracer/recorder.h" #include "video_core/debug_utils/debug_utils.h" diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h index 404833165..191fd44af 100644 --- a/src/core/hw/lcd.h +++ b/src/core/hw/lcd.h @@ -6,7 +6,6 @@ #include #include - #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp index 838b14163..0e13420d7 100644 --- a/src/core/hw/y2r.cpp +++ b/src/core/hw/y2r.cpp @@ -2,19 +2,17 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/hw/y2r.h" #include #include #include #include - #include "common/assert.h" #include "common/color.h" #include "common/common_types.h" #include "common/math_util.h" #include "common/vector_math.h" - #include "core/hle/service/y2r_u.h" -#include "core/hw/y2r.h" #include "core/memory.h" namespace HW { diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index c2e87f592..212772c5d 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/loader/3dsx.h" #include #include - #include "common/logging/log.h" - #include "core/file_sys/archive_romfs.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/fs/archive.h" -#include "core/loader/3dsx.h" #include "core/memory.h" namespace Loader { diff --git a/src/core/loader/3dsx.h b/src/core/loader/3dsx.h index 8d15ba555..cfcc21cc4 100644 --- a/src/core/loader/3dsx.h +++ b/src/core/loader/3dsx.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" #include "core/loader/loader.h" diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 53c10a456..0f4148a59 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -2,18 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/loader/elf.h" #include #include #include - #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/symbols.h" - #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" -#include "core/loader/elf.h" #include "core/memory.h" using Kernel::SharedPtr; diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 04a9b482d..584bf6e27 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" #include "core/loader/loader.h" diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index b392bf544..147bf8591 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -4,10 +4,8 @@ #include #include - #include "common/logging/log.h" #include "common/string_util.h" - #include "core/hle/kernel/process.h" #include "core/loader/3dsx.h" #include "core/loader/elf.h" diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index fdfee835c..9652d7ac5 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -9,7 +9,6 @@ #include #include #include - #include "common/common_types.h" #include "common/file_util.h" diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 5b996d671..64c8fef07 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -2,19 +2,17 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/loader/ncch.h" #include #include #include - #include "common/logging/log.h" #include "common/string_util.h" #include "common/swap.h" - #include "core/file_sys/archive_romfs.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/fs/archive.h" -#include "core/loader/ncch.h" #include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index f53f8100e..04350d006 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -5,11 +5,9 @@ #pragma once #include - #include "common/bit_field.h" #include "common/common_types.h" #include "common/swap.h" - #include "core/loader/loader.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/loader/smdh.cpp b/src/core/loader/smdh.cpp index 2d014054a..7c875131f 100644 --- a/src/core/loader/smdh.cpp +++ b/src/core/loader/smdh.cpp @@ -2,14 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/loader/smdh.h" #include #include - #include "common/common_types.h" - #include "core/loader/loader.h" -#include "core/loader/smdh.h" - #include "video_core/utils.h" namespace Loader { diff --git a/src/core/loader/smdh.h b/src/core/loader/smdh.h index ab665ea82..ac7726c8f 100644 --- a/src/core/loader/smdh.h +++ b/src/core/loader/smdh.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 4de510fe5..c702fa311 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -2,19 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/memory.h" #include #include - #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/swap.h" - #include "core/hle/kernel/process.h" -#include "core/memory.h" #include "core/memory_setup.h" #include "core/mmio.h" - #include "video_core/renderer_base.h" #include "video_core/video_core.h" diff --git a/src/core/memory.h b/src/core/memory.h index 7d60ccdf1..8fd3080ff 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace Memory { diff --git a/src/core/memory_setup.h b/src/core/memory_setup.h index 23c36d019..3fdf3a87d 100644 --- a/src/core/memory_setup.h +++ b/src/core/memory_setup.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/mmio.h" namespace Memory { diff --git a/src/core/mmio.h b/src/core/mmio.h index 9aa59212b..f45126da8 100644 --- a/src/core/mmio.h +++ b/src/core/mmio.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/common_types.h" namespace Memory { diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 09194fe1f..f2d1b5e74 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -3,11 +3,8 @@ // Refer to the license.txt file included. #include "settings.h" - #include "audio_core/audio_core.h" - #include "core/gdbstub/gdbstub.h" - #include "video_core/video_core.h" namespace Settings { diff --git a/src/core/settings.h b/src/core/settings.h index adb2fd538..5a64f8018 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace Settings { diff --git a/src/core/system.cpp b/src/core/system.cpp index f2bf648bd..ef190203c 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "core/system.h" #include "audio_core/audio_core.h" - #include "core/core.h" #include "core/core_timing.h" #include "core/gdbstub/gdbstub.h" @@ -11,8 +11,6 @@ #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" #include "core/hw/hw.h" -#include "core/system.h" - #include "video_core/video_core.h" namespace System { diff --git a/src/core/tracer/recorder.cpp b/src/core/tracer/recorder.cpp index 11a289b2c..ba4362484 100644 --- a/src/core/tracer/recorder.cpp +++ b/src/core/tracer/recorder.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "recorder.h" #include - #include "common/assert.h" #include "common/file_util.h" #include "common/logging/log.h" -#include "recorder.h" - namespace CiTrace { Recorder::Recorder(const InitialState& initial_state) : initial_state(initial_state) {} diff --git a/src/core/tracer/recorder.h b/src/core/tracer/recorder.h index 6f5354f84..aea363b95 100644 --- a/src/core/tracer/recorder.h +++ b/src/core/tracer/recorder.h @@ -7,12 +7,9 @@ #include #include #include - #include - -#include "common/common_types.h" - #include "citrace.h" +#include "common/common_types.h" namespace CiTrace { diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index 82178d249..5aad47418 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -2,19 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/clipper.h" #include #include #include - #include #include - #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/vector_math.h" - -#include "video_core/clipper.h" #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 04a4ee3a2..5c74b68e9 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -2,22 +2,19 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/command_processor.h" #include #include #include #include - #include "common/assert.h" #include "common/logging/log.h" #include "common/microprofile.h" #include "common/vector_math.h" - #include "core/hle/service/gsp_gpu.h" #include "core/hw/gpu.h" #include "core/memory.h" #include "core/tracer/recorder.h" - -#include "video_core/command_processor.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h index b8dad8e7b..62ad2d3f3 100644 --- a/src/video_core/command_processor.h +++ b/src/video_core/command_processor.h @@ -5,7 +5,6 @@ #pragma once #include - #include "common/bit_field.h" #include "common/common_types.h" diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 194e5833c..8806464d9 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -20,7 +20,6 @@ #include #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/color.h" @@ -29,7 +28,6 @@ #include "common/logging/log.h" #include "common/math_util.h" #include "common/vector_math.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index fe3ed247d..189c93abb 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -15,10 +15,8 @@ #include #include #include - #include "common/common_types.h" #include "common/vector_math.h" - #include "video_core/pica.h" namespace CiTrace { diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index aea391619..3c6636d66 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -7,7 +7,6 @@ #include #include #include - #include "core/hle/service/gsp_gpu.h" class GraphicsDebugger { diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp index ffd13e717..771e83fe7 100644 --- a/src/video_core/pica.cpp +++ b/src/video_core/pica.cpp @@ -2,12 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/pica.h" #include #include #include #include - -#include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/primitive_assembly.h" #include "video_core/shader/shader.h" diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h index 2dbd6413f..e4f2e6d5d 100644 --- a/src/video_core/pica_state.h +++ b/src/video_core/pica_state.h @@ -5,10 +5,8 @@ #pragma once #include - #include "common/bit_field.h" #include "common/common_types.h" - #include "video_core/pica.h" #include "video_core/primitive_assembly.h" #include "video_core/shader/shader.h" diff --git a/src/video_core/pica_types.h b/src/video_core/pica_types.h index 20f648b03..5d7e10066 100644 --- a/src/video_core/pica_types.h +++ b/src/video_core/pica_types.h @@ -6,7 +6,6 @@ #include #include - #include "common/common_types.h" namespace Pica { diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 901cca26b..670ffb67d 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/primitive_assembly.h" #include "common/logging/log.h" - #include "video_core/pica.h" -#include "video_core/primitive_assembly.h" #include "video_core/shader/shader.h" namespace Pica { diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h index 2ad15a858..0384d5984 100644 --- a/src/video_core/primitive_assembly.h +++ b/src/video_core/primitive_assembly.h @@ -5,7 +5,6 @@ #pragma once #include - #include "video_core/pica.h" namespace Pica { diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index f815d6cf0..c179573d6 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/rasterizer.h" #include #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/color.h" @@ -14,15 +14,12 @@ #include "common/math_util.h" #include "common/microprofile.h" #include "common/vector_math.h" - #include "core/hw/gpu.h" #include "core/memory.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" -#include "video_core/rasterizer.h" #include "video_core/shader/shader.h" #include "video_core/utils.h" diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index c7bd29f12..71df233b5 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "core/hw/gpu.h" struct ScreenInfo; diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 090683276..91347dea8 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -2,10 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_base.h" #include #include - -#include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/swrasterizer.h" #include "video_core/video_core.h" diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index daacdb167..589aca857 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -5,9 +5,7 @@ #pragma once #include - #include "common/common_types.h" - #include "video_core/rasterizer_interface.h" class EmuWindow; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 37977464d..45a4dc97d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -2,24 +2,20 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/gl_rasterizer.h" #include #include #include #include - #include - #include "common/assert.h" #include "common/color.h" #include "common/logging/log.h" #include "common/math_util.h" #include "common/vector_math.h" - #include "core/hw/gpu.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" -#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/pica_to_gl.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 60d70539c..24fefed1b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -10,16 +10,12 @@ #include #include #include - #include - #include "common/bit_field.h" #include "common/common_types.h" #include "common/hash.h" #include "common/vector_math.h" - #include "core/hw/gpu.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index ec3300ca6..ce9a193bd 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include #include #include @@ -9,21 +10,16 @@ #include #include #include - #include - #include "common/bit_field.h" #include "common/emu_window.h" #include "common/logging/log.h" #include "common/math_util.h" #include "common/microprofile.h" #include "common/vector_math.h" - #include "core/memory.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica_state.h" -#include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include "video_core/renderer_opengl/gl_state.h" #include "video_core/utils.h" #include "video_core/video_core.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index b2272bda8..849530d86 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -8,16 +8,12 @@ #include #include #include - #include #include - #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_types.h" - #include "core/hw/gpu.h" - #include "video_core/pica.h" #include "video_core/renderer_opengl/gl_resource_manager.h" diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 2f40eb646..13301ec9f 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h @@ -5,11 +5,8 @@ #pragma once #include - #include - #include "common/common_types.h" - #include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_state.h" diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 9392c67b8..52cee2ee2 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -2,16 +2,14 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/gl_shader_gen.h" #include #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/logging/log.h" - #include "video_core/pica.h" #include "video_core/renderer_opengl/gl_rasterizer.h" -#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_util.h" using Pica::Regs; diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index 7d90ec6a3..c8ba3b92d 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -2,12 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/gl_shader_util.h" #include - #include - #include "common/logging/log.h" -#include "video_core/renderer_opengl/gl_shader_util.h" namespace GLShader { diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index a97269d44..96af8469d 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/gl_state.h" #include - #include "common/common_funcs.h" #include "common/logging/log.h" -#include "video_core/renderer_opengl/gl_state.h" - OpenGLState OpenGLState::cur_state; OpenGLState::OpenGLState() { diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index 415358b6c..cc49867c8 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -6,15 +6,12 @@ #include #include - #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" - #include "video_core/pica.h" using GLvec2 = std::array; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index a1d08e04d..962785bdd 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -2,30 +2,26 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/renderer_opengl/renderer_opengl.h" #include #include #include #include - #include - #include "common/assert.h" #include "common/bit_field.h" #include "common/emu_window.h" #include "common/logging/log.h" #include "common/profiler_reporting.h" #include "common/synchronized_wrapper.h" - #include "core/hw/gpu.h" #include "core/hw/hw.h" #include "core/hw/lcd.h" #include "core/memory.h" #include "core/settings.h" #include "core/tracer/recorder.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/rasterizer_interface.h" -#include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/video_core.h" static const char vertex_shader[] = R"( diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 762b790c1..87c556cff 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -5,14 +5,10 @@ #pragma once #include - #include - #include "common/common_types.h" #include "common/math_util.h" - #include "core/hw/gpu.h" - #include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_state.h" diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index c38bdcc3c..53e91df03 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -2,28 +2,23 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/shader/shader.h" #include #include #include #include #include - #include - #include "common/bit_field.h" #include "common/hash.h" #include "common/logging/log.h" #include "common/microprofile.h" - #include "video_core/pica.h" #include "video_core/pica_state.h" -#include "video_core/shader/shader.h" #include "video_core/shader/shader_interpreter.h" - #ifdef ARCHITECTURE_x86_64 #include "video_core/shader/shader_jit_x64.h" #endif // ARCHITECTURE_x86_64 - #include "video_core/video_core.h" namespace Pica { diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 79c716b6e..8858d67f8 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -9,16 +9,12 @@ #include #include #include - #include - #include - #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/vector_math.h" - #include "video_core/pica.h" #include "video_core/pica_types.h" diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 41df8a2fd..5df3c4e86 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -2,21 +2,18 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/shader/shader.h" #include #include #include #include - #include - #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/vector_math.h" - #include "video_core/pica_state.h" #include "video_core/pica_types.h" -#include "video_core/shader/shader.h" #include "video_core/shader/shader_interpreter.h" using nihstro::OpCode; diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index d1b2ce8d5..5f1323799 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -2,23 +2,19 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "shader.h" #include #include #include #include - #include - #include "common/assert.h" #include "common/logging/log.h" #include "common/vector_math.h" #include "common/x64/abi.h" #include "common/x64/cpu_detect.h" #include "common/x64/emitter.h" - -#include "shader.h" #include "shader_jit_x64.h" - #include "video_core/pica_state.h" #include "video_core/pica_types.h" diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.h index 2f37ef8bf..98de5ecef 100644 --- a/src/video_core/shader/shader_jit_x64.h +++ b/src/video_core/shader/shader_jit_x64.h @@ -8,13 +8,10 @@ #include #include #include - #include - #include "common/bit_set.h" #include "common/common_types.h" #include "common/x64/emitter.h" - #include "video_core/shader/shader.h" using nihstro::Instruction; diff --git a/src/video_core/swrasterizer.h b/src/video_core/swrasterizer.h index 12dc56bef..6d42d7409 100644 --- a/src/video_core/swrasterizer.h +++ b/src/video_core/swrasterizer.h @@ -5,7 +5,6 @@ #pragma once #include "common/common_types.h" - #include "video_core/rasterizer_interface.h" namespace Pica { diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp index 9dcd9d748..5704e9fea 100644 --- a/src/video_core/vertex_loader.cpp +++ b/src/video_core/vertex_loader.cpp @@ -1,22 +1,18 @@ +#include "video_core/vertex_loader.h" #include - #include - #include "common/alignment.h" #include "common/assert.h" #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/vector_math.h" - #include "core/memory.h" - #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" #include "video_core/shader/shader.h" -#include "video_core/vertex_loader.h" namespace Pica { diff --git a/src/video_core/vertex_loader.h b/src/video_core/vertex_loader.h index 4f8d79f14..9f2098bb2 100644 --- a/src/video_core/vertex_loader.h +++ b/src/video_core/vertex_loader.h @@ -1,7 +1,6 @@ #pragma once #include - #include "common/common_types.h" #include "video_core/pica.h" diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 880f4990d..b06a88b78 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -2,14 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "video_core/video_core.h" #include - #include "common/logging/log.h" - #include "video_core/pica.h" #include "video_core/renderer_base.h" #include "video_core/renderer_opengl/renderer_opengl.h" -#include "video_core/video_core.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Video Core namespace -- cgit v1.2.3 From 84fbbe26297652d994d203bde543ec252c2d801a Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Tue, 20 Sep 2016 23:52:38 -0700 Subject: Use negative priorities to avoid special-casing the self-include --- src/.clang-format | 10 ++++++---- src/audio_core/audio_core.cpp | 2 +- src/audio_core/codec.cpp | 2 +- src/audio_core/hle/dsp.cpp | 2 +- src/audio_core/hle/filter.cpp | 2 +- src/audio_core/hle/pipe.cpp | 2 +- src/audio_core/hle/source.cpp | 2 +- src/audio_core/sdl2_sink.cpp | 2 +- src/audio_core/sink_details.cpp | 2 +- src/audio_core/time_stretch.cpp | 2 +- src/citra/config.cpp | 2 +- src/citra_qt/config.cpp | 2 +- src/citra_qt/configure_audio.cpp | 2 +- src/citra_qt/configure_dialog.cpp | 2 +- src/citra_qt/configure_input.cpp | 2 +- src/citra_qt/debugger/callstack.cpp | 2 +- src/citra_qt/debugger/disassembler.cpp | 2 +- src/citra_qt/debugger/graphics.cpp | 2 +- src/citra_qt/debugger/graphics_breakpoint_observer.cpp | 2 +- src/citra_qt/debugger/graphics_breakpoints.cpp | 2 +- src/citra_qt/debugger/graphics_cmdlists.cpp | 2 +- src/citra_qt/debugger/graphics_surface.cpp | 2 +- src/citra_qt/debugger/graphics_tracing.cpp | 2 +- src/citra_qt/debugger/graphics_vertex_shader.cpp | 2 +- src/citra_qt/debugger/profiler.cpp | 2 +- src/citra_qt/debugger/registers.cpp | 2 +- src/citra_qt/game_list.cpp | 2 +- src/citra_qt/hotkeys.cpp | 2 +- src/citra_qt/util/spinbox.cpp | 2 +- src/citra_qt/util/util.cpp | 2 +- src/common/break_points.cpp | 2 +- src/common/emu_window.cpp | 2 +- src/common/file_util.cpp | 2 +- src/common/key_map.cpp | 2 +- src/common/logging/backend.cpp | 2 +- src/common/logging/filter.cpp | 2 +- src/common/memory_util.cpp | 2 +- src/common/string_util.cpp | 2 +- src/common/x64/cpu_detect.cpp | 2 +- src/common/x64/emitter.cpp | 4 ++-- src/core/arm/disassembler/arm_disasm.cpp | 2 +- src/core/arm/disassembler/load_symbol_map.cpp | 2 +- src/core/arm/dynarmic/arm_dynarmic.cpp | 2 +- src/core/arm/dyncom/arm_dyncom.cpp | 2 +- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 2 +- src/core/arm/dyncom/arm_dyncom_trans.cpp | 2 +- src/core/arm/skyeye_common/armstate.cpp | 2 +- src/core/arm/skyeye_common/armsupp.cpp | 2 +- src/core/arm/skyeye_common/vfp/vfp.cpp | 2 +- src/core/arm/skyeye_common/vfp/vfpdouble.cpp | 2 +- src/core/arm/skyeye_common/vfp/vfpsingle.cpp | 2 +- src/core/core.cpp | 2 +- src/core/core_timing.cpp | 2 +- src/core/file_sys/archive_backend.cpp | 2 +- src/core/file_sys/archive_extsavedata.cpp | 2 +- src/core/file_sys/archive_romfs.cpp | 2 +- src/core/file_sys/archive_savedata.cpp | 2 +- src/core/file_sys/archive_savedatacheck.cpp | 2 +- src/core/file_sys/archive_sdmc.cpp | 2 +- src/core/file_sys/archive_systemsavedata.cpp | 2 +- src/core/file_sys/disk_archive.cpp | 2 +- src/core/file_sys/ivfc_archive.cpp | 2 +- src/core/hle/applets/applet.cpp | 2 +- src/core/hle/applets/erreula.cpp | 2 +- src/core/hle/applets/mii_selector.cpp | 2 +- src/core/hle/applets/swkbd.cpp | 2 +- src/core/hle/config_mem.cpp | 2 +- src/core/hle/hle.cpp | 2 +- src/core/hle/kernel/address_arbiter.cpp | 2 +- src/core/hle/kernel/client_port.cpp | 2 +- src/core/hle/kernel/event.cpp | 2 +- src/core/hle/kernel/kernel.cpp | 2 +- src/core/hle/kernel/memory.cpp | 2 +- src/core/hle/kernel/mutex.cpp | 2 +- src/core/hle/kernel/process.cpp | 2 +- src/core/hle/kernel/resource_limit.cpp | 2 +- src/core/hle/kernel/semaphore.cpp | 2 +- src/core/hle/kernel/server_port.cpp | 2 +- src/core/hle/kernel/shared_memory.cpp | 2 +- src/core/hle/kernel/thread.cpp | 2 +- src/core/hle/kernel/timer.cpp | 2 +- src/core/hle/kernel/vm_manager.cpp | 2 +- src/core/hle/service/ac_u.cpp | 2 +- src/core/hle/service/am/am.cpp | 2 +- src/core/hle/service/am/am_app.cpp | 2 +- src/core/hle/service/am/am_net.cpp | 2 +- src/core/hle/service/am/am_sys.cpp | 2 +- src/core/hle/service/am/am_u.cpp | 2 +- src/core/hle/service/apt/apt.cpp | 2 +- src/core/hle/service/apt/apt_a.cpp | 2 +- src/core/hle/service/apt/apt_s.cpp | 2 +- src/core/hle/service/apt/apt_u.cpp | 2 +- src/core/hle/service/cam/cam.cpp | 2 +- src/core/hle/service/cam/cam_u.cpp | 2 +- src/core/hle/service/cecd/cecd.cpp | 2 +- src/core/hle/service/cecd/cecd_u.cpp | 2 +- src/core/hle/service/cfg/cfg.cpp | 2 +- src/core/hle/service/cfg/cfg_i.cpp | 2 +- src/core/hle/service/cfg/cfg_s.cpp | 2 +- src/core/hle/service/cfg/cfg_u.cpp | 2 +- src/core/hle/service/csnd_snd.cpp | 2 +- src/core/hle/service/dlp/dlp_srvr.cpp | 2 +- src/core/hle/service/dsp_dsp.cpp | 2 +- src/core/hle/service/err_f.cpp | 2 +- src/core/hle/service/frd/frd.cpp | 2 +- src/core/hle/service/frd/frd_u.cpp | 2 +- src/core/hle/service/fs/archive.cpp | 2 +- src/core/hle/service/fs/fs_user.cpp | 2 +- src/core/hle/service/gsp_gpu.cpp | 2 +- src/core/hle/service/hid/hid.cpp | 2 +- src/core/hle/service/hid/hid_spvr.cpp | 2 +- src/core/hle/service/hid/hid_user.cpp | 2 +- src/core/hle/service/ir/ir.cpp | 2 +- src/core/hle/service/ir/ir_rst.cpp | 2 +- src/core/hle/service/ir/ir_user.cpp | 2 +- src/core/hle/service/ldr_ro/cro_helper.cpp | 2 +- src/core/hle/service/ldr_ro/ldr_ro.cpp | 2 +- src/core/hle/service/ldr_ro/memory_synchronizer.cpp | 2 +- src/core/hle/service/ndm/ndm.cpp | 2 +- src/core/hle/service/ndm/ndm_u.cpp | 2 +- src/core/hle/service/news/news.cpp | 2 +- src/core/hle/service/news/news_s.cpp | 2 +- src/core/hle/service/nim/nim.cpp | 2 +- src/core/hle/service/nim/nim_u.cpp | 2 +- src/core/hle/service/nwm_uds.cpp | 2 +- src/core/hle/service/ptm/ptm.cpp | 2 +- src/core/hle/service/ptm/ptm_sysm.cpp | 2 +- src/core/hle/service/ptm/ptm_u.cpp | 2 +- src/core/hle/service/service.cpp | 2 +- src/core/hle/service/soc_u.cpp | 2 +- src/core/hle/service/srv.cpp | 2 +- src/core/hle/service/ssl_c.cpp | 2 +- src/core/hle/service/y2r_u.cpp | 2 +- src/core/hle/shared_page.cpp | 2 +- src/core/hw/gpu.cpp | 2 +- src/core/hw/hw.cpp | 2 +- src/core/hw/lcd.cpp | 2 +- src/core/hw/y2r.cpp | 2 +- src/core/loader/3dsx.cpp | 2 +- src/core/loader/elf.cpp | 2 +- src/core/loader/ncch.cpp | 2 +- src/core/loader/smdh.cpp | 2 +- src/core/memory.cpp | 2 +- src/core/settings.cpp | 2 +- src/core/system.cpp | 2 +- src/core/tracer/recorder.cpp | 2 +- src/video_core/clipper.cpp | 2 +- src/video_core/command_processor.cpp | 2 +- src/video_core/pica.cpp | 2 +- src/video_core/primitive_assembly.cpp | 2 +- src/video_core/rasterizer.cpp | 2 +- src/video_core/renderer_base.cpp | 2 +- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 2 +- src/video_core/renderer_opengl/gl_shader_gen.cpp | 2 +- src/video_core/renderer_opengl/gl_shader_util.cpp | 2 +- src/video_core/renderer_opengl/gl_state.cpp | 2 +- src/video_core/renderer_opengl/renderer_opengl.cpp | 2 +- src/video_core/shader/shader.cpp | 2 +- src/video_core/shader/shader_interpreter.cpp | 2 +- src/video_core/shader/shader_jit_x64.cpp | 2 +- src/video_core/swrasterizer.cpp | 2 +- src/video_core/vertex_loader.cpp | 2 +- src/video_core/video_core.cpp | 2 +- 164 files changed, 170 insertions(+), 168 deletions(-) (limited to 'src/common') diff --git a/src/.clang-format b/src/.clang-format index fc1bbb297..e4f5d6d7e 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -47,13 +47,15 @@ DisableFormat: false ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] IncludeCategories: - Regex: '^\<[wW]indows.h\>' - Priority: 1 + Priority: -3 - Regex: '^\<(boost|catch|dynarmic|glad|inih|nihstro)/' - Priority: 3 + Priority: -1 - Regex: '^\<(SDL|SoundTouch|Q)' - Priority: 3 + Priority: -1 - Regex: '^\<' - Priority: 2 + Priority: -2 + - Regex: '^\"' + Priority: 0 IndentCaseLabels: false IndentWidth: 4 IndentWrappedFunctionNames: false diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp index c54a4b99a..49260de7c 100644 --- a/src/audio_core/audio_core.cpp +++ b/src/audio_core/audio_core.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/audio_core.h" #include #include +#include "audio_core/audio_core.h" #include "audio_core/hle/dsp.h" #include "audio_core/hle/pipe.h" #include "audio_core/null_sink.h" diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index fd189a176..7a3bd7eb3 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/codec.h" #include #include #include #include +#include "audio_core/codec.h" #include "common/assert.h" #include "common/common_types.h" #include "common/math_util.h" diff --git a/src/audio_core/hle/dsp.cpp b/src/audio_core/hle/dsp.cpp index aa64dae97..58690970a 100644 --- a/src/audio_core/hle/dsp.cpp +++ b/src/audio_core/hle/dsp.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/hle/dsp.h" #include #include +#include "audio_core/hle/dsp.h" #include "audio_core/hle/mixers.h" #include "audio_core/hle/pipe.h" #include "audio_core/hle/source.h" diff --git a/src/audio_core/hle/filter.cpp b/src/audio_core/hle/filter.cpp index edf95f686..b24a79b89 100644 --- a/src/audio_core/hle/filter.cpp +++ b/src/audio_core/hle/filter.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/hle/filter.h" #include #include #include "audio_core/hle/common.h" #include "audio_core/hle/dsp.h" +#include "audio_core/hle/filter.h" #include "common/common_types.h" #include "common/math_util.h" diff --git a/src/audio_core/hle/pipe.cpp b/src/audio_core/hle/pipe.cpp index cab30c8aa..b472c81d8 100644 --- a/src/audio_core/hle/pipe.cpp +++ b/src/audio_core/hle/pipe.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/hle/pipe.h" #include #include #include "audio_core/hle/dsp.h" +#include "audio_core/hle/pipe.h" #include "common/assert.h" #include "common/common_types.h" #include "common/logging/log.h" diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index 9e6b36fcd..2bbf7146e 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/hle/source.h" #include #include #include "audio_core/codec.h" #include "audio_core/hle/common.h" +#include "audio_core/hle/source.h" #include "audio_core/interpolate.h" #include "common/assert.h" #include "common/logging/log.h" diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp index 2520796cb..75cc0d6dd 100644 --- a/src/audio_core/sdl2_sink.cpp +++ b/src/audio_core/sdl2_sink.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/sdl2_sink.h" #include #include #include #include #include "audio_core/audio_core.h" +#include "audio_core/sdl2_sink.h" #include "common/assert.h" #include "common/logging/log.h" diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink_details.cpp index 1dc5e862e..95ccc9e9d 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink_details.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/sink_details.h" #include #include #include "audio_core/null_sink.h" +#include "audio_core/sink_details.h" #ifdef HAVE_SDL2 #include "audio_core/sdl2_sink.h" #endif diff --git a/src/audio_core/time_stretch.cpp b/src/audio_core/time_stretch.cpp index 26059f503..53cb64655 100644 --- a/src/audio_core/time_stretch.cpp +++ b/src/audio_core/time_stretch.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "audio_core/time_stretch.h" #include #include #include #include #include "audio_core/audio_core.h" +#include "audio_core/time_stretch.h" #include "common/common_types.h" #include "common/logging/log.h" #include "common/math_util.h" diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 58aef7a9a..05eabfa3d 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "config.h" #include #include #include #include "citra/default_ini.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "config.h" #include "core/settings.h" Config::Config() { diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index e3648572f..0b46ca6bb 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/config.h" #include +#include "citra_qt/config.h" #include "citra_qt/ui_settings.h" #include "common/file_util.h" diff --git a/src/citra_qt/configure_audio.cpp b/src/citra_qt/configure_audio.cpp index ba976252e..3cdd4c780 100644 --- a/src/citra_qt/configure_audio.cpp +++ b/src/citra_qt/configure_audio.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/configure_audio.h" #include "audio_core/sink_details.h" +#include "citra_qt/configure_audio.h" #include "core/settings.h" #include "ui_configure_audio.h" diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp index d6a4e8af1..446ad04a1 100644 --- a/src/citra_qt/configure_dialog.cpp +++ b/src/citra_qt/configure_dialog.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/configure_dialog.h" #include "citra_qt/config.h" +#include "citra_qt/configure_dialog.h" #include "core/settings.h" #include "ui_configure.h" diff --git a/src/citra_qt/configure_input.cpp b/src/citra_qt/configure_input.cpp index 7039301e3..d321db71f 100644 --- a/src/citra_qt/configure_input.cpp +++ b/src/citra_qt/configure_input.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/configure_input.h" #include #include #include +#include "citra_qt/configure_input.h" ConfigureInput::ConfigureInput(QWidget* parent) : QWidget(parent), ui(std::make_unique()) { diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp index 14bd1c77c..c66f2b96a 100644 --- a/src/citra_qt/debugger/callstack.cpp +++ b/src/citra_qt/debugger/callstack.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/callstack.h" #include +#include "citra_qt/debugger/callstack.h" #include "common/common_types.h" #include "common/symbols.h" #include "core/arm/arm_interface.h" diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index 7a5d3e2f1..1ee6bbd6a 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/disassembler.h" #include #include "citra_qt/bootmanager.h" +#include "citra_qt/debugger/disassembler.h" #include "citra_qt/hotkeys.h" #include "citra_qt/util/util.h" #include "common/break_points.h" diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp index 31b54e855..ef6712bfa 100644 --- a/src/citra_qt/debugger/graphics.cpp +++ b/src/citra_qt/debugger/graphics.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics.h" #include +#include "citra_qt/debugger/graphics.h" #include "citra_qt/util/util.h" extern GraphicsDebugger g_debugger; diff --git a/src/citra_qt/debugger/graphics_breakpoint_observer.cpp b/src/citra_qt/debugger/graphics_breakpoint_observer.cpp index ad11552d7..e01d3440e 100644 --- a/src/citra_qt/debugger/graphics_breakpoint_observer.cpp +++ b/src/citra_qt/debugger/graphics_breakpoint_observer.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_breakpoint_observer.h" #include +#include "citra_qt/debugger/graphics_breakpoint_observer.h" BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr debug_context, const QString& title, QWidget* parent) diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index e1d1b4911..d2a036dfa 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_breakpoints.h" #include #include #include #include #include +#include "citra_qt/debugger/graphics_breakpoints.h" #include "citra_qt/debugger/graphics_breakpoints_p.h" #include "common/assert.h" diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 35be9b9bd..8a784d108 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_cmdlists.h" #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include "citra_qt/debugger/graphics_cmdlists.h" #include "citra_qt/util/spinbox.h" #include "citra_qt/util/util.h" #include "common/vector_math.h" diff --git a/src/citra_qt/debugger/graphics_surface.cpp b/src/citra_qt/debugger/graphics_surface.cpp index 496fce59d..906daaa50 100644 --- a/src/citra_qt/debugger/graphics_surface.cpp +++ b/src/citra_qt/debugger/graphics_surface.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_surface.h" #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include "citra_qt/debugger/graphics_surface.h" #include "citra_qt/util/spinbox.h" #include "common/color.h" #include "core/hw/gpu.h" diff --git a/src/citra_qt/debugger/graphics_tracing.cpp b/src/citra_qt/debugger/graphics_tracing.cpp index 944150b8e..5c6b74034 100644 --- a/src/citra_qt/debugger/graphics_tracing.cpp +++ b/src/citra_qt/debugger/graphics_tracing.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_tracing.h" #include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include "citra_qt/debugger/graphics_tracing.h" #include "common/common_types.h" #include "core/hw/gpu.h" #include "core/hw/lcd.h" diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 3b3ffe5c6..0b4320da5 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/graphics_vertex_shader.h" #include #include #include @@ -15,6 +14,7 @@ #include #include #include +#include "citra_qt/debugger/graphics_vertex_shader.h" #include "citra_qt/util/util.h" #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 39d2d6e39..cee10403d 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/profiler.h" #include #include #include +#include "citra_qt/debugger/profiler.h" #include "citra_qt/util/util.h" #include "common/common_types.h" #include "common/microprofile.h" diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index 13842dac3..0b644432f 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/debugger/registers.h" #include +#include "citra_qt/debugger/registers.h" #include "citra_qt/util/util.h" #include "core/arm/arm_interface.h" #include "core/core.h" diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 16d31be77..07bc35308 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "game_list.h" #include #include #include @@ -10,6 +9,7 @@ #include "common/logging/log.h" #include "common/string_util.h" #include "core/loader/loader.h" +#include "game_list.h" #include "game_list_p.h" #include "ui_settings.h" diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 9037f20f2..158ed506f 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/hotkeys.h" #include #include #include #include +#include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" struct Hotkey { diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index 0bda21502..feb0ea1b3 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -28,10 +28,10 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "citra_qt/util/spinbox.h" #include #include #include +#include "citra_qt/util/spinbox.h" #include "common/assert.h" CSpinBox::CSpinBox(QWidget* parent) diff --git a/src/citra_qt/util/util.cpp b/src/citra_qt/util/util.cpp index e77d3796c..02be92bbd 100644 --- a/src/citra_qt/util/util.cpp +++ b/src/citra_qt/util/util.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/util/util.h" #include #include +#include "citra_qt/util/util.h" QFont GetMonospaceFont() { QFont font("monospace"); diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index 4b64a6c7b..03a19acba 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/break_points.h" #include #include +#include "common/break_points.h" #include "common/logging/log.h" bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const { diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index 6fd6f1987..122f1c212 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "emu_window.h" #include #include #include "common/assert.h" #include "common/key_map.h" +#include "emu_window.h" #include "video_core/video_core.h" void EmuWindow::ButtonPressed(Service::HID::PadState pad) { diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index a0cae11e3..7a21962cc 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/file_util.h" #include "common/assert.h" #include "common/common_funcs.h" #include "common/common_paths.h" +#include "common/file_util.h" #include "common/logging/log.h" #ifdef _WIN32 diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp index 8380ce489..79b3fcb18 100644 --- a/src/common/key_map.cpp +++ b/src/common/key_map.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/key_map.h" #include #include "common/emu_window.h" +#include "common/key_map.h" namespace KeyMap { diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index b4a312948..9a13a9e90 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/logging/backend.h" #include #include #include #include "common/assert.h" #include "common/common_funcs.h" // snprintf compatibility define +#include "common/logging/backend.h" #include "common/logging/filter.h" #include "common/logging/log.h" #include "common/logging/text_formatter.h" diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 9aa72cecc..12e5bb45d 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/logging/filter.h" #include #include "common/logging/backend.h" +#include "common/logging/filter.h" #include "common/string_util.h" namespace Log { diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index 7d352f00f..e19d7202a 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/memory_util.h" #include "common/logging/log.h" +#include "common/memory_util.h" #ifdef _WIN32 #include diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 968854bae..ca97e8ab4 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "common/string_util.h" #include #include #include @@ -11,6 +10,7 @@ #include #include "common/common_paths.h" #include "common/logging/log.h" +#include "common/string_util.h" #ifdef _MSC_VER #include #include diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp index ac37c42bc..6ddf9b70c 100644 --- a/src/common/x64/cpu_detect.cpp +++ b/src/common/x64/cpu_detect.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "cpu_detect.h" #include #include #include #include "common/common_types.h" +#include "cpu_detect.h" namespace Common { diff --git a/src/common/x64/emitter.cpp b/src/common/x64/emitter.cpp index b69e4bd5e..f5930abec 100644 --- a/src/common/x64/emitter.cpp +++ b/src/common/x64/emitter.cpp @@ -15,7 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "emitter.h" #include #include #include "abi.h" @@ -23,6 +22,7 @@ #include "common/logging/log.h" #include "common/memory_util.h" #include "cpu_detect.h" +#include "emitter.h" namespace Gen { @@ -220,7 +220,7 @@ void OpArg::WriteVex(XEmitter* emit, X64Reg regOp1, X64Reg regOp2, int L, int pp void OpArg::WriteRest(XEmitter* emit, int extraBytes, X64Reg _operandReg, bool warn_64bit_offset) const { if (_operandReg == INVALID_REG) - _operandReg = (X64Reg) this->operandReg; + _operandReg = (X64Reg)this->operandReg; int mod = 0; int ireg = indexReg; bool SIB = false; diff --git a/src/core/arm/disassembler/arm_disasm.cpp b/src/core/arm/disassembler/arm_disasm.cpp index 068f395ac..05d6ed1fb 100644 --- a/src/core/arm/disassembler/arm_disasm.cpp +++ b/src/core/arm/disassembler/arm_disasm.cpp @@ -1,10 +1,10 @@ // Copyright 2006 The Android Open Source Project -#include "core/arm/disassembler/arm_disasm.h" #include #include #include "common/common_types.h" #include "common/string_util.h" +#include "core/arm/disassembler/arm_disasm.h" #include "core/arm/skyeye_common/armsupp.h" static const char* cond_names[] = {"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc", diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp index e602d4511..6863c103a 100644 --- a/src/core/arm/disassembler/load_symbol_map.cpp +++ b/src/core/arm/disassembler/load_symbol_map.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/arm/disassembler/load_symbol_map.h" #include #include #include #include "common/file_util.h" #include "common/symbols.h" +#include "core/arm/disassembler/load_symbol_map.h" /* * Loads a symbol map file for use with the disassembler diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index b57d9e65b..b4444c869 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/arm/dynarmic/arm_dynarmic.h" #include #include "common/assert.h" #include "common/microprofile.h" +#include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/core.h" #include "core/core_timing.h" diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp index bc9ba2941..34c7f945e 100644 --- a/src/core/arm/dyncom/arm_dyncom.cpp +++ b/src/core/arm/dyncom/arm_dyncom.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/arm/dyncom/arm_dyncom.h" #include #include +#include "core/arm/dyncom/arm_dyncom.h" #include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/arm/dyncom/arm_dyncom_run.h" #include "core/arm/dyncom/arm_dyncom_trans.h" diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 4f83d8332..7b8616702 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -4,7 +4,6 @@ #define CITRA_IGNORE_EXIT(x) -#include "core/arm/dyncom/arm_dyncom_interpreter.h" #include #include #include "common/common_types.h" @@ -12,6 +11,7 @@ #include "common/microprofile.h" #include "core/arm/disassembler/arm_disasm.h" #include "core/arm/dyncom/arm_dyncom_dec.h" +#include "core/arm/dyncom/arm_dyncom_interpreter.h" #include "core/arm/dyncom/arm_dyncom_run.h" #include "core/arm/dyncom/arm_dyncom_thumb.h" #include "core/arm/dyncom/arm_dyncom_trans.h" diff --git a/src/core/arm/dyncom/arm_dyncom_trans.cpp b/src/core/arm/dyncom/arm_dyncom_trans.cpp index 5f3644c28..780638638 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.cpp +++ b/src/core/arm/dyncom/arm_dyncom_trans.cpp @@ -1,8 +1,8 @@ -#include "core/arm/dyncom/arm_dyncom_trans.h" #include #include "common/assert.h" #include "common/common_types.h" #include "core/arm/dyncom/arm_dyncom_interpreter.h" +#include "core/arm/dyncom/arm_dyncom_trans.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/armsupp.h" #include "core/arm/skyeye_common/vfp/vfp.h" diff --git a/src/core/arm/skyeye_common/armstate.cpp b/src/core/arm/skyeye_common/armstate.cpp index 59329c656..1465b074e 100644 --- a/src/core/arm/skyeye_common/armstate.cpp +++ b/src/core/arm/skyeye_common/armstate.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/arm/skyeye_common/armstate.h" #include #include "common/logging/log.h" #include "common/swap.h" +#include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/vfp/vfp.h" #include "core/gdbstub/gdbstub.h" #include "core/memory.h" diff --git a/src/core/arm/skyeye_common/armsupp.cpp b/src/core/arm/skyeye_common/armsupp.cpp index b76942e47..06aa1b075 100644 --- a/src/core/arm/skyeye_common/armsupp.cpp +++ b/src/core/arm/skyeye_common/armsupp.cpp @@ -15,10 +15,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "core/arm/skyeye_common/armsupp.h" #include "common/logging/log.h" #include "core/arm/skyeye_common/arm_regformat.h" #include "core/arm/skyeye_common/armstate.h" +#include "core/arm/skyeye_common/armsupp.h" // Unsigned sum of absolute difference u8 ARMul_UnsignedAbsoluteDifference(u8 left, u8 right) { diff --git a/src/core/arm/skyeye_common/vfp/vfp.cpp b/src/core/arm/skyeye_common/vfp/vfp.cpp index 8ac1fb95e..f36c75a07 100644 --- a/src/core/arm/skyeye_common/vfp/vfp.cpp +++ b/src/core/arm/skyeye_common/vfp/vfp.cpp @@ -20,12 +20,12 @@ /* Note: this file handles interface with arm core and vfp registers */ -#include "core/arm/skyeye_common/vfp/vfp.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/arm/skyeye_common/armstate.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" +#include "core/arm/skyeye_common/vfp/vfp.h" void VFPInit(ARMul_State* state) { state->VFP[VFP_FPSID] = VFP_FPSID_IMPLMEN << 24 | VFP_FPSID_SW << 23 | VFP_FPSID_SUBARCH << 16 | diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp index 4d89743e7..2886f351f 100644 --- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp @@ -51,10 +51,10 @@ * =========================================================================== */ -#include "core/arm/skyeye_common/vfp/vfp.h" #include #include "common/logging/log.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" +#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/arm/skyeye_common/vfp/vfp_helper.h" static struct vfp_double vfp_double_default_qnan = { diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp index 35f9d84d5..1590d89a4 100644 --- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp +++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp @@ -51,13 +51,13 @@ * =========================================================================== */ -#include "core/arm/skyeye_common/vfp/vfp.h" #include #include #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/arm/skyeye_common/vfp/asm_vfp.h" +#include "core/arm/skyeye_common/vfp/vfp.h" #include "core/arm/skyeye_common/vfp/vfp_helper.h" static struct vfp_single vfp_single_default_qnan = { diff --git a/src/core/core.cpp b/src/core/core.cpp index 346b6a0ae..49ac8be6e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/core.h" #include #include "common/logging/log.h" #include "core/arm/arm_interface.h" #include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dyncom/arm_dyncom.h" +#include "core/core.h" #include "core/core_timing.h" #include "core/gdbstub/gdbstub.h" #include "core/hle/hle.h" diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 4f38403e3..5220b55ea 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/core.h" #include #include #include @@ -11,6 +10,7 @@ #include "common/logging/log.h" #include "common/string_util.h" #include "core/arm/arm_interface.h" +#include "core/core.h" #include "core/core_timing.h" int g_clock_rate_arm11 = 268123480; diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 5c02fb748..1fae0ede0 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_backend.h" #include #include #include #include "common/logging/log.h" #include "common/string_util.h" +#include "core/file_sys/archive_backend.h" #include "core/memory.h" namespace FileSys { diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp index ed9fecd64..e1d29efd3 100644 --- a/src/core/file_sys/archive_extsavedata.cpp +++ b/src/core/file_sys/archive_extsavedata.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_extsavedata.h" #include #include #include @@ -10,6 +9,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/file_sys/archive_extsavedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index 7c0e1da21..6c99ca5b4 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_romfs.h" #include #include #include "common/common_types.h" #include "common/logging/log.h" +#include "core/file_sys/archive_romfs.h" #include "core/file_sys/ivfc_archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index 829f97743..6711035ec 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_savedata.h" #include #include #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/file_sys/archive_savedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/kernel/process.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp index 8bdf24b1f..6c4542b7d 100644 --- a/src/core/file_sys/archive_savedatacheck.cpp +++ b/src/core/file_sys/archive_savedatacheck.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_savedatacheck.h" #include #include #include @@ -10,6 +9,7 @@ #include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/file_sys/archive_savedatacheck.h" #include "core/file_sys/ivfc_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index 887cfbb0f..bcb03ed36 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_sdmc.h" #include #include #include "common/file_util.h" #include "common/logging/log.h" +#include "core/file_sys/archive_sdmc.h" #include "core/file_sys/disk_archive.h" #include "core/settings.h" diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index b3dfcf897..48ebc0ed4 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/archive_systemsavedata.h" #include #include #include #include "common/common_types.h" #include "common/file_util.h" #include "common/string_util.h" +#include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/disk_archive.h" #include "core/hle/service/fs/archive.h" diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp index 7e88473bd..0f66998e1 100644 --- a/src/core/file_sys/disk_archive.cpp +++ b/src/core/file_sys/disk_archive.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/disk_archive.h" #include #include #include #include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "core/file_sys/disk_archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp index 5add3254b..49cc1de10 100644 --- a/src/core/file_sys/ivfc_archive.cpp +++ b/src/core/file_sys/ivfc_archive.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/file_sys/ivfc_archive.h" #include #include #include "common/common_types.h" #include "common/logging/log.h" +#include "core/file_sys/ivfc_archive.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace diff --git a/src/core/hle/applets/applet.cpp b/src/core/hle/applets/applet.cpp index 35e683cb3..4311d9897 100644 --- a/src/core/hle/applets/applet.cpp +++ b/src/core/hle/applets/applet.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/applets/applet.h" #include #include #include @@ -10,6 +9,7 @@ #include "common/assert.h" #include "common/common_types.h" #include "core/core_timing.h" +#include "core/hle/applets/applet.h" #include "core/hle/applets/erreula.h" #include "core/hle/applets/mii_selector.h" #include "core/hle/applets/swkbd.h" diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 9ad77994c..14964427b 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/applets/erreula.h" #include "common/string_util.h" +#include "core/hle/applets/erreula.h" #include "core/hle/service/apt/apt.h" namespace HLE { diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 53d5b4ab4..53a8683a4 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/applets/mii_selector.h" #include #include #include "common/assert.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/hle/applets/mii_selector.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index b26107332..06ddf538b 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/applets/swkbd.h" #include #include #include "common/assert.h" #include "common/logging/log.h" #include "common/string_util.h" +#include "core/hle/applets/swkbd.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/result.h" diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp index 00efc179e..ccd73cfcb 100644 --- a/src/core/hle/config_mem.cpp +++ b/src/core/hle/config_mem.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/config_mem.h" #include +#include "core/hle/config_mem.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 5749068d6..41b772163 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/hle.h" #include "common/assert.h" #include "common/logging/log.h" #include "core/arm/arm_interface.h" #include "core/core.h" +#include "core/hle/hle.h" #include "core/hle/service/service.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index bcb4ee46f..37eec4c84 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/address_arbiter.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/hle.h" +#include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/thread.h" #include "core/memory.h" diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index eed333995..aedc6f989 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/client_port.h" #include "common/assert.h" +#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/server_port.h" diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index cf8e6fa17..1489c7002 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/event.h" #include #include #include #include "common/assert.h" +#include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 49bf95618..9a2c8ce05 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/kernel.h" #include #include "common/assert.h" #include "common/logging/log.h" #include "core/hle/config_mem.h" +#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp index d13bc74c6..e65fd5c41 100644 --- a/src/core/hle/kernel/memory.cpp +++ b/src/core/hle/kernel/memory.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/memory.h" #include #include #include @@ -11,6 +10,7 @@ #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/config_mem.h" +#include "core/hle/kernel/memory.h" #include "core/hle/kernel/vm_manager.h" #include "core/hle/result.h" #include "core/hle/shared_page.h" diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 4cd237b44..736944bae 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/mutex.h" #include #include #include #include "common/assert.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/mutex.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index a94d74263..ba80fe7f8 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/process.h" #include #include "common/assert.h" #include "common/common_funcs.h" #include "common/logging/log.h" #include "core/hle/kernel/memory.h" +#include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/thread.h" #include "core/hle/kernel/vm_manager.h" diff --git a/src/core/hle/kernel/resource_limit.cpp b/src/core/hle/kernel/resource_limit.cpp index 64c91cc62..253ab7045 100644 --- a/src/core/hle/kernel/resource_limit.cpp +++ b/src/core/hle/kernel/resource_limit.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/resource_limit.h" #include #include "common/logging/log.h" +#include "core/hle/kernel/resource_limit.h" namespace Kernel { diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp index 2a9ced5b9..bf7600780 100644 --- a/src/core/hle/kernel/semaphore.cpp +++ b/src/core/hle/kernel/semaphore.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/semaphore.h" #include "common/assert.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/semaphore.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index 12a709cee..8e3ec8a14 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/server_port.h" #include #include "common/assert.h" #include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/thread.h" namespace Kernel { diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 8ab916e5b..bc1560d12 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/shared_memory.h" #include #include "common/logging/log.h" #include "core/hle/kernel/memory.h" +#include "core/hle/kernel/shared_memory.h" #include "core/memory.h" namespace Kernel { diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 0185c3ae3..4486a812c 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/thread.h" #include #include #include @@ -20,6 +19,7 @@ #include "core/hle/kernel/memory.h" #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/process.h" +#include "core/hle/kernel/thread.h" #include "core/hle/result.h" #include "core/memory.h" diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index 7432f3567..a9f98223c 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/timer.h" #include #include "common/assert.h" #include "common/logging/log.h" #include "core/core_timing.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/thread.h" +#include "core/hle/kernel/timer.h" namespace Kernel { diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 488898641..6dd24f846 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/kernel/vm_manager.h" #include #include "common/assert.h" +#include "core/hle/kernel/vm_manager.h" #include "core/memory.h" #include "core/memory_setup.h" #include "core/mmio.h" diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp index 0b61bfae8..12d94f37a 100644 --- a/src/core/hle/service/ac_u.cpp +++ b/src/core/hle/service/ac_u.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ac_u.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/ac_u.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace AC_U diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e9adfaa1b..f7a990d69 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am.h" #include #include "common/logging/log.h" +#include "core/hle/service/am/am.h" #include "core/hle/service/am/am_app.h" #include "core/hle/service/am/am_net.h" #include "core/hle/service/am/am_sys.h" diff --git a/src/core/hle/service/am/am_app.cpp b/src/core/hle/service/am/am_app.cpp index 827e60335..bfc1ca6bd 100644 --- a/src/core/hle/service/am/am_app.cpp +++ b/src/core/hle/service/am/am_app.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_app.h" #include "core/hle/service/am/am.h" +#include "core/hle/service/am/am_app.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/am/am_net.cpp b/src/core/hle/service/am/am_net.cpp index d9d9d78c8..3a597a34c 100644 --- a/src/core/hle/service/am/am_net.cpp +++ b/src/core/hle/service/am/am_net.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_net.h" #include "core/hle/service/am/am.h" +#include "core/hle/service/am/am_net.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/am/am_sys.cpp b/src/core/hle/service/am/am_sys.cpp index 6f441f9e7..a2268303c 100644 --- a/src/core/hle/service/am/am_sys.cpp +++ b/src/core/hle/service/am/am_sys.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_sys.h" #include "core/hle/service/am/am.h" +#include "core/hle/service/am/am_sys.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/am/am_u.cpp b/src/core/hle/service/am/am_u.cpp index c40e56205..151b5e42b 100644 --- a/src/core/hle/service/am/am_u.cpp +++ b/src/core/hle/service/am/am_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/am/am_u.h" #include "core/hle/service/am/am.h" +#include "core/hle/service/am/am_u.h" namespace Service { namespace AM { diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 6240286bb..c4bd65986 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt.h" #include "common/common_paths.h" #include "common/file_util.h" #include "common/logging/log.h" @@ -11,6 +10,7 @@ #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/shared_memory.h" +#include "core/hle/service/apt/apt.h" #include "core/hle/service/apt/apt_a.h" #include "core/hle/service/apt/apt_s.h" #include "core/hle/service/apt/apt_u.h" diff --git a/src/core/hle/service/apt/apt_a.cpp b/src/core/hle/service/apt/apt_a.cpp index 09198d52b..f27ad91b7 100644 --- a/src/core/hle/service/apt/apt_a.cpp +++ b/src/core/hle/service/apt/apt_a.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_a.h" #include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_a.h" namespace Service { namespace APT { diff --git a/src/core/hle/service/apt/apt_s.cpp b/src/core/hle/service/apt/apt_s.cpp index f5afb78e8..c4556a5de 100644 --- a/src/core/hle/service/apt/apt_s.cpp +++ b/src/core/hle/service/apt/apt_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_s.h" #include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_s.h" namespace Service { namespace APT { diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index 184534b01..d6ad42e21 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/apt/apt_u.h" #include "core/hle/service/apt/apt.h" +#include "core/hle/service/apt/apt_u.h" namespace Service { namespace APT { diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index be2e42963..5594aedab 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cam/cam.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/cam/cam.h" #include "core/hle/service/cam/cam_c.h" #include "core/hle/service/cam/cam_q.h" #include "core/hle/service/cam/cam_s.h" diff --git a/src/core/hle/service/cam/cam_u.cpp b/src/core/hle/service/cam/cam_u.cpp index 125aa7d1f..af2123e5b 100644 --- a/src/core/hle/service/cam/cam_u.cpp +++ b/src/core/hle/service/cam/cam_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cam/cam_u.h" #include "core/hle/service/cam/cam.h" +#include "core/hle/service/cam/cam_u.h" namespace Service { namespace CAM { diff --git a/src/core/hle/service/cecd/cecd.cpp b/src/core/hle/service/cecd/cecd.cpp index 4d8916bdf..515b344e6 100644 --- a/src/core/hle/service/cecd/cecd.cpp +++ b/src/core/hle/service/cecd/cecd.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cecd/cecd.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/cecd/cecd.h" #include "core/hle/service/cecd/cecd_s.h" #include "core/hle/service/cecd/cecd_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/cecd/cecd_u.cpp b/src/core/hle/service/cecd/cecd_u.cpp index f220bba12..4b747de7b 100644 --- a/src/core/hle/service/cecd/cecd_u.cpp +++ b/src/core/hle/service/cecd/cecd_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cecd/cecd_u.h" #include "core/hle/service/cecd/cecd.h" +#include "core/hle/service/cecd/cecd_u.h" namespace Service { namespace CECD { diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 1f706751f..24eee6903 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg.h" #include #include "common/file_util.h" #include "common/logging/log.h" @@ -11,6 +10,7 @@ #include "core/file_sys/archive_systemsavedata.h" #include "core/file_sys/file_backend.h" #include "core/hle/result.h" +#include "core/hle/service/cfg/cfg.h" #include "core/hle/service/cfg/cfg_i.h" #include "core/hle/service/cfg/cfg_s.h" #include "core/hle/service/cfg/cfg_u.h" diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp index ed0217e53..2ff52c8b8 100644 --- a/src/core/hle/service/cfg/cfg_i.cpp +++ b/src/core/hle/service/cfg/cfg_i.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg_i.h" #include "core/hle/service/cfg/cfg.h" +#include "core/hle/service/cfg/cfg_i.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/cfg/cfg_s.cpp b/src/core/hle/service/cfg/cfg_s.cpp index 51e7b9752..eed26dec7 100644 --- a/src/core/hle/service/cfg/cfg_s.cpp +++ b/src/core/hle/service/cfg/cfg_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg_s.h" #include "core/hle/service/cfg/cfg.h" +#include "core/hle/service/cfg/cfg_s.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp index 3f812291b..f28217134 100644 --- a/src/core/hle/service/cfg/cfg_u.cpp +++ b/src/core/hle/service/cfg/cfg_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/cfg/cfg_u.h" #include "core/hle/service/cfg/cfg.h" +#include "core/hle/service/cfg/cfg_u.h" namespace Service { namespace CFG { diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp index e777ea9d6..20c759ad7 100644 --- a/src/core/hle/service/csnd_snd.cpp +++ b/src/core/hle/service/csnd_snd.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/csnd_snd.h" #include #include "common/alignment.h" #include "core/hle/hle.h" #include "core/hle/kernel/mutex.h" #include "core/hle/kernel/shared_memory.h" +#include "core/hle/service/csnd_snd.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace CSND_SND diff --git a/src/core/hle/service/dlp/dlp_srvr.cpp b/src/core/hle/service/dlp/dlp_srvr.cpp index 113f6a79f..49d5b8d1c 100644 --- a/src/core/hle/service/dlp/dlp_srvr.cpp +++ b/src/core/hle/service/dlp/dlp_srvr.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/dlp/dlp_srvr.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/result.h" +#include "core/hle/service/dlp/dlp_srvr.h" namespace Service { namespace DLP { diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 3f2f09f60..a15aa3696 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/dsp_dsp.h" #include #include #include "audio_core/hle/pipe.h" #include "common/hash.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/dsp_dsp.h" using DspPipe = DSP::HLE::DspPipe; diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp index ff606d883..3ca4f98de 100644 --- a/src/core/hle/service/err_f.cpp +++ b/src/core/hle/service/err_f.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/err_f.h" #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "core/hle/service/err_f.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace ERR_F diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp index bd89b522b..fa5080535 100644 --- a/src/core/hle/service/frd/frd.cpp +++ b/src/core/hle/service/frd/frd.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/frd/frd.h" #include "common/string_util.h" +#include "core/hle/service/frd/frd.h" #include "core/hle/service/frd/frd_a.h" #include "core/hle/service/frd/frd_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp index 92b53f2ef..bd1c9c16b 100644 --- a/src/core/hle/service/frd/frd_u.cpp +++ b/src/core/hle/service/frd/frd_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/frd/frd_u.h" #include "core/hle/service/frd/frd.h" +#include "core/hle/service/frd/frd_u.h" namespace Service { namespace FRD { diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index b945b255e..4dc7e1e3c 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/fs/archive.h" #include #include #include @@ -24,6 +23,7 @@ #include "core/file_sys/file_backend.h" #include "core/hle/hle.h" #include "core/hle/result.h" +#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/fs_user.h" #include "core/hle/service/service.h" #include "core/memory.h" diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp index 92578270b..94f053dc2 100644 --- a/src/core/hle/service/fs/fs_user.cpp +++ b/src/core/hle/service/fs/fs_user.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/fs/fs_user.h" #include "common/assert.h" #include "common/common_types.h" #include "common/file_util.h" @@ -11,6 +10,7 @@ #include "common/string_util.h" #include "core/hle/result.h" #include "core/hle/service/fs/archive.h" +#include "core/hle/service/fs/fs_user.h" #include "core/settings.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index ba148eaf1..710e0e485 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "gsp_gpu.h" #include "common/bit_field.h" #include "common/microprofile.h" #include "core/hle/kernel/event.h" @@ -12,6 +11,7 @@ #include "core/hw/hw.h" #include "core/hw/lcd.h" #include "core/memory.h" +#include "gsp_gpu.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/gpu_debugger.h" diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a050e81f7..99baded11 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/hid/hid.h" #include #include "common/emu_window.h" #include "common/logging/log.h" #include "core/core_timing.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" +#include "core/hle/service/hid/hid.h" #include "core/hle/service/hid/hid_spvr.h" #include "core/hle/service/hid/hid_user.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/hid/hid_spvr.cpp b/src/core/hle/service/hid/hid_spvr.cpp index 00a0902c8..09007e304 100644 --- a/src/core/hle/service/hid/hid_spvr.cpp +++ b/src/core/hle/service/hid/hid_spvr.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/hid/hid_spvr.h" #include "core/hle/service/hid/hid.h" +#include "core/hle/service/hid/hid_spvr.h" namespace Service { namespace HID { diff --git a/src/core/hle/service/hid/hid_user.cpp b/src/core/hle/service/hid/hid_user.cpp index 433e175bb..42591543c 100644 --- a/src/core/hle/service/hid/hid_user.cpp +++ b/src/core/hle/service/hid/hid_user.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/hid/hid_user.h" #include "core/hle/service/hid/hid.h" +#include "core/hle/service/hid/hid_user.h" namespace Service { namespace HID { diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index 459fe0691..4d6639ded 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ir/ir.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/shared_memory.h" +#include "core/hle/service/ir/ir.h" #include "core/hle/service/ir/ir_rst.h" #include "core/hle/service/ir/ir_u.h" #include "core/hle/service/ir/ir_user.h" diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp index 5e7a011ff..1f10ebd3d 100644 --- a/src/core/hle/service/ir/ir_rst.cpp +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ir/ir_rst.h" #include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_rst.h" namespace Service { namespace IR { diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp index cca71a0dd..6cff1d544 100644 --- a/src/core/hle/service/ir/ir_user.cpp +++ b/src/core/hle/service/ir/ir_user.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ir/ir_user.h" #include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_user.h" namespace Service { namespace IR { diff --git a/src/core/hle/service/ldr_ro/cro_helper.cpp b/src/core/hle/service/ldr_ro/cro_helper.cpp index f583f5c31..b7d250312 100644 --- a/src/core/hle/service/ldr_ro/cro_helper.cpp +++ b/src/core/hle/service/ldr_ro/cro_helper.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ldr_ro/cro_helper.h" #include "common/alignment.h" #include "common/logging/log.h" #include "common/scope_exit.h" +#include "core/hle/service/ldr_ro/cro_helper.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace LDR_RO diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp index 3faa2e5d7..ec183d1f5 100644 --- a/src/core/hle/service/ldr_ro/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ldr_ro/ldr_ro.h" #include "common/alignment.h" #include "common/common_types.h" #include "common/logging/log.h" @@ -10,6 +9,7 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/vm_manager.h" #include "core/hle/service/ldr_ro/cro_helper.h" +#include "core/hle/service/ldr_ro/ldr_ro.h" #include "core/hle/service/ldr_ro/memory_synchronizer.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp index a3e590dfd..989887264 100644 --- a/src/core/hle/service/ldr_ro/memory_synchronizer.cpp +++ b/src/core/hle/service/ldr_ro/memory_synchronizer.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ldr_ro/memory_synchronizer.h" #include #include "common/assert.h" +#include "core/hle/service/ldr_ro/memory_synchronizer.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace LDR_RO diff --git a/src/core/hle/service/ndm/ndm.cpp b/src/core/hle/service/ndm/ndm.cpp index fcfa4b336..5eb97f0d3 100644 --- a/src/core/hle/service/ndm/ndm.cpp +++ b/src/core/hle/service/ndm/ndm.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ndm/ndm.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "core/hle/service/ndm/ndm.h" #include "core/hle/service/ndm/ndm_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/ndm/ndm_u.cpp b/src/core/hle/service/ndm/ndm_u.cpp index 4fc93850d..f5c7a341a 100644 --- a/src/core/hle/service/ndm/ndm_u.cpp +++ b/src/core/hle/service/ndm/ndm_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ndm/ndm_u.h" #include "core/hle/service/ndm/ndm.h" +#include "core/hle/service/ndm/ndm_u.h" namespace Service { namespace NDM { diff --git a/src/core/hle/service/news/news.cpp b/src/core/hle/service/news/news.cpp index f22c49f52..8b70ec45b 100644 --- a/src/core/hle/service/news/news.cpp +++ b/src/core/hle/service/news/news.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/news/news.h" #include "common/logging/log.h" +#include "core/hle/service/news/news.h" #include "core/hle/service/news/news_s.h" #include "core/hle/service/news/news_u.h" #include "core/hle/service/service.h" diff --git a/src/core/hle/service/news/news_s.cpp b/src/core/hle/service/news/news_s.cpp index 0e4b650f3..dda3d0f6a 100644 --- a/src/core/hle/service/news/news_s.cpp +++ b/src/core/hle/service/news/news_s.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/news/news_s.h" #include "core/hle/service/news/news.h" +#include "core/hle/service/news/news_s.h" namespace Service { namespace NEWS { diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 60505545c..0be94322c 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/nim/nim.h" #include "common/common_types.h" #include "common/logging/log.h" +#include "core/hle/service/nim/nim.h" #include "core/hle/service/nim/nim_aoc.h" #include "core/hle/service/nim/nim_s.h" #include "core/hle/service/nim/nim_u.h" diff --git a/src/core/hle/service/nim/nim_u.cpp b/src/core/hle/service/nim/nim_u.cpp index a4fd9781f..7e07d02e8 100644 --- a/src/core/hle/service/nim/nim_u.cpp +++ b/src/core/hle/service/nim/nim_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/nim/nim_u.h" #include "core/hle/service/nim/nim.h" +#include "core/hle/service/nim/nim_u.h" namespace Service { namespace NIM { diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 3b608dcbb..27e829209 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/nwm_uds.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/nwm_uds.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace NWM_UDS diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 29b9071c8..6e6b63329 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ptm/ptm.h" #include "common/logging/log.h" #include "core/file_sys/file_backend.h" #include "core/hle/service/fs/archive.h" +#include "core/hle/service/ptm/ptm.h" #include "core/hle/service/ptm/ptm_play.h" #include "core/hle/service/ptm/ptm_sysm.h" #include "core/hle/service/ptm/ptm_u.h" diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp index 590660f60..693158dbf 100644 --- a/src/core/hle/service/ptm/ptm_sysm.cpp +++ b/src/core/hle/service/ptm/ptm_sysm.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ptm/ptm_sysm.h" #include "core/hle/service/ptm/ptm.h" +#include "core/hle/service/ptm/ptm_sysm.h" namespace Service { namespace PTM { diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp index 155e10df1..65e868393 100644 --- a/src/core/hle/service/ptm/ptm_u.cpp +++ b/src/core/hle/service/ptm/ptm_u.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ptm/ptm_u.h" #include "core/hle/service/ptm/ptm.h" +#include "core/hle/service/ptm/ptm_u.h" namespace Service { namespace PTM { diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index eff51af04..ca7eeac8a 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/service.h" #include "common/logging/log.h" #include "common/string_util.h" #include "core/hle/service/ac_u.h" @@ -34,6 +33,7 @@ #include "core/hle/service/nwm_uds.h" #include "core/hle/service/pm_app.h" #include "core/hle/service/ptm/ptm.h" +#include "core/hle/service/service.h" #include "core/hle/service/soc_u.h" #include "core/hle/service/srv.h" #include "core/hle/service/ssl_c.h" diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 1eab61e52..4279b67fb 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/soc_u.h" #include #include #include @@ -14,6 +13,7 @@ #include "common/scope_exit.h" #include "core/hle/kernel/session.h" #include "core/hle/result.h" +#include "core/hle/service/soc_u.h" #include "core/memory.h" #ifdef _WIN32 diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 241a5da94..b25be413a 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/srv.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" +#include "core/hle/service/srv.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace SRV diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp index 16ec3d116..abab1d271 100644 --- a/src/core/hle/service/ssl_c.cpp +++ b/src/core/hle/service/ssl_c.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/ssl_c.h" #include #include "common/common_types.h" +#include "core/hle/service/ssl_c.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace SSL_C diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index 38e15b5d0..097e09d28 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp @@ -2,13 +2,13 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/service/y2r_u.h" #include #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/service/y2r_u.h" #include "core/hw/y2r.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hle/shared_page.cpp b/src/core/hle/shared_page.cpp index 74a9031c5..d0d92487d 100644 --- a/src/core/hle/shared_page.cpp +++ b/src/core/hle/shared_page.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hle/shared_page.h" #include #include #include #include "core/core_timing.h" +#include "core/hle/shared_page.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 776c8fef7..0e6b91e3a 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hw/gpu.h" #include #include #include @@ -14,6 +13,7 @@ #include "core/core_timing.h" #include "core/hle/service/gsp_gpu.h" #include "core/hle/service/hid/hid.h" +#include "core/hw/gpu.h" #include "core/hw/hw.h" #include "core/memory.h" #include "core/settings.h" diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp index 0f84d5adb..9ff8825b2 100644 --- a/src/core/hw/hw.cpp +++ b/src/core/hw/hw.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hw/hw.h" #include "common/common_types.h" #include "common/logging/log.h" #include "core/hw/gpu.h" +#include "core/hw/hw.h" #include "core/hw/lcd.h" namespace HW { diff --git a/src/core/hw/lcd.cpp b/src/core/hw/lcd.cpp index 5231e4cc5..2aa89de18 100644 --- a/src/core/hw/lcd.cpp +++ b/src/core/hw/lcd.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hw/lcd.h" #include #include "common/common_types.h" #include "common/logging/log.h" #include "core/hw/hw.h" +#include "core/hw/lcd.h" #include "core/tracer/recorder.h" #include "video_core/debug_utils/debug_utils.h" diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp index 0e13420d7..6a6c707a2 100644 --- a/src/core/hw/y2r.cpp +++ b/src/core/hw/y2r.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/hw/y2r.h" #include #include #include @@ -13,6 +12,7 @@ #include "common/math_util.h" #include "common/vector_math.h" #include "core/hle/service/y2r_u.h" +#include "core/hw/y2r.h" #include "core/memory.h" namespace HW { diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp index 212772c5d..1c10740a0 100644 --- a/src/core/loader/3dsx.cpp +++ b/src/core/loader/3dsx.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/loader/3dsx.h" #include #include #include "common/logging/log.h" @@ -10,6 +9,7 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/fs/archive.h" +#include "core/loader/3dsx.h" #include "core/memory.h" namespace Loader { diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 0f4148a59..8eb5200ab 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/loader/elf.h" #include #include #include @@ -12,6 +11,7 @@ #include "common/symbols.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" +#include "core/loader/elf.h" #include "core/memory.h" using Kernel::SharedPtr; diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 64c8fef07..2e4510857 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/loader/ncch.h" #include #include #include @@ -13,6 +12,7 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/fs/archive.h" +#include "core/loader/ncch.h" #include "core/memory.h" //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/loader/smdh.cpp b/src/core/loader/smdh.cpp index 7c875131f..ccbeb7961 100644 --- a/src/core/loader/smdh.cpp +++ b/src/core/loader/smdh.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/loader/smdh.h" #include #include #include "common/common_types.h" #include "core/loader/loader.h" +#include "core/loader/smdh.h" #include "video_core/utils.h" namespace Loader { diff --git a/src/core/memory.cpp b/src/core/memory.cpp index c702fa311..df029d655 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/memory.h" #include #include #include "common/assert.h" @@ -10,6 +9,7 @@ #include "common/logging/log.h" #include "common/swap.h" #include "core/hle/kernel/process.h" +#include "core/memory.h" #include "core/memory_setup.h" #include "core/mmio.h" #include "video_core/renderer_base.h" diff --git a/src/core/settings.cpp b/src/core/settings.cpp index f2d1b5e74..4a0969b00 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "settings.h" #include "audio_core/audio_core.h" #include "core/gdbstub/gdbstub.h" +#include "settings.h" #include "video_core/video_core.h" namespace Settings { diff --git a/src/core/system.cpp b/src/core/system.cpp index ef190203c..7d54811a0 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/system.h" #include "audio_core/audio_core.h" #include "core/core.h" #include "core/core_timing.h" @@ -11,6 +10,7 @@ #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/memory.h" #include "core/hw/hw.h" +#include "core/system.h" #include "video_core/video_core.h" namespace System { diff --git a/src/core/tracer/recorder.cpp b/src/core/tracer/recorder.cpp index ba4362484..276a5b288 100644 --- a/src/core/tracer/recorder.cpp +++ b/src/core/tracer/recorder.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "recorder.h" #include #include "common/assert.h" #include "common/file_util.h" #include "common/logging/log.h" +#include "recorder.h" namespace CiTrace { diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp index 5aad47418..05b5cea73 100644 --- a/src/video_core/clipper.cpp +++ b/src/video_core/clipper.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/clipper.h" #include #include #include @@ -12,6 +11,7 @@ #include "common/common_types.h" #include "common/logging/log.h" #include "common/vector_math.h" +#include "video_core/clipper.h" #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 5c74b68e9..bb618cacd 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/command_processor.h" #include #include #include @@ -15,6 +14,7 @@ #include "core/hw/gpu.h" #include "core/memory.h" #include "core/tracer/recorder.h" +#include "video_core/command_processor.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica.h" #include "video_core/pica_state.h" diff --git a/src/video_core/pica.cpp b/src/video_core/pica.cpp index 771e83fe7..ce2bd455e 100644 --- a/src/video_core/pica.cpp +++ b/src/video_core/pica.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/pica.h" #include #include #include #include +#include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/primitive_assembly.h" #include "video_core/shader/shader.h" diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 670ffb67d..be7377290 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/primitive_assembly.h" #include "common/logging/log.h" #include "video_core/pica.h" +#include "video_core/primitive_assembly.h" #include "video_core/shader/shader.h" namespace Pica { diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index c179573d6..6c4bbed33 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/rasterizer.h" #include #include #include @@ -20,6 +19,7 @@ #include "video_core/pica.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" +#include "video_core/rasterizer.h" #include "video_core/shader/shader.h" #include "video_core/utils.h" diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 91347dea8..fd38175b3 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_base.h" #include #include +#include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/swrasterizer.h" #include "video_core/video_core.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 45a4dc97d..60c9d9180 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_rasterizer.h" #include #include #include @@ -16,6 +15,7 @@ #include "core/hw/gpu.h" #include "video_core/pica.h" #include "video_core/pica_state.h" +#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/pica_to_gl.h" diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index ce9a193bd..5cbad9b43 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include #include #include @@ -20,6 +19,7 @@ #include "core/memory.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/pica_state.h" +#include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include "video_core/renderer_opengl/gl_state.h" #include "video_core/utils.h" #include "video_core/video_core.h" diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 52cee2ee2..1808ee0a9 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_shader_gen.h" #include #include #include "common/assert.h" @@ -10,6 +9,7 @@ #include "common/logging/log.h" #include "video_core/pica.h" #include "video_core/renderer_opengl/gl_rasterizer.h" +#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_util.h" using Pica::Regs; diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index c8ba3b92d..fe07aa6eb 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_shader_util.h" #include #include #include "common/logging/log.h" +#include "video_core/renderer_opengl/gl_shader_util.h" namespace GLShader { diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 96af8469d..ed84cadea 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/gl_state.h" #include #include "common/common_funcs.h" #include "common/logging/log.h" +#include "video_core/renderer_opengl/gl_state.h" OpenGLState OpenGLState::cur_state; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 962785bdd..03a588364 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/renderer_opengl/renderer_opengl.h" #include #include #include @@ -22,6 +21,7 @@ #include "core/tracer/recorder.h" #include "video_core/debug_utils/debug_utils.h" #include "video_core/rasterizer_interface.h" +#include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/video_core.h" static const char vertex_shader[] = R"( diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 53e91df03..272f3ffe1 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/shader/shader.h" #include #include #include @@ -15,6 +14,7 @@ #include "common/microprofile.h" #include "video_core/pica.h" #include "video_core/pica_state.h" +#include "video_core/shader/shader.h" #include "video_core/shader/shader_interpreter.h" #ifdef ARCHITECTURE_x86_64 #include "video_core/shader/shader_jit_x64.h" diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 5df3c4e86..501d00b6b 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/shader/shader.h" #include #include #include @@ -14,6 +13,7 @@ #include "common/vector_math.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" +#include "video_core/shader/shader.h" #include "video_core/shader/shader_interpreter.h" using nihstro::OpCode; diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index 5f1323799..4d788755b 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -2,7 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "shader.h" #include #include #include @@ -14,6 +13,7 @@ #include "common/x64/abi.h" #include "common/x64/cpu_detect.h" #include "common/x64/emitter.h" +#include "shader.h" #include "shader_jit_x64.h" #include "video_core/pica_state.h" #include "video_core/pica_types.h" diff --git a/src/video_core/swrasterizer.cpp b/src/video_core/swrasterizer.cpp index ba458746c..9cd21f72b 100644 --- a/src/video_core/swrasterizer.cpp +++ b/src/video_core/swrasterizer.cpp @@ -2,8 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/swrasterizer.h" #include "video_core/clipper.h" +#include "video_core/swrasterizer.h" namespace VideoCore { diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp index 5704e9fea..2b8ef7018 100644 --- a/src/video_core/vertex_loader.cpp +++ b/src/video_core/vertex_loader.cpp @@ -1,4 +1,3 @@ -#include "video_core/vertex_loader.h" #include #include #include "common/alignment.h" @@ -13,6 +12,7 @@ #include "video_core/pica_state.h" #include "video_core/pica_types.h" #include "video_core/shader/shader.h" +#include "video_core/vertex_loader.h" namespace Pica { diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index b06a88b78..83e33dfc2 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "video_core/video_core.h" #include #include "common/logging/log.h" #include "video_core/pica.h" #include "video_core/renderer_base.h" #include "video_core/renderer_opengl/renderer_opengl.h" +#include "video_core/video_core.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // Video Core namespace -- cgit v1.2.3 From f120e78b5692e1c710f2335d36fd0593c447a613 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 21 Sep 2016 00:13:46 -0700 Subject: Remove special rules for Windows.h and library includes --- src/.clang-format | 10 +++------- src/common/file_util.cpp | 1 + src/common/memory_util.cpp | 1 + src/common/string_util.cpp | 2 +- src/core/gdbstub/gdbstub.cpp | 2 +- src/video_core/shader/shader_jit_x64.cpp | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src/common') diff --git a/src/.clang-format b/src/.clang-format index e4f5d6d7e..1c6b71b2e 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -46,14 +46,10 @@ DerivePointerAlignment: false DisableFormat: false ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] IncludeCategories: - - Regex: '^\<[wW]indows.h\>' - Priority: -3 - - Regex: '^\<(boost|catch|dynarmic|glad|inih|nihstro)/' - Priority: -1 - - Regex: '^\<(SDL|SoundTouch|Q)' - Priority: -1 - - Regex: '^\<' + - Regex: '^\<[^Q][^/.>]*\>' Priority: -2 + - Regex: '^\<' + Priority: -1 - Regex: '^\"' Priority: 0 IndentCaseLabels: false diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 7a21962cc..14cbcac6b 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -10,6 +10,7 @@ #ifdef _WIN32 #include +// windows.h needs to be included before other windows headers #include // for GetSaveFileName #include // getcwd #include diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp index e19d7202a..c19729b21 100644 --- a/src/common/memory_util.cpp +++ b/src/common/memory_util.cpp @@ -7,6 +7,7 @@ #ifdef _WIN32 #include +// Windows.h needs to be included before psapi.h #include #include "common/common_funcs.h" #include "common/string_util.h" diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index ca97e8ab4..596ae01bf 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -12,8 +12,8 @@ #include "common/logging/log.h" #include "common/string_util.h" #ifdef _MSC_VER -#include #include +#include #include "common/common_funcs.h" #else #include diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 6d709bd15..7fc72d801 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -10,9 +10,9 @@ #include #include #include -#include #include #include +#include #ifdef _MSC_VER #include diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index 4d788755b..211c703ab 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include #include "common/assert.h" #include "common/logging/log.h" #include "common/vector_math.h" -- cgit v1.2.3