diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp index 29a5f73d148..1cddf546001 100644 --- a/Source/Core/AudioCommon/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/DPL2Decoder.cpp @@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt) float fc1; // Cutoff frequencies // Sanity check - if(*n==0) return nullptr; + if (*n==0) return nullptr; MathUtil::Clamp(&fc[0],float(0.001),float(1)); float *w=(float*)calloc(sizeof(float),*n); diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp index 15a7b4d7f16..2b785ffaf42 100644 --- a/Source/Core/AudioCommon/Mixer.cpp +++ b/Source/Core/AudioCommon/Mixer.cpp @@ -48,8 +48,8 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_ float numLeft = ((indexW - indexR) & INDEX_MASK) / 2; m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG; float offset = (m_numLeftI - LOW_WATERMARK) * CONTROL_FACTOR; - if(offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT; - if(offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT; + if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT; + if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT; //render numleft sample pairs to samples[] //advance indexR with sample position @@ -65,7 +65,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples, bool consider_ static u32 frac = 0; const u32 ratio = (u32)( 65536.0f * aid_sample_rate / (float)m_sampleRate ); - if(ratio > 0x10000) + if (ratio > 0x10000) ERROR_LOG(AUDIO, "ratio out of range"); for (; currentSample < numSamples*2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample+=2) { diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index 38e57beca21..fb4d778b126 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -105,7 +105,7 @@ void OpenALStream::Clear(bool mute) { m_muted = mute; - if(m_muted) + if (m_muted) { soundTouch.clear(); alSourceStop(uiSource); diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp index bc5d0f3f5ff..b4d27727095 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/PulseAudioStream.cpp @@ -49,7 +49,7 @@ void PulseAudio::SoundLoop() while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0) m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr); - if(m_pa_error < 0) + if (m_pa_error < 0) ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error)); PulseShutdown(); diff --git a/Source/Core/Common/ArmEmitter.cpp b/Source/Core/Common/ArmEmitter.cpp index c64ca164449..ded0944e57f 100644 --- a/Source/Core/Common/ArmEmitter.cpp +++ b/Source/Core/Common/ArmEmitter.cpp @@ -193,9 +193,9 @@ void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch) void ARMXEmitter::FlushLitPool() { - for(LiteralPool& pool : currentLitPool) { + for (LiteralPool& pool : currentLitPool) { // Search for duplicates - for(LiteralPool& old_pool : currentLitPool) { + for (LiteralPool& old_pool : currentLitPool) { if (old_pool.val == pool.val) pool.loc = old_pool.loc; } @@ -242,7 +242,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize) { // Use MOVW+MOVT for ARMv7+ MOVW(reg, val & 0xFFFF); - if(val & 0xFFFF0000) + if (val & 0xFFFF0000) MOVT(reg, val, true); } else if (!TrySetValue_TwoOp(reg,val)) { // Use literal pool for ARMv6. diff --git a/Source/Core/Common/ArmEmitter.h b/Source/Core/Common/ArmEmitter.h index 841cc70176e..e974bed3316 100644 --- a/Source/Core/Common/ArmEmitter.h +++ b/Source/Core/Common/ArmEmitter.h @@ -161,7 +161,7 @@ public: Operand2(ARMReg base, ShiftType type, u8 shift)// For IMM shifted register { - if(shift == 32) shift = 0; + if (shift == 32) shift = 0; switch (type) { case ST_LSL: @@ -198,7 +198,7 @@ public: } u32 GetData() { - switch(Type) + switch (Type) { case TYPE_IMM: return Imm12Mod(); // This'll need to be changed later diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp index 2f1c24f1466..4dfdcacd640 100644 --- a/Source/Core/Common/CDUtils.cpp +++ b/Source/Core/Common/CDUtils.cpp @@ -73,11 +73,11 @@ std::vector cdio_get_devices() std::vector drives; kern_result = IOMasterPort( MACH_PORT_NULL, &master_port ); - if( kern_result != KERN_SUCCESS ) + if (kern_result != KERN_SUCCESS) return( drives ); classes_to_match = IOServiceMatching( kIOCDMediaClass ); - if( classes_to_match == nullptr ) + if (classes_to_match == nullptr) return( drives ); CFDictionarySetValue( classes_to_match, @@ -85,11 +85,11 @@ std::vector cdio_get_devices() kern_result = IOServiceGetMatchingServices( master_port, classes_to_match, &media_iterator ); - if( kern_result != KERN_SUCCESS) + if (kern_result != KERN_SUCCESS) return( drives ); next_media = IOIteratorNext( media_iterator ); - if( next_media != 0 ) + if (next_media != 0) { char psz_buf[0x32]; size_t dev_path_length; @@ -101,7 +101,7 @@ std::vector cdio_get_devices() IORegistryEntryCreateCFProperty( next_media, CFSTR( kIOBSDNameKey ), kCFAllocatorDefault, 0 ); - if( str_bsd_path == nullptr ) + if (str_bsd_path == nullptr) { IOObjectRelease( next_media ); continue; @@ -113,12 +113,12 @@ std::vector cdio_get_devices() snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' ); dev_path_length = strlen( psz_buf ); - if( CFStringGetCString( (CFStringRef)str_bsd_path, + if (CFStringGetCString( (CFStringRef)str_bsd_path, (char*)&psz_buf + dev_path_length, sizeof(psz_buf) - dev_path_length, kCFStringEncodingASCII)) { - if(psz_buf != nullptr) + if (psz_buf != nullptr) { std::string str = psz_buf; drives.push_back(str); @@ -127,7 +127,7 @@ std::vector cdio_get_devices() CFRelease( str_bsd_path ); IOObjectRelease( next_media ); - } while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 ); + } while (( next_media = IOIteratorNext( media_iterator ) ) != 0); } IOObjectRelease( media_iterator ); return drives; @@ -175,7 +175,7 @@ static bool is_cdrom(const std::string& drive, char *mnttype) bool is_cd=false; // If it does exist, verify that it is a cdrom/dvd drive int cdfd = open(drive.c_str(), (O_RDONLY|O_NONBLOCK), 0); - if ( cdfd >= 0 ) + if (cdfd >= 0) { #ifdef __linux__ if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1) diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h index e19d97793b3..e89b98ad990 100644 --- a/Source/Core/Common/ChunkFile.h +++ b/Source/Core/Common/ChunkFile.h @@ -306,7 +306,7 @@ private: void DoVoid(void *data, u32 size) { - for(u32 i = 0; i != size; ++i) + for (u32 i = 0; i != size; ++i) DoByte(reinterpret_cast(data)[i]); } }; diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h index 11f460ed964..220b76f1427 100644 --- a/Source/Core/Common/CommonFuncs.h +++ b/Source/Core/Common/CommonFuncs.h @@ -35,8 +35,8 @@ struct ArraySizeImpl : public std::extent #define __GNUC_PREREQ(a, b) 0 #endif -#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) \ - && !defined __SSSE3__ && !defined _M_GENERIC +#if (defined __GNUC__ && !__GNUC_PREREQ(4,9)) && \ + !defined __SSSE3__ && !defined _M_GENERIC #include static __inline __m128i __attribute__((__always_inline__)) _mm_shuffle_epi8(__m128i a, __m128i mask) @@ -122,18 +122,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){ // Retrieve the current thread-specific locale locale_t old_locale = bIsPerThread ? _get_current_locale() : LC_GLOBAL_LOCALE; - if(new_locale == LC_GLOBAL_LOCALE) + if (new_locale == LC_GLOBAL_LOCALE) { // Restore the global locale _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); } - else if(new_locale != nullptr) + else if (new_locale != nullptr) { // Configure the thread to set the locale only for this thread _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); // Set all locale categories - for(int i = LC_MIN; i <= LC_MAX; i++) + for (int i = LC_MIN; i <= LC_MAX; i++) setlocale(i, new_locale->locinfo->lc_category[i].locale); } diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp index 3a7968ba7d8..b324f1ec798 100644 --- a/Source/Core/Common/Crypto/ec.cpp +++ b/Source/Core/Common/Crypto/ec.cpp @@ -318,7 +318,7 @@ static void silly_random(u8 * rndArea, u8 count) u16 i; srand((unsigned) (time(nullptr))); - for(i=0;id_name); - if ((found != ".") && (found != "..") - && (found.size() >= end_match.size()) - && std::equal(end_match.rbegin(), end_match.rend(), found.rbegin())) + if ((found != ".") && (found != "..") && + (found.size() >= end_match.size()) && + std::equal(end_match.rbegin(), end_match.rend(), found.rbegin())) { std::string full_name; if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR) diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp index f9a6d6fd4d6..f7ed8f308f4 100644 --- a/Source/Core/Common/Hash.cpp +++ b/Source/Core/Common/Hash.cpp @@ -155,9 +155,9 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples) const u8 * data = (const u8*)src; const int nblocks = len / 16; u32 Step = (len / 8); - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; + if (Step < 1) Step = 1; u64 h1 = 0x9368e53c2f6af274; u64 h2 = 0x586dcd208f7cd3fd; @@ -171,7 +171,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples) const u64 * blocks = (const u64 *)(data); - for(int i = 0; i < nblocks; i+=Step) + for (int i = 0; i < nblocks; i+=Step) { u64 k1 = getblock(blocks,i*2+0); u64 k2 = getblock(blocks,i*2+1); @@ -187,7 +187,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples) u64 k1 = 0; u64 k2 = 0; - switch(len & 15) + switch (len & 15) { case 15: k2 ^= u64(tail[14]) << 48; case 14: k2 ^= u64(tail[13]) << 40; @@ -233,10 +233,10 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; - while(data < end) + if (Step < 1) Step = 1; + while (data < end) { h = _mm_crc32_u64(h, data[0]); data += Step; @@ -265,10 +265,10 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; - while(data < end) + if (Step < 1) Step = 1; + while (data < end) { u64 k = data[0]; data+=Step; @@ -281,7 +281,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) const u8 * data2 = (const u8*)end; - switch(len & 7) + switch (len & 7) { case 7: h ^= u64(data2[6]) << 48; case 6: h ^= u64(data2[5]) << 40; @@ -308,10 +308,10 @@ u64 GetCRC32(const u8 *src, int len, u32 samples) u32 Step = (len/4); const u32 *data = (const u32 *)src; const u32 *end = data + Step; - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; - while(data < end) + if (Step < 1) Step = 1; + while (data < end) { h = _mm_crc32_u32(h, data[0]); data += Step; @@ -380,9 +380,9 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) u32 out[2]; const int nblocks = len / 8; u32 Step = (len / 4); - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; + if (Step < 1) Step = 1; u32 h1 = 0x8de1c3ac; u32 h2 = 0xbab98226; @@ -395,7 +395,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) const u32 * blocks = (const u32 *)(data + nblocks*8); - for(int i = -nblocks; i < 0; i+=Step) + for (int i = -nblocks; i < 0; i+=Step) { u32 k1 = getblock(blocks,i*2+0); u32 k2 = getblock(blocks,i*2+1); @@ -411,7 +411,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples) u32 k1 = 0; u32 k2 = 0; - switch(len & 7) + switch (len & 7) { case 7: k2 ^= tail[6] << 16; case 6: k2 ^= tail[5] << 8; @@ -456,10 +456,10 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) u32 Step = (len / 8); const u64 *data = (const u64 *)src; const u64 *end = data + Step; - if(samples == 0) samples = max(Step, 1u); + if (samples == 0) samples = max(Step, 1u); Step = Step / samples; - if(Step < 1) Step = 1; - while(data < end) + if (Step < 1) Step = 1; + while (data < end) { u64 k = data[0]; data+=Step; @@ -472,7 +472,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples) const u8 * data2 = (const u8*)end; - switch(len & 7) + switch (len & 7) { case 7: h ^= u64(data2[6]) << 48; case 6: h ^= u64(data2[5]) << 40; diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 604aefc89c2..5fb5ce1e38a 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -373,8 +373,11 @@ bool IniFile::Load(const std::string& filename, bool keep_current_data) // Lines starting with '$', '*' or '+' are kept verbatim. // Kind of a hack, but the support for raw lines inside an // INI is a hack anyway. - if ((key == "" && value == "") - || (line.size() >= 1 && (line[0] == '$' || line[0] == '+' || line[0] == '*'))) + if ((key == "" && value == "") || + (line.size() >= 1 && + (line[0] == '$' || + line[0] == '+' || + line[0] == '*'))) current_section->lines.push_back(line); else current_section->Set(key, value); diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h index 876124ac2d8..f431479b248 100644 --- a/Source/Core/Common/LinearDiskCache.h +++ b/Source/Core/Common/LinearDiskCache.h @@ -150,8 +150,8 @@ private: { 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 diff --git a/Source/Core/Common/MathUtil.cpp b/Source/Core/Common/MathUtil.cpp index de56fb680d4..eaff3f40ff2 100644 --- a/Source/Core/Common/MathUtil.cpp +++ b/Source/Core/Common/MathUtil.cpp @@ -195,7 +195,7 @@ void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33) void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16]) { - for(int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { mtx.data[i] = mtxArray[i]; } diff --git a/Source/Core/Common/MsgHandler.cpp b/Source/Core/Common/MsgHandler.cpp index cfeb6562e7a..dff2f5ad0f6 100644 --- a/Source/Core/Common/MsgHandler.cpp +++ b/Source/Core/Common/MsgHandler.cpp @@ -56,7 +56,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...) crit_caption = str_translator(_trans("Critical")); } - switch(Style) + switch (Style) { case INFORMATION: caption = info_caption; diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp index 21cabaf4b43..46acff321d7 100644 --- a/Source/Core/Common/SettingsHandler.cpp +++ b/Source/Core/Common/SettingsHandler.cpp @@ -84,13 +84,13 @@ void SettingsHandler::Reset() void SettingsHandler::AddSetting(const std::string& key, const std::string& value) { - for(const char& c : key) { + for (const char& c : key) { WriteByte(c); } WriteByte('='); - for(const char& c : value) { + for (const char& c : value) { WriteByte(c); } diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 19190831620..9a42d35fd6b 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -173,8 +173,8 @@ 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 @@ -275,7 +275,7 @@ std::string TabsToSpaces(int tab_size, const std::string &in) std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest) { - while(1) + while (1) { size_t pos = result.find(src); if (pos == std::string::npos) break; @@ -336,8 +336,8 @@ std::string UriDecode(const std::string & sSrc) if (*pSrc == '%') { char dec1, dec2; - if (16 != (dec1 = HEX2DEC[*(pSrc + 1)]) - && 16 != (dec2 = HEX2DEC[*(pSrc + 2)])) + if (16 != (dec1 = HEX2DEC[*(pSrc + 1)]) && + 16 != (dec2 = HEX2DEC[*(pSrc + 2)])) { *pEnd++ = (dec1 << 4) + dec2; pSrc += 3; diff --git a/Source/Core/Common/Timer.cpp b/Source/Core/Common/Timer.cpp index a8143c85f85..0c1ae0826ea 100644 --- a/Source/Core/Common/Timer.cpp +++ b/Source/Core/Common/Timer.cpp @@ -153,7 +153,7 @@ u64 Timer::GetLocalTimeSinceJan1970() // Account for DST where needed gmTime = localtime(&sysTime); - if(gmTime->tm_isdst == 1) + if (gmTime->tm_isdst == 1) tzDST = 3600; else tzDST = 0; diff --git a/Source/Core/Common/x64ABI.cpp b/Source/Core/Common/x64ABI.cpp index 01162124853..525ecb538b0 100644 --- a/Source/Core/Common/x64ABI.cpp +++ b/Source/Core/Common/x64ABI.cpp @@ -287,12 +287,15 @@ void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() { void XEmitter::ABI_CallFunction(void *func) { ABI_AlignStack(0); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && + distance < 0xFFFFFFFF80000000ULL) + { // Far call MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -302,12 +305,15 @@ void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) { ABI_AlignStack(0); 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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -318,12 +324,15 @@ void XEmitter::ABI_CallFunctionCC16(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), Imm64((u64)func)); - CALLptr(R(RAX)); - } else { + if (distance >= 0x0000000080000000ULL && + distance < 0xFFFFFFFF80000000ULL) + { + // Far call + MOV(64, R(RAX), Imm64((u64)func)); + CALLptr(R(RAX)); + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -333,12 +342,15 @@ void XEmitter::ABI_CallFunctionC(void *func, u32 param1) { ABI_AlignStack(0); 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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -349,12 +361,15 @@ void XEmitter::ABI_CallFunctionCC(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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -365,12 +380,15 @@ void XEmitter::ABI_CallFunctionCP(void *func, u32 param1, void *param2) { MOV(32, R(ABI_PARAM1), Imm32(param1)); MOV(64, R(ABI_PARAM2), Imm64((u64)param2)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && + distance < 0xFFFFFFFF80000000ULL) + { // Far call MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -382,12 +400,15 @@ void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param 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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -399,12 +420,15 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par MOV(32, R(ABI_PARAM2), Imm32(param2)); MOV(64, R(ABI_PARAM3), Imm64((u64)param3)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && + distance < 0xFFFFFFFF80000000ULL) + { // Far call MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -417,12 +441,15 @@ void XEmitter::ABI_CallFunctionCCCP(void *func, u32 param1, u32 param2, u32 para MOV(32, R(ABI_PARAM3), Imm32(param3)); MOV(64, R(ABI_PARAM4), Imm64((u64)param4)); u64 distance = u64(func) - (u64(code) + 5); - if (distance >= 0x0000000080000000ULL - && distance < 0xFFFFFFFF80000000ULL) { + if (distance >= 0x0000000080000000ULL && + distance < 0xFFFFFFFF80000000ULL) + { // Far call MOV(64, R(RAX), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -433,12 +460,15 @@ void XEmitter::ABI_CallFunctionPC(void *func, void *param1, u32 param2) { MOV(64, R(ABI_PARAM1), Imm64((u64)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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -450,12 +480,15 @@ void XEmitter::ABI_CallFunctionPPC(void *func, void *param1, void *param2, u32 p MOV(64, R(ABI_PARAM2), Imm64((u64)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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -467,12 +500,15 @@ void XEmitter::ABI_CallFunctionR(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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -481,24 +517,30 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) { // Pass two registers as parameters. void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2, bool noProlog) { ABI_AlignStack(0, noProlog); - if (reg2 != ABI_PARAM1) { + if (reg2 != ABI_PARAM1) + { if (reg1 != ABI_PARAM1) MOV(64, R(ABI_PARAM1), R(reg1)); if (reg2 != ABI_PARAM2) MOV(64, R(ABI_PARAM2), R(reg2)); - } else { + } + else + { if (reg2 != ABI_PARAM2) MOV(64, R(ABI_PARAM2), R(reg2)); if (reg1 != ABI_PARAM1) 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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0, noProlog); @@ -511,12 +553,15 @@ void XEmitter::ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2 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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); @@ -528,12 +573,15 @@ void XEmitter::ABI_CallFunctionA(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), Imm64((u64)func)); CALLptr(R(RAX)); - } else { + } + else + { CALL(func); } ABI_RestoreStack(0); diff --git a/Source/Core/Common/x64Analyzer.cpp b/Source/Core/Common/x64Analyzer.cpp index c8115dca757..72ff1105a50 100644 --- a/Source/Core/Common/x64Analyzer.cpp +++ b/Source/Core/Common/x64Analyzer.cpp @@ -49,7 +49,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info) // Skip two-byte opcode byte bool twoByte = false; - if(codeByte == 0x0F) + if (codeByte == 0x0F) { twoByte = true; codeByte2 = *codePtr++; diff --git a/Source/Core/Common/x64Emitter.cpp b/Source/Core/Common/x64Emitter.cpp index 6ba5e16c0f1..e010802ea43 100644 --- a/Source/Core/Common/x64Emitter.cpp +++ b/Source/Core/Common/x64Emitter.cpp @@ -208,11 +208,12 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, #if _M_X86_64 u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes; s64 distance = (s64)offset - (s64)ripAddr; - _assert_msg_(DYNA_REC, (distance < 0x80000000LL - && distance >= -0x80000000LL) || - !warn_64bit_offset, - "WriteRest: op out of range (0x%" PRIx64 " uses 0x%" PRIx64 ")", - ripAddr, offset); + _assert_msg_(DYNA_REC, + (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 @@ -358,9 +359,9 @@ void XEmitter::JMP(const u8 *addr, bool force5Bytes) { s64 distance = (s64)(fn - ((u64)code + 5)); - _assert_msg_(DYNA_REC, distance >= -0x80000000LL - && distance < 0x80000000LL, - "Jump target too far away, needs indirect register"); + _assert_msg_(DYNA_REC, + distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); Write8(0xE9); Write32((u32)(s32)distance); } @@ -396,9 +397,10 @@ void XEmitter::CALLptr(OpArg arg) void XEmitter::CALL(const void *fnptr) { u64 distance = u64(fnptr) - (u64(code) + 5); - _assert_msg_(DYNA_REC, distance < 0x0000000080000000ULL - || distance >= 0xFFFFFFFF80000000ULL, - "CALL out of range (%p calls %p)", code, fnptr); + _assert_msg_(DYNA_REC, + distance < 0x0000000080000000ULL || + distance >= 0xFFFFFFFF80000000ULL, + "CALL out of range (%p calls %p)", code, fnptr); Write8(0xE8); Write32(u32(distance)); } @@ -456,9 +458,9 @@ void XEmitter::J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes) else { s64 distance = (s64)(fn - ((u64)code + 6)); - _assert_msg_(DYNA_REC, distance >= -0x80000000LL - && distance < 0x80000000LL, - "Jump target too far away, needs indirect register"); + _assert_msg_(DYNA_REC, + distance >= -0x80000000LL && distance < 0x80000000LL, + "Jump target too far away, needs indirect register"); Write8(0x0F); Write8(0x80 + conditionCode); Write32((u32)(s32)distance); diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 8b3b36b13a3..58b74f81c14 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -115,8 +115,8 @@ bool CompareValues(const u32 val1, const u32 val2, const int type); void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad) { // Parses the Action Replay section of a game ini file. - if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats - && !forceLoad) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats && + !forceLoad) return; arCodes.clear(); @@ -895,7 +895,7 @@ bool ConditionalCode(const ARAddr& addr, const u32 data, int* const pSkipCount) bool CompareValues(const u32 val1, const u32 val2, const int type) { - switch(type) + switch (type) { case CONDTIONAL_EQUAL: LogInfo("Type 1: If Equal"); diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 7025a8c0354..fea71547597 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -312,7 +312,7 @@ bool CBoot::BootUp() // ELF case SCoreStartupParameter::BOOT_ELF: { - if(!File::Exists(_StartupPara.m_strFilename)) + if (!File::Exists(_StartupPara.m_strFilename)) { PanicAlertT("The file you specified (%s) does not exist", _StartupPara.m_strFilename.c_str()); diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 117070e55f2..e9e268bf0a8 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -137,7 +137,7 @@ bool CBoot::EmulatedBS2_GC() INFO_LOG(MASTER_LOG, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength); DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength); - } while(PowerPC::ppcState.gpr[3] != 0x00); + } while (PowerPC::ppcState.gpr[3] != 0x00); // iAppLoaderClose DEBUG_LOG(MASTER_LOG, "call iAppLoaderClose"); @@ -377,7 +377,7 @@ bool CBoot::EmulatedBS2_Wii() INFO_LOG(BOOT, "DVDRead: offset: %08x memOffset: %08x length: %i", iDVDOffset, iRamAddress, iLength); DVDInterface::DVDRead(iDVDOffset, iRamAddress, iLength); - } while(PowerPC::ppcState.gpr[3] != 0x00); + } while (PowerPC::ppcState.gpr[3] != 0x00); // iAppLoaderClose DEBUG_LOG(BOOT, "Run iAppLoaderClose"); diff --git a/Source/Core/Core/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Boot/Boot_WiiWAD.cpp index 983084bfb12..1cd25cf3d7e 100644 --- a/Source/Core/Core/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Boot/Boot_WiiWAD.cpp @@ -28,7 +28,7 @@ static u32 state_checksum(u32 *buf, int len) u32 checksum = 0; len = len>>2; - for(int i=0; i 0) + if (_CoreParameter.iGDBPort > 0) { gdb_init(_CoreParameter.iGDBPort); // break at next instruction (the first instruction) @@ -353,7 +353,7 @@ void FifoPlayerThread() g_bStarted = false; - if(!_CoreParameter.bCPUThread) + if (!_CoreParameter.bCPUThread) g_video_backend->Video_Cleanup(); return; @@ -492,7 +492,7 @@ void EmuThread() INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str()); - if(_CoreParameter.bCPUThread) + if (_CoreParameter.bCPUThread) g_video_backend->Video_Cleanup(); VolumeHandler::EjectVolume(); @@ -644,7 +644,7 @@ bool ShouldSkipFrame(int skipped) // Should be called from GPU thread when a frame is drawn void Callback_VideoCopiedToXFB(bool video_update) { - if(video_update) + if (video_update) Common::AtomicIncrement(DrawnFrame); Movie::FrameUpdate(); } diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 0f1d5a514bf..00b1d56ef9b 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -63,7 +63,7 @@ void (*advanceCallback)(int cyclesExecuted) = nullptr; Event* GetNewEvent() { - if(!eventPool) + if (!eventPool) return new Event; Event* ev = eventPool; @@ -127,7 +127,7 @@ void Shutdown() ClearPendingEvents(); UnregisterAllEvents(); - while(eventPool) + while (eventPool) { Event *ev = eventPool; eventPool = ev->next; @@ -214,7 +214,7 @@ void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata // in which case the event will get handled immediately, before returning. void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata) { - if(Core::IsCPUThread()) + if (Core::IsCPUThread()) { event_types[event_type].callback(userdata, 0); } @@ -238,10 +238,10 @@ void AddEventToQueue(Event* ne) { Event* prev = nullptr; Event** pNext = &first; - for(;;) + for (;;) { Event*& next = *pNext; - if(!next || ne->time < next->time) + if (!next || ne->time < next->time) { ne->next = next; next = ne; @@ -287,7 +287,7 @@ void RemoveEvent(int event_type) if (!first) return; - while(first) + while (first) { if (first->type == event_type) { diff --git a/Source/Core/Core/DSP/DSPAssembler.cpp b/Source/Core/Core/DSP/DSPAssembler.cpp index c5afe216744..4c757588860 100644 --- a/Source/Core/Core/DSP/DSPAssembler.cpp +++ b/Source/Core/Core/DSP/DSPAssembler.cpp @@ -90,7 +90,7 @@ DSPAssembler::DSPAssembler(const AssemblerSettings &settings) : DSPAssembler::~DSPAssembler() { - if(gdg_buffer) + if (gdg_buffer) free(gdg_buffer); } @@ -109,7 +109,7 @@ bool DSPAssembler::Assemble(const char *text, std::vector &code, std::vecto if (m_totalSize > 0) { gdg_buffer = (char *)malloc(m_totalSize * sizeof(u16) + 4); - if(!gdg_buffer) + if (!gdg_buffer) return false; memset(gdg_buffer, 0, m_totalSize * sizeof(u16)); @@ -121,11 +121,13 @@ bool DSPAssembler::Assemble(const char *text, std::vector &code, std::vecto return false; code.resize(m_totalSize); - for (int i = 0; i < m_totalSize; i++) { + for (int i = 0; i < m_totalSize; i++) + { code[i] = *(u16 *)(gdg_buffer + i * 2); } - if(gdg_buffer) { + if (gdg_buffer) + { free(gdg_buffer); gdg_buffer = nullptr; } @@ -223,7 +225,7 @@ s32 DSPAssembler::ParseValue(const char *str) for (int i = 2; ptr[i] != 0; i++) { val *=2; - if(ptr[i] >= '0' && ptr[i] <= '1') + if (ptr[i] >= '0' && ptr[i] <= '1') val += ptr[i] - '0'; else ShowError(ERR_INCORRECT_BIN, str); @@ -773,7 +775,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) { int opcode_size = 0; fsrc.getline(line, LINEBUF_SIZE); - if(fsrc.fail()) + if (fsrc.fail()) break; cur_line = line; @@ -836,7 +838,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass) { bool valid = true; - for(int j = 0; j < (int)col_pos; j++) + for (int j = 0; j < (int)col_pos; j++) { if (j == 0) if (!((ptr[j] >= 'A' && ptr[j] <= 'Z') || (ptr[j] == '_'))) diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp index a27980044ce..560fce53dea 100644 --- a/Source/Core/Core/DSP/DSPCodeUtil.cpp +++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp @@ -135,7 +135,7 @@ void CodesToHeader(const std::vector *codes, const std::vector { std::vector > codes_padded; u32 reserveSize = 0; - for(u32 i = 0; i < numCodes; i++) + for (u32 i = 0; i < numCodes; i++) { codes_padded.push_back(codes[i]); // Pad with nops to 32byte boundary @@ -158,9 +158,9 @@ void CodesToHeader(const std::vector *codes, const std::vector header.append("};\n\n"); header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n"); - for(u32 i = 0; i < numCodes; i++) + for (u32 i = 0; i < numCodes; i++) { - if(codes[i].size() == 0) + if (codes[i].size() == 0) continue; header.append("\t{\n\t\t"); diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 72835fb14cc..2be2f8e9076 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -202,7 +202,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename, WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); // Initialize JIT, if necessary - if(bUsingJIT) + if (bUsingJIT) dspjit = new DSPEmitter(); core_state = DSPCORE_RUNNING; @@ -216,7 +216,7 @@ void DSPCore_Shutdown() core_state = DSPCORE_STOP; - if(dspjit) { + if (dspjit) { delete dspjit; dspjit = nullptr; } @@ -377,7 +377,7 @@ void CompileCurrent() while (retry) { retry = false; - for(u16 i = 0x0000; i < 0xffff; ++i) + for (u16 i = 0x0000; i < 0xffff; ++i) { if (!dspjit->unresolvedJumps[i].empty()) { @@ -392,7 +392,7 @@ void CompileCurrent() u16 DSPCore_ReadRegister(int reg) { - switch(reg) + switch (reg) { case DSP_REG_AR0: case DSP_REG_AR1: @@ -443,7 +443,7 @@ u16 DSPCore_ReadRegister(int reg) void DSPCore_WriteRegister(int reg, u16 val) { - switch(reg) + switch (reg) { case DSP_REG_AR0: case DSP_REG_AR1: diff --git a/Source/Core/Core/DSP/DSPEmitter.cpp b/Source/Core/Core/DSP/DSPEmitter.cpp index dc1cbd696a2..bb31eb7e92d 100644 --- a/Source/Core/Core/DSP/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/DSPEmitter.cpp @@ -34,7 +34,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1) stubEntryPoint = CompileStub(); //clear all of the block references - for(int i = 0x0000; i < MAX_BLOCKS; i++) + for (int i = 0x0000; i < MAX_BLOCKS; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; blockLinks[i] = nullptr; @@ -52,7 +52,7 @@ DSPEmitter::~DSPEmitter() void DSPEmitter::ClearIRAM() { - for(int i = 0x0000; i < 0x1000; i++) + for (int i = 0x0000; i < 0x1000; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; blockLinks[i] = nullptr; @@ -68,7 +68,7 @@ void DSPEmitter::ClearIRAMandDSPJITCodespaceReset() CompileDispatcher(); stubEntryPoint = CompileStub(); - for(int i = 0x0000; i < 0x10000; i++) + for (int i = 0x0000; i < 0x10000; i++) { blocks[i] = (DSPCompiledCode)stubEntryPoint; blockLinks[i] = nullptr; @@ -334,7 +334,7 @@ void DSPEmitter::Compile(u16 start_addr) { blockLinks[start_addr] = blockLinkEntry; - for(u16 i = 0x0000; i < 0xffff; ++i) + for (u16 i = 0x0000; i < 0xffff; ++i) { if (!unresolvedJumps[i].empty()) { diff --git a/Source/Core/Core/DSP/DSPIntExtOps.cpp b/Source/Core/Core/DSP/DSPIntExtOps.cpp index fd50e67b8ff..4c19d08a288 100644 --- a/Source/Core/Core/DSP/DSPIntExtOps.cpp +++ b/Source/Core/Core/DSP/DSPIntExtOps.cpp @@ -75,7 +75,7 @@ void mv(const UDSPInstruction opc) u8 sreg = (opc & 0x3) + DSP_REG_ACL0; u8 dreg = ((opc >> 2) & 0x3); - switch(sreg) + switch (sreg) { case DSP_REG_ACL0: case DSP_REG_ACL1: @@ -97,7 +97,7 @@ void s(const UDSPInstruction opc) u8 dreg = opc & 0x3; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; - switch(sreg) + switch (sreg) { case DSP_REG_ACL0: case DSP_REG_ACL1: @@ -120,7 +120,7 @@ void sn(const UDSPInstruction opc) u8 dreg = opc & 0x3; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; - switch(sreg) + switch (sreg) { case DSP_REG_ACL0: case DSP_REG_ACL1: diff --git a/Source/Core/Core/DSP/DspIntArithmetic.cpp b/Source/Core/Core/DSP/DspIntArithmetic.cpp index 597f9665356..0b1209b9af8 100644 --- a/Source/Core/Core/DSP/DspIntArithmetic.cpp +++ b/Source/Core/Core/DSP/DspIntArithmetic.cpp @@ -370,7 +370,7 @@ void addr(const UDSPInstruction opc) s64 acc = dsp_get_long_acc(dreg); s64 ax = 0; - switch(sreg) { + switch (sreg) { case DSP_REG_AXL0: case DSP_REG_AXL1: ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l; @@ -569,7 +569,7 @@ void subr(const UDSPInstruction opc) s64 acc = dsp_get_long_acc(dreg); s64 ax = 0; - switch(sreg) { + switch (sreg) { case DSP_REG_AXL0: case DSP_REG_AXL1: ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l; @@ -745,7 +745,7 @@ void movr(const UDSPInstruction opc) u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0; s64 ax = 0; - switch(sreg) + switch (sreg) { case DSP_REG_AXL0: case DSP_REG_AXL1: diff --git a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp index d7b67ced904..2086183a5ae 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp @@ -21,7 +21,7 @@ static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter) emitter.dsp_op_read_reg(DSP_REG_SR, EAX); - switch(cond) + switch (cond) { case 0x0: // GE - Greater Equal case 0x1: // L - Less diff --git a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp index f09672ef344..f0e34d507a4 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitRegCache.cpp @@ -10,7 +10,7 @@ using namespace Gen; static void *reg_ptr(int reg) { - switch(reg) + switch (reg) { case DSP_REG_AR0: case DSP_REG_AR1: @@ -117,7 +117,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) xregs[R15].guest_reg = DSP_REG_NONE; #endif - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { regs[i].mem = reg_ptr(i); regs[i].size = 0; @@ -130,7 +130,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[i].loc = M(regs[i].mem); } - for(unsigned int i = 0; i < 32; i++) + for (unsigned int i = 0; i < 32; i++) { regs[i].size = 2; } @@ -140,7 +140,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[DSP_REG_ACC0_64].host_reg = R8; regs[DSP_REG_ACC1_64].host_reg = R9; #endif - for(unsigned int i = 0; i < 2; i++) + for (unsigned int i = 0; i < 2; i++) { regs[i+DSP_REG_ACC0_64].size = 8; regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64; @@ -162,7 +162,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[DSP_REG_PRODM2].shift = 48; #endif - for(unsigned int i = 0; i < 2; i++) + for (unsigned int i = 0; i < 2; i++) { regs[i+DSP_REG_AX0_32].size = 4; regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32; @@ -209,7 +209,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) size_t i; // drop all guest register not used by cache - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { regs[i].used = false; //used is restored later if (regs[i].loc.IsSimpleReg() && @@ -224,7 +224,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) do { movcnt = 0; - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { X64Reg simple = regs[i].loc.GetSimpleReg(); X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg(); @@ -238,7 +238,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) } while (movcnt != 0); // free all host regs that are not used for the same guest reg - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (cache.regs[i].loc.GetSimpleReg() != regs[i].loc.GetSimpleReg() && @@ -249,14 +249,14 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) } // load all guest regs that are in memory and should be in host reg - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (cache.regs[i].loc.IsSimpleReg()) { movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), true); rotateHostReg(i, cache.regs[i].shift, true); } - else if(cache.regs[i].loc.IsImm()) + else if (cache.regs[i].loc.IsImm()) { // TODO: Immediates? } @@ -268,7 +268,7 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) // sync the freely used xregs if (!emit) { - for(i = 0; i < NUMXREGS; i++) + for (i = 0; i < NUMXREGS; i++) { if (cache.xregs[i].guest_reg == DSP_REG_USED && xregs[i].guest_reg == DSP_REG_NONE) @@ -284,14 +284,14 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) } // consistency checks - for(i = 0; i < NUMXREGS; i++) + for (i = 0; i < NUMXREGS; i++) { _assert_msg_(DSPLLE, xregs[i].guest_reg == cache.xregs[i].guest_reg, "cache and current xreg guest_reg mismatch for %zi", i); } - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { _assert_msg_(DSPLLE, regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(), @@ -319,7 +319,7 @@ void DSPJitRegCache::flushMemBackedRegs() // this should have the same effect as // merge(DSPJitRegCache(emitter)); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { _assert_msg_(DSPLLE, !regs[i].used, "register %x still in use", i); @@ -345,7 +345,7 @@ void DSPJitRegCache::flushRegs() { flushMemBackedRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (regs[i].host_reg != INVALID_REG) { @@ -353,7 +353,7 @@ void DSPJitRegCache::flushRegs() } } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), @@ -418,7 +418,7 @@ static u64 ebp_store; void DSPJitRegCache::loadRegs(bool emit) { - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (regs[i].host_reg != INVALID_REG) { @@ -440,7 +440,7 @@ void DSPJitRegCache::saveRegs() { flushRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (regs[i].host_reg != INVALID_REG) { @@ -448,7 +448,7 @@ void DSPJitRegCache::saveRegs() } } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), @@ -466,7 +466,7 @@ void DSPJitRegCache::pushRegs() { flushMemBackedRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (regs[i].host_reg != INVALID_REG) { @@ -494,7 +494,7 @@ void DSPJitRegCache::pushRegs() } #endif - for(unsigned int i = 0; i < NUMXREGS; i++) + for (unsigned int i = 0; i < NUMXREGS; i++) { if (xregs[i].guest_reg == DSP_REG_USED) { @@ -504,14 +504,14 @@ void DSPJitRegCache::pushRegs() } } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), "register %x is still a simple reg", i); } - for(unsigned int i = 0; i < NUMXREGS; i++) + for (unsigned int i = 0; i < NUMXREGS; i++) { _assert_msg_(DSPLLE, xregs[i].guest_reg == DSP_REG_NONE || @@ -541,7 +541,7 @@ void DSPJitRegCache::popRegs() { } } - for(int i = NUMXREGS-1; i >= 0; i--) + for (int i = NUMXREGS-1; i >= 0; i--) { if (xregs[i].pushed) { @@ -564,7 +564,7 @@ void DSPJitRegCache::popRegs() { } #endif - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + for (unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { if (regs[i].host_reg != INVALID_REG) { @@ -618,7 +618,7 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load) if (load) { - switch(regs[reg].size) + switch (regs[reg].size) { case 2: emitter.MOV(16, R(host_reg), regs[reg].loc); @@ -690,7 +690,7 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit) if (shift > regs[reg].shift && emit) { - switch(regs[reg].size) + switch (regs[reg].size) { case 2: emitter.ROR(16, regs[reg].loc, Imm8(shift - regs[reg].shift)); @@ -707,7 +707,7 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit) } else if (shift < regs[reg].shift && emit) { - switch(regs[reg].size) + switch (regs[reg].size) { case 2: emitter.ROL(16, regs[reg].loc, Imm8(regs[reg].shift - shift)); @@ -762,7 +762,7 @@ void DSPJitRegCache::movToMemory(int reg) if (regs[reg].dirty) { - switch(regs[reg].size) + switch (regs[reg].size) { case 2: emitter.MOV(16, tmp, regs[reg].loc); @@ -835,7 +835,7 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load) regs[real_reg].used = true; //do some register specific fixup - switch(reg) + switch (reg) { #if _M_X86_64 case DSP_REG_ACC0_64: @@ -862,7 +862,7 @@ void DSPJitRegCache::putReg(int reg, bool dirty) OpArg oparg = regs[real_reg].loc; - switch(reg) + switch (reg) { case DSP_REG_ACH0: case DSP_REG_ACH1: @@ -939,10 +939,10 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend OpArg reg; getReg(sreg, reg); - switch(regs[sreg].size) + switch (regs[sreg].size) { case 2: - switch(extend) + switch (extend) { #if _M_X86_64 case SIGN: @@ -966,7 +966,7 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend break; case 4: #if _M_X86_64 - switch(extend) + switch (extend) { case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); @@ -1000,7 +1000,7 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg) getReg(dreg, reg, false); if (arg.IsImm()) { - switch(regs[dreg].size) + switch (regs[dreg].size) { case 2: emitter.MOV(16, reg, Imm16((u16) arg.offset)); @@ -1027,7 +1027,7 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg) } else { - switch(regs[dreg].size) + switch (regs[dreg].size) { case 2: emitter.MOV(16, reg, arg); diff --git a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp index 79b380847ec..c9f5dcf0a6d 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitUtil.cpp @@ -204,7 +204,7 @@ void DSPEmitter::dsp_op_read_reg_dont_saturate(int reg, Gen::X64Reg host_dreg, D case DSP_REG_ST2: case DSP_REG_ST3: dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg); - switch(extend) + switch (extend) { case SIGN: #if _M_X86_64 @@ -240,7 +240,7 @@ void DSPEmitter::dsp_op_read_reg(int reg, Gen::X64Reg host_dreg, DSPJitSignExten case DSP_REG_ST2: case DSP_REG_ST3: dsp_reg_load_stack(reg - DSP_REG_ST0, host_dreg); - switch(extend) + switch (extend) { case SIGN: #if _M_X86_64 diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp index 0d34a56f0ae..d07d49c0978 100644 --- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp @@ -128,14 +128,14 @@ void PPCDebugInterface::ClearAllMemChecks() bool PPCDebugInterface::IsMemCheck(unsigned int address) { - return (Memory::AreMemoryBreakpointsActivated() - && PowerPC::memchecks.GetMemCheck(address)); + return (Memory::AreMemoryBreakpointsActivated() && + PowerPC::memchecks.GetMemCheck(address)); } void PPCDebugInterface::ToggleMemCheck(unsigned int address) { - if (Memory::AreMemoryBreakpointsActivated() - && !PowerPC::memchecks.GetMemCheck(address)) + if (Memory::AreMemoryBreakpointsActivated() && + !PowerPC::memchecks.GetMemCheck(address)) { // Add Memory Check TMemCheck MemCheck; diff --git a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp index 765ad6338c9..95175b6d946 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlaybackAnalyzer.cpp @@ -159,7 +159,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data) int cmd = ReadFifo8(data); - switch(cmd) + switch (cmd) { case GX_NOP: case 0x44: diff --git a/Source/Core/Core/HLE/HLE_Misc.cpp b/Source/Core/Core/HLE/HLE_Misc.cpp index cb5070260ed..aeb7b480eae 100644 --- a/Source/Core/Core/HLE/HLE_Misc.cpp +++ b/Source/Core/Core/HLE/HLE_Misc.cpp @@ -268,7 +268,7 @@ void HLEGeckoCodehandler() { return; } - else if(existing - magic > 5) + else if (existing - magic > 5) { existing = magic; } diff --git a/Source/Core/Core/HLE/HLE_OS.cpp b/Source/Core/Core/HLE/HLE_OS.cpp index d4bf99820cb..9aef24d1f0c 100644 --- a/Source/Core/Core/HLE/HLE_OS.cpp +++ b/Source/Core/Core/HLE/HLE_OS.cpp @@ -32,9 +32,12 @@ void HLE_OSPanic() void HLE_GeneralDebugPrint() { std::string ReportMessage; - if(*(u32*)Memory::GetPointer(GPR(3)) > 0x80000000){ + if (*(u32*)Memory::GetPointer(GPR(3)) > 0x80000000) + { GetStringVA(ReportMessage, 4); - }else{ + } + else + { GetStringVA(ReportMessage); } NPC = LR; @@ -50,7 +53,8 @@ void HLE_VPrintf() u32 offset = Memory::Read_U32(r4+8); u32 check = Memory::Read_U32(r4); //NOTICE_LOG(OSREPORT, "Offset: %08X, Check %08X", offset, check); - for(int i = 4; i<= 10; i++){ + for (int i = 4; i<= 10; i++) + { GPR(i) = Memory::Read_U32(offset+(i-(check == 0x01000000? 3 : 2))*4); //NOTICE_LOG(OSREPORT, "r%d: %08X",i, GPR(i)); } @@ -96,18 +100,18 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg) return; } - while(*pString) + while (*pString) { if (*pString == '%') { char* pArgument = ArgumentBuffer; *pArgument++ = *pString++; - if(*pString == '%') { + if (*pString == '%') { _rOutBuffer += "%"; pString++; continue; } - while(*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-') + while (*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-') *pArgument++ = *pString++; *pArgument++ = *pString; @@ -130,7 +134,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg) } ParameterCounter++; - switch(*pString) + switch (*pString) { case 's': _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer((u32)Parameter)); @@ -170,7 +174,7 @@ void GetStringVA(std::string& _rOutBuffer, u32 strReg) pString++; } } - if(_rOutBuffer[_rOutBuffer.length() - 1] == '\n') + if (_rOutBuffer[_rOutBuffer.length() - 1] == '\n') _rOutBuffer.resize(_rOutBuffer.length() - 1); } diff --git a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp index cdbff7fa8c8..0bdffb70a21 100644 --- a/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/HW/DSPHLE/DSPHLE.cpp @@ -267,7 +267,7 @@ void DSPHLE::InitMixer() AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate); delete soundStream; soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000), m_hWnd); - if(!soundStream) PanicAlert("Error starting up sound stream"); + if (!soundStream) PanicAlert("Error starting up sound stream"); // Mixer is initialized m_InitMixer = true; } diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp index 1ae76d2af89..69c44c06ed4 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp @@ -55,7 +55,7 @@ _lRestart: } } - while(i < _Size) + while (i < _Size) { s16 sample = ((pos[1] & mask) == mask) ? 0xc000 : 0x4000; @@ -131,7 +131,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si { u16 address; - switch(PB.Format) + switch (PB.Format) { default: case 0x0004: @@ -161,7 +161,7 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff)); ACC0 &= 0xffff0000ffffULL; - for(int i = 0; i < 0x50; i++) + for (int i = 0; i < 0x50; i++) { _Buffer[i] = m_MiscTable[address]; diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp index 4ff57432a83..4393a48f0c1 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp @@ -225,7 +225,7 @@ void PrintObject(const T &Obj) ss << std::hex; for (size_t i = 0; i < sizeof(T); i++) { - if((i & 1) == 0) + if ((i & 1) == 0) ss << ' '; ss.width(2); ss.fill('0'); diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index df5795f83b6..5209f32616e 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -185,7 +185,7 @@ void DSPLLE::InitMixer() AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate); delete soundStream; soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd); - if(!soundStream) PanicAlert("Error starting up sound stream"); + if (!soundStream) PanicAlert("Error starting up sound stream"); // Mixer is initialized m_InitMixer = true; } diff --git a/Source/Core/Core/HW/DVDInterface.cpp b/Source/Core/Core/HW/DVDInterface.cpp index b69efec1453..e4c9c3a0192 100644 --- a/Source/Core/Core/HW/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVDInterface.cpp @@ -521,7 +521,7 @@ void UpdateInterrupts() void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt) { - switch(_DVDInterrupt) + switch (_DVDInterrupt) { case INT_DEINT: m_DISR.DEINT = 1; break; case INT_TCINT: m_DISR.TCINT = 1; break; @@ -535,9 +535,9 @@ void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt) void ExecuteCommand(UDICR& _DICR) { // _dbg_assert_(DVDINTERFACE, _DICR.RW == 0); // only DVD to Memory - int GCAM = ((SConfig::GetInstance().m_SIDevice[0] == SIDEVICE_AM_BASEBOARD) - && (SConfig::GetInstance().m_EXIDevice[2] == EXIDEVICE_AM_BASEBOARD)) - ? 1 : 0; + int GCAM = ((SConfig::GetInstance().m_SIDevice[0] == SIDEVICE_AM_BASEBOARD) && + (SConfig::GetInstance().m_EXIDevice[2] == EXIDEVICE_AM_BASEBOARD)) + ? 1 : 0; if (GCAM) { @@ -929,15 +929,15 @@ void ExecuteCommand(UDICR& _DICR) // Just for fun case 0xFF: { - if (m_DICMDBUF[0].Hex == 0xFF014D41 - && m_DICMDBUF[1].Hex == 0x54534849 - && m_DICMDBUF[2].Hex == 0x54410200) + if (m_DICMDBUF[0].Hex == 0xFF014D41 && + m_DICMDBUF[1].Hex == 0x54534849 && + m_DICMDBUF[2].Hex == 0x54410200) { INFO_LOG(DVDINTERFACE, "Unlock test 1 passed"); } - else if (m_DICMDBUF[0].Hex == 0xFF004456 - && m_DICMDBUF[1].Hex == 0x442D4741 - && m_DICMDBUF[2].Hex == 0x4D450300) + else if (m_DICMDBUF[0].Hex == 0xFF004456 && + m_DICMDBUF[1].Hex == 0x442D4741 && + m_DICMDBUF[2].Hex == 0x4D450300) { INFO_LOG(DVDINTERFACE, "Unlock test 2 passed"); } diff --git a/Source/Core/Core/HW/EXI.cpp b/Source/Core/Core/HW/EXI.cpp index f722c5a9ce4..b2c9fa1b3e9 100644 --- a/Source/Core/Core/HW/EXI.cpp +++ b/Source/Core/Core/HW/EXI.cpp @@ -30,7 +30,7 @@ void Init() if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved()) g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA - else if(Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved()) + else if (Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved()) g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA else g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA diff --git a/Source/Core/Core/HW/EXI_Channel.cpp b/Source/Core/Core/HW/EXI_Channel.cpp index 817579fef07..cff2b4f066c 100644 --- a/Source/Core/Core/HW/EXI_Channel.cpp +++ b/Source/Core/Core/HW/EXI_Channel.cpp @@ -137,7 +137,7 @@ void CEXIChannel::RegisterMMIO(MMIO::Mapping* mmio, u32 base) m_Control.TSTART = 0; } - if(!m_Control.TSTART) // completed ! + if (!m_Control.TSTART) // completed ! { m_Status.TCINT = 1; CoreTiming::ScheduleEvent_Threadsafe_Immediate(updateInterrupts, 0); @@ -171,7 +171,7 @@ void CEXIChannel::AddDevice(IEXIDevice* pDevice, const int device_num, bool noti // replace it with the new one m_pDevices[device_num].reset(pDevice); - if(notifyPresenceChanged) + if (notifyPresenceChanged) { // This means "device presence changed", software has to check // m_Status.EXT to see if it is now present or not @@ -241,13 +241,13 @@ void CEXIChannel::DoState(PointerWrap &p) p.Do(type); IEXIDevice* pSaveDevice = (type == pDevice->m_deviceType) ? pDevice : EXIDevice_Create(type, m_ChannelId); pSaveDevice->DoState(p); - if(pSaveDevice != pDevice) + if (pSaveDevice != pDevice) { // if we had to create a temporary device, discard it if we're not loading. // also, if no movie is active, we'll assume the user wants to keep their current devices // instead of the ones they had when the savestate was created, // unless the device is NONE (since ChangeDevice sets that temporarily). - if(p.GetMode() != PointerWrap::MODE_READ) + if (p.GetMode() != PointerWrap::MODE_READ) { delete pSaveDevice; } diff --git a/Source/Core/Core/HW/EXI_DeviceAD16.cpp b/Source/Core/Core/HW/EXI_DeviceAD16.cpp index 6726c31c885..1f4e33eeab9 100644 --- a/Source/Core/Core/HW/EXI_DeviceAD16.cpp +++ b/Source/Core/Core/HW/EXI_DeviceAD16.cpp @@ -33,12 +33,12 @@ void CEXIAD16::TransferByte(u8& _byte) } else { - switch(m_uCommand) + switch (m_uCommand) { case init: { m_uAD16Register.U32 = 0x04120000; - switch(m_uPosition) + switch (m_uPosition) { case 1: _dbg_assert_(EXPANSIONINTERFACE, (_byte == 0x00)); break; // just skip case 2: _byte = m_uAD16Register.U8[0]; break; @@ -51,7 +51,7 @@ void CEXIAD16::TransferByte(u8& _byte) case write: { - switch(m_uPosition) + switch (m_uPosition) { case 1: m_uAD16Register.U8[0] = _byte; break; case 2: m_uAD16Register.U8[1] = _byte; break; @@ -63,7 +63,7 @@ void CEXIAD16::TransferByte(u8& _byte) case read: { - switch(m_uPosition) + switch (m_uPosition) { case 1: _byte = m_uAD16Register.U8[0]; break; case 2: _byte = m_uAD16Register.U8[1]; break; diff --git a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp index b933664f802..9a4d0fe54e2 100644 --- a/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI_DeviceMemoryCard.cpp @@ -134,7 +134,7 @@ void innerFlush(FlushData* data) // Flush memory card contents to disc void CEXIMemoryCard::Flush(bool exiting) { - if(!m_bDirty) + if (!m_bDirty) return; if (!Core::g_CoreStartupParameter.bEnableMemcardSaving) @@ -145,7 +145,7 @@ void CEXIMemoryCard::Flush(bool exiting) flushThread.join(); } - if(!exiting) + if (!exiting) Core::DisplayMessage(StringFromFormat("Writing to memory card %c", card_index ? 'B' : 'A'), 1000); flushData.filename = m_strFilename; @@ -423,7 +423,7 @@ void CEXIMemoryCard::TransferByte(u8 &byte) break; } - if(m_uPosition >= 5) + if (m_uPosition >= 5) programming_buffer[((m_uPosition - 5) & 0x7F)] = byte; // wrap around after 128 bytes byte = 0xFF; diff --git a/Source/Core/Core/HW/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard.cpp index e5a4a2063da..07a66288c1d 100644 --- a/Source/Core/Core/HW/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard.cpp @@ -155,7 +155,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis) // the backup should be copied? // } // -// if(BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer +// if (BE16(dir_backup.UpdateCounter) > BE16(dir.UpdateCounter)) //check if the backup is newer // { // dir = dir_backup; // bat = bat_backup; // needed? @@ -348,7 +348,7 @@ u8 GCMemcard::TitlePresent(DEntry d) const return DIRLEN; u8 i = 0; - while(i < DIRLEN) + while (i < DIRLEN) { if ((BE32(CurrentDir->Dir[i].Gamecode) == BE32(d.Gamecode)) && (!memcmp(CurrentDir->Dir[i].Filename, d.Filename, 32))) @@ -433,7 +433,7 @@ std::string GCMemcard::DEntry_IconFmt(u8 index) const int x = CurrentDir->Dir[index].IconFmt[0]; std::string format; - for(int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { if (i == 8) x = CurrentDir->Dir[index].IconFmt[1]; format.push_back((x & 0x80) ? '1' : '0'); @@ -449,7 +449,7 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const int x = CurrentDir->Dir[index].AnimSpeed[0]; std::string speed; - for(int i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { if (i == 8) x = CurrentDir->Dir[index].AnimSpeed[1]; speed.push_back((x & 0x80) ? '1' : '0'); @@ -929,7 +929,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire gci.Seek(0, SEEK_SET); - switch(offset) + switch (offset) { case GCS: u8 gcsHDR[GCS]; @@ -964,7 +964,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire std::vector saveData; saveData.reserve(size); - switch(GetSaveData(index, saveData)) + switch (GetSaveData(index, saveData)) { case FAIL: return FAIL; @@ -985,7 +985,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire void GCMemcard::Gcs_SavConvert(DEntry &tempDEntry, int saveType, int length) { - switch(saveType) + switch (saveType) { case GCS: { @@ -1171,7 +1171,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8 *delays) const //Speed is set but there's no actual icon //This is used to reduce animation speed in Pikmin and Luigi's Mansion for example //These "blank frames" show the next icon - for(j=i; j<8;++j) + for (j=i; j<8;++j) { if (fmts[j] != 0) { @@ -1260,7 +1260,7 @@ void GCMemcard::FormatInternal(GCMC_Header &GCP) u64 rand = CEXIIPL::GetGCTime(); p_hdr->formatTime = Common::swap64(rand); - for(int i = 0; i < 12; i++) + for (int i = 0; i < 12; i++) { rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16); p_hdr->serial[i] = (u8)(g_SRAM.flash_id[0][i] + (u32)rand); diff --git a/Source/Core/Core/HW/MemmapFunctions.cpp b/Source/Core/Core/HW/MemmapFunctions.cpp index 39f73793de6..ddbc947d2c3 100644 --- a/Source/Core/Core/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/HW/MemmapFunctions.cpp @@ -629,14 +629,14 @@ u32 LookupTLBPageAddress(const XCheckTLBFlag _Flag, const u32 vpa, u32 *paddr) { #ifdef FAST_TLB_CACHE tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK]; - if(tlbe[0].tag == (vpa & ~0xfff) && !(tlbe[0].flags & TLB_FLAG_INVALID)) + if (tlbe[0].tag == (vpa & ~0xfff) && !(tlbe[0].flags & TLB_FLAG_INVALID)) { tlbe[0].flags |= TLB_FLAG_MOST_RECENT; tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT; *paddr = tlbe[0].paddr | (vpa & 0xfff); return 1; } - if(tlbe[1].tag == (vpa & ~0xfff) && !(tlbe[1].flags & TLB_FLAG_INVALID)) + if (tlbe[1].tag == (vpa & ~0xfff) && !(tlbe[1].flags & TLB_FLAG_INVALID)) { tlbe[1].flags |= TLB_FLAG_MOST_RECENT; tlbe[0].flags &= ~TLB_FLAG_MOST_RECENT; @@ -678,7 +678,7 @@ void UpdateTLBEntry(const XCheckTLBFlag _Flag, UPTE2 PTE2, const u32 vpa) { #ifdef FAST_TLB_CACHE tlb_entry *tlbe = tlb[_Flag == FLAG_OPCODE][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK]; - if((tlbe[0].flags & TLB_FLAG_MOST_RECENT) == 0) + if ((tlbe[0].flags & TLB_FLAG_MOST_RECENT) == 0) { tlbe[0].flags = TLB_FLAG_MOST_RECENT; tlbe[1].flags &= ~TLB_FLAG_MOST_RECENT; @@ -716,20 +716,20 @@ void InvalidateTLBEntry(u32 vpa) { #ifdef FAST_TLB_CACHE tlb_entry *tlbe = tlb[0][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK]; - if(tlbe[0].tag == (vpa & ~0xfff)) + if (tlbe[0].tag == (vpa & ~0xfff)) { tlbe[0].flags |= TLB_FLAG_INVALID; } - if(tlbe[1].tag == (vpa & ~0xfff)) + if (tlbe[1].tag == (vpa & ~0xfff)) { tlbe[1].flags |= TLB_FLAG_INVALID; } tlb_entry *tlbe_i = tlb[1][(vpa>>HW_PAGE_INDEX_SHIFT)&HW_PAGE_INDEX_MASK]; - if(tlbe_i[0].tag == (vpa & ~0xfff)) + if (tlbe_i[0].tag == (vpa & ~0xfff)) { tlbe_i[0].flags |= TLB_FLAG_INVALID; } - if(tlbe_i[1].tag == (vpa & ~0xfff)) + if (tlbe_i[1].tag == (vpa & ~0xfff)) { tlbe_i[1].flags |= TLB_FLAG_INVALID; } diff --git a/Source/Core/Core/HW/SI.cpp b/Source/Core/Core/HW/SI.cpp index 425cefdd0a2..4005440a71f 100644 --- a/Source/Core/Core/HW/SI.cpp +++ b/Source/Core/Core/HW/SI.cpp @@ -212,7 +212,7 @@ static u8 g_SIBuffer[128]; void DoState(PointerWrap &p) { - for(int i = 0; i < MAX_SI_CHANNELS; i++) + for (int i = 0; i < MAX_SI_CHANNELS; i++) { p.Do(g_Channel[i].m_InHi.Hex); p.Do(g_Channel[i].m_InLo.Hex); @@ -223,12 +223,12 @@ void DoState(PointerWrap &p) p.Do(type); ISIDevice* pSaveDevice = (type == pDevice->GetDeviceType()) ? pDevice : SIDevice_Create(type, i); pSaveDevice->DoState(p); - if(pSaveDevice != pDevice) + if (pSaveDevice != pDevice) { // if we had to create a temporary device, discard it if we're not loading. // also, if no movie is active, we'll assume the user wants to keep their current devices // instead of the ones they had when the savestate was created. - if(p.GetMode() != PointerWrap::MODE_READ || + if (p.GetMode() != PointerWrap::MODE_READ || (!Movie::IsRecordingInput() && !Movie::IsPlayingInput())) { delete pSaveDevice; @@ -355,7 +355,7 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) MMIO::ComplexWrite([](u32, u32 val) { USIStatusReg tmpStatus(val); - // clear bits ( if(tmp.bit) SISR.bit=0 ) + // clear bits ( if (tmp.bit) SISR.bit=0 ) if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0; if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0; if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0; @@ -422,7 +422,7 @@ void UpdateInterrupts() void GenerateSIInterrupt(SIInterruptType _SIInterrupt) { - switch(_SIInterrupt) + switch (_SIInterrupt) { case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break; case INT_TCINT: g_ComCSR.TCINT = 1; break; diff --git a/Source/Core/Core/HW/SI_Device.cpp b/Source/Core/Core/HW/SI_Device.cpp index 01a173b658d..8376ea8c712 100644 --- a/Source/Core/Core/HW/SI_Device.cpp +++ b/Source/Core/Core/HW/SI_Device.cpp @@ -18,7 +18,7 @@ int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength) char szTemp[256] = ""; int num = 0; - while(num < _iLength) + while (num < _iLength) { char szTemp2[128] = ""; sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]); diff --git a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp index 4729d3a678e..456c7653d1c 100644 --- a/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/HW/SI_DeviceAMBaseboard.cpp @@ -90,14 +90,14 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) ISIDevice::RunBuffer(_pBuffer, _iLength); int iPosition = 0; - while(iPosition < _iLength) + while (iPosition < _iLength) { // read the command EBufferCommands command = static_cast(_pBuffer[iPosition ^ 3]); iPosition++; // handle it - switch(command) + switch (command) { case CMD_RESET: // returns ID and dip switches { diff --git a/Source/Core/Core/HW/SI_DeviceDanceMat.cpp b/Source/Core/Core/HW/SI_DeviceDanceMat.cpp index 40405b60e34..8cf308334cb 100644 --- a/Source/Core/Core/HW/SI_DeviceDanceMat.cpp +++ b/Source/Core/Core/HW/SI_DeviceDanceMat.cpp @@ -122,12 +122,12 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low) Movie::SetPolledDevice(); - if(Movie::IsPlayingInput()) + if (Movie::IsPlayingInput()) { Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); } - else if(Movie::IsRecordingInput()) + else if (Movie::IsRecordingInput()) { Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); diff --git a/Source/Core/Core/HW/SI_DeviceGCController.cpp b/Source/Core/Core/HW/SI_DeviceGCController.cpp index 09129f9fe6d..6c3997a2002 100644 --- a/Source/Core/Core/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/HW/SI_DeviceGCController.cpp @@ -122,12 +122,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) Movie::SetPolledDevice(); - if(Movie::IsPlayingInput()) + if (Movie::IsPlayingInput()) { Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); } - else if(Movie::IsRecordingInput()) + else if (Movie::IsRecordingInput()) { Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); diff --git a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp index 3eb43083dce..3801d12027f 100644 --- a/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp +++ b/Source/Core/Core/HW/SI_DeviceGCSteeringWheel.cpp @@ -113,12 +113,12 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low) Movie::SetPolledDevice(); - if(Movie::IsPlayingInput()) + if (Movie::IsPlayingInput()) { Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); } - else if(Movie::IsRecordingInput()) + else if (Movie::IsRecordingInput()) { Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); Movie::InputUpdate(); diff --git a/Source/Core/Core/HW/Sram.cpp b/Source/Core/Core/HW/Sram.cpp index e1368be08da..d40059032e1 100644 --- a/Source/Core/Core/HW/Sram.cpp +++ b/Source/Core/Core/HW/Sram.cpp @@ -78,7 +78,7 @@ void SetCardFlashID(u8* buffer, u8 card_index) { u64 rand = Common::swap64( *(u64*)&(buffer[12])); u8 csum=0; - for(int i = 0; i < 12; i++) + for (int i = 0; i < 12; i++) { rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16); csum += g_SRAM.flash_id[card_index][i] = buffer[i] - ((u8)rand&0xff); diff --git a/Source/Core/Core/HW/VideoInterface.cpp b/Source/Core/Core/HW/VideoInterface.cpp index 7140ef99fdb..2cff0a4373d 100644 --- a/Source/Core/Core/HW/VideoInterface.cpp +++ b/Source/Core/Core/HW/VideoInterface.cpp @@ -515,7 +515,7 @@ static void BeginField(FieldType field) // But the PAL ports of some games are poorly programmed and don't use correct ordering. // Zelda: Wind Waker and Simpsons Hit & Run are exampes of this, there are probally more. // PAL Wind Waker also runs at 30fps instead of 25. - if(field == FieldType::FIELD_PROGRESSIVE || GetXFBAddressBottom() != (GetXFBAddressTop() - 1280)) + if (field == FieldType::FIELD_PROGRESSIVE || GetXFBAddressBottom() != (GetXFBAddressTop() - 1280)) { WARN_LOG(VIDEOINTERFACE, "PAL game is trying to use incorrect (NTSC) field ordering"); // Lets kindly fix this for them. @@ -523,7 +523,9 @@ static void BeginField(FieldType field) // TODO: PAL Simpsons Hit & Run now has a green line at the bottom when Real XFB is used. // Might be a bug later on in our code, or a bug in the actual game. - } else { + } + else + { xfbAddr = GetXFBAddressBottom(); } } else { diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp index 17459b7ab36..2db6780f905 100644 --- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp @@ -67,7 +67,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) u8 data[32] = {}; memcpy(data, data_, size_); - switch(data[1]) + switch (data[1]) { case WM_RUMBLE: size = 1; @@ -109,7 +109,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) u32 address = Common::swap24(wd->address); address &= ~0x010000; - switch(data[2] >> 0x01) + switch (data[2] >> 0x01) { case WM_SPACE_EEPROM: if (logCom) Name.append(" REG_EEPROM"); break; @@ -120,16 +120,16 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) void *region_ptr = nullptr; int region_size = 0; - switch(data[3]) + switch (data[3]) { case 0xa2: if (logCom) { Name.append(" REG_SPEAKER"); - if(data[6] == 7) + if (data[6] == 7) { //INFO_LOG(CONSOLE, "Sound configuration:"); - if(data[8] == 0x00) + if (data[8] == 0x00) { //memcpy(&SampleValue, &data[9], 2); //NOTICE_LOG(CONSOLE, " Data format: 4-bit ADPCM (%i Hz)", 6000000 / SampleValue); @@ -173,7 +173,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) memcpy((u8*)region_ptr + region_offset, wd->data, wd->size); // save key if (region_offset >= 0x40 && region_offset <= 0x4c) { - if(!emu) + if (!emu) wiimote_gen_key(&wm->m_ext_key, wm->m_reg_ext.encryption_key); INFO_LOG(CONSOLE, "Writing key: %s", ArrayToString((u8*)&wm->m_ext_key, sizeof(wm->m_ext_key), 0, 30).c_str()); } @@ -204,7 +204,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) dataRep.push(((data[2]>>1)<<16) + ((data[3])<<8) + addressLO); - switch(data[2]>>1) + switch (data[2]>>1) { case WM_SPACE_EEPROM: if (logCom) Name.append(" REG_EEPROM"); @@ -216,7 +216,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) // ignore second byte for extension area if (address>>16 == 0xA4) address &= 0xFF00FF; const u8 region_offset = (u8)address; - switch(data[3]) + switch (data[3]) { case 0xa2: if (logCom) Name.append(" REG_SPEAKER"); @@ -300,7 +300,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) wm_read_data_reply* const rdr = (wm_read_data_reply*)(data2 + 2); bool decrypted = false; - if(!dataRep.empty()) + if (!dataRep.empty()) { dataReply[0] = (dataRep.front()>>16)&0x00FF; dataReply[1] = (dataRep.front()>>8)&0x00FF; @@ -308,14 +308,14 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) dataRep.pop(); } - switch(dataReply[0]) + switch (dataReply[0]) { case WM_SPACE_EEPROM: if (logCom) Name.append(" REG_EEPROM"); // Wiimote calibration - if(data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10) { - if(data[6] == 0x10) { + if (data[4] == 0xf0 && data[5] == 0x00 && data[6] == 0x10) { + if (data[6] == 0x10) { accel_cal* calib = (accel_cal*)&rdr->data[6]; ERROR_LOG(CONSOLE, "Wiimote calibration:"); //SERROR_LOG(CONSOLE, "%s", ArrayToString(rdr->data, rdr->size).c_str()); @@ -334,7 +334,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) case WM_SPACE_REGS1: case WM_SPACE_REGS2: - switch(dataReply[1]) + switch (dataReply[1]) { case 0xa2: if (logCom) Name.append(" REG_SPEAKER"); break; case 0xa4: if (logCom) Name.append(" REG_EXT"); break; @@ -387,7 +387,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) } // Nunchuck calibration - if(data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30)) + if (data[4] == 0xf0 && data[5] == 0x00 && (data[6] == 0x20 || data[6] == 0x30)) { // log //TmpData = StringFromFormat("Read[%s] (enc): %s", (Emu ? "Emu" : "Real"), ArrayToString(data, size + 2).c_str()); @@ -435,7 +435,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) if (!emu) { // Save to registry - if(data[7 + 0] != 0xff) + if (data[7 + 0] != 0xff) { //memcpy((u8*)&wm->m_reg_ext.calibration, &data[7], 0x10); //memcpy((u8*)&wm->m_reg_ext.unknown3, &data[7], 0x10); @@ -448,7 +448,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) //WiimoteEmu::UpdateEeprom(); } // third party Nunchuck - else if(data[7] == 0xff) + else if (data[7] == 0xff) { //memcpy(wm->m_reg_ext + 0x20, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration)); //memcpy(wm->m_reg_ext + 0x30, WiimoteEmu::wireless_nunchuck_calibration, sizeof(WiimoteEmu::wireless_nunchuck_calibration)); @@ -460,7 +460,7 @@ void Spy(Wiimote* wm_, const void* data_, size_t size_) if (dataReply[1] == 0xa4 || dataReply[1] == 0xa6) { - if(rdr->error == 7 || rdr->error == 8) + if (rdr->error == 7 || rdr->error == 8) { WARN_LOG(CONSOLE, "R%s[0x%02x 0x%02x]: e-%d", decrypted?"*":"", dataReply[1], rdr->address>>8, rdr->error); } diff --git a/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp b/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp index 8d2efd0fb80..89454b48d17 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Encryption.cpp @@ -197,7 +197,7 @@ void genkey(const u8* const rand, const u8 idx, u8* const key) const u8* const ans = ans_tbl[idx]; u8 t0[10]; - for(int i=0; i<10; ++i) + for (int i=0; i<10; ++i) t0[i] = tsbox[rand[i]]; key[0] = ((ror8((ans[0]^t0[5]),(t0[2]%8)) - t0[9]) ^ t0[4]); @@ -249,7 +249,7 @@ void wiimote_gen_key(wiimote_key* const key, const u8* const keydata) //DEBUG_LOG(WIIMOTE, "rand: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", rand[0], rand[1], rand[2], rand[3], rand[4], rand[5], rand[6], rand[7], rand[8], rand[9]); //DEBUG_LOG(WIIMOTE, "key: %02x %02x %02x %02x %02x %02x", skey[0], skey[1], skey[2], skey[3], skey[4], skey[5]); - for(idx = 0; idx < 7; ++idx) + for (idx = 0; idx < 7; ++idx) { genkey(rand, idx, testkey); if (0 == memcmp(testkey, skey, 6)) diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp index 9b83c8b0bdf..97e6df5b15f 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp @@ -42,7 +42,8 @@ static s32 av_clip(s32 a, s32 amin, s32 amax) static s16 adpcm_yamaha_expand_nibble(ADPCMState& s, u8 nibble) { - if(!s.step) { + if (!s.step) + { s.predictor = 0; s.step = 0; } diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index e033ab8e505..fc5c74a4aac 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -339,7 +339,7 @@ bool Wiimote::Step() m_rumble->controls[0]->control_ref->State(m_rumble_on); // when a movie is active, this button status update is disabled (moved), because movies only record data reports. - if(!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning()) + if (!(Movie::IsPlayingInput() || Movie::IsRecordingInput()) || NetPlay::IsNetPlayRunning()) { UpdateButtonsStatus(has_focus); } @@ -397,7 +397,7 @@ void Wiimote::UpdateButtonsStatus(bool has_focus) void Wiimote::GetCoreData(u8* const data) { // when a movie is active, the button update happens here instead of Wiimote::Step, to avoid potential desync issues. - if(Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::IsNetPlayRunning()) + if (Movie::IsPlayingInput() || Movie::IsRecordingInput() || NetPlay::IsNetPlayRunning()) { UpdateButtonsStatus(HAS_FOCUS); } diff --git a/Source/Core/Core/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/HW/WiimoteReal/IONix.cpp index d37774863d6..d322fb4a7fc 100644 --- a/Source/Core/Core/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/HW/WiimoteReal/IONix.cpp @@ -104,7 +104,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot auto* const wm = new Wiimote; wm->bdaddr = scan_infos[i].bdaddr; - if(IsBalanceBoardName(name)) + if (IsBalanceBoardName(name)) { found_board = wm; NOTICE_LOG(WIIMOTE, "Found balance board (%s).", bdaddr_str); diff --git a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm index 92d57535b59..637724acec2 100644 --- a/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/HW/WiimoteReal/IOdarwin.mm @@ -149,7 +149,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot { CFRunLoopRun(); } - while(!sbt->done); + while (!sbt->done); int found_devices = [[bti foundDevices] count]; @@ -166,7 +166,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot Wiimote *wm = new Wiimote(); wm->btd = [dev retain]; - if(IsBalanceBoardName([[dev name] UTF8String])) + if (IsBalanceBoardName([[dev name] UTF8String])) { found_board = wm; } diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 0df6799e535..0dfddd0505a 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -179,9 +179,9 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const leds_rpt.leds = 0xf; } } - else if (rpt[1] == WM_WRITE_SPEAKER_DATA - && (!SConfig::GetInstance().m_WiimoteEnableSpeaker - || (!wm->m_status.speaker || wm->m_speaker_mute))) + else if (rpt[1] == WM_WRITE_SPEAKER_DATA && + (!SConfig::GetInstance().m_WiimoteEnableSpeaker || + (!wm->m_status.speaker || wm->m_speaker_mute))) { // Translate speaker data reports into rumble reports. rpt[1] = WM_RUMBLE; @@ -200,10 +200,14 @@ bool Wiimote::Read() if (result > 0 && m_channel > 0) { - if (Core::g_CoreStartupParameter.iBBDumpPort > 0 && index == WIIMOTE_BALANCE_BOARD) + if (Core::g_CoreStartupParameter.iBBDumpPort > 0 && + index == WIIMOTE_BALANCE_BOARD) { static sf::SocketUDP Socket; - Socket.Send((char*)rpt.data(), rpt.size(), sf::IPAddress::LocalHost, Core::g_CoreStartupParameter.iBBDumpPort); + Socket.Send((char*)rpt.data(), + rpt.size(), + sf::IPAddress::LocalHost, + Core::g_CoreStartupParameter.iBBDumpPort); } // Add it to queue @@ -321,10 +325,10 @@ bool Wiimote::PrepareOnThread() u8 static const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; // TODO: check for sane response? - return (IOWrite(mode_report, sizeof(mode_report)) - && IOWrite(led_report, sizeof(led_report)) - && (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report))) - && IOWrite(req_status_report, sizeof(req_status_report))); + return (IOWrite(mode_report, sizeof(mode_report)) && + IOWrite(led_report, sizeof(led_report)) && + (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report))) && + IOWrite(req_status_report, sizeof(req_status_report))); } void Wiimote::EmuStart() @@ -464,9 +468,9 @@ void WiimoteScanner::ThreadFunc() // TODO: this is a fairly lame place for this CheckForDisconnectedWiimotes(); - if(m_want_wiimotes) + if (m_want_wiimotes) HandleFoundWiimotes(found_wiimotes); - if(m_want_bb && found_board) + if (m_want_bb && found_board) TryToConnectBalanceBoard(found_board); //std::this_thread::yield(); @@ -596,7 +600,7 @@ void Initialize(bool wait) g_wiimote_scanner.FindWiimotes(found_wiimotes, found_board); if (SConfig::GetInstance().m_WiimoteContinuousScanning) { - while(CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout) + while (CalculateWantedWiimotes() && CalculateConnectedWiimotes() < found_wiimotes.size() && timeout) { Common::SleepCurrentThread(100); timeout--; @@ -671,8 +675,7 @@ void ChangeWiimoteSource(unsigned int index, int source) static bool TryToConnectWiimoteN(Wiimote* wm, unsigned int i) { - if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] - && !g_wiimotes[i]) + if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i]) { if (wm->Connect()) { @@ -794,7 +797,7 @@ void Refresh() } HandleFoundWiimotes(found_wiimotes); - if(found_board) + if (found_board) TryToConnectBalanceBoard(found_board); } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index 6e2f2ed94d4..836c41b34b6 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -93,7 +93,7 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress) // Prepare the out buffer(s) with zeros as a safety precaution // to avoid returning bad values - for(u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++) + for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++) { Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0, CommandBuffer.PayloadBuffer[i].m_Size); @@ -148,7 +148,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 } // Initializing a filesystem if it was just loaded - if(!m_pFileSystem && VolumeHandler::IsValid()) + if (!m_pFileSystem && VolumeHandler::IsValid()) { m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume()); m_CoverStatus |= DI_COVER_REG_INITIALIZED; @@ -156,7 +156,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 } // De-initializing a filesystem if the volume was unmounted - if(m_pFileSystem && !VolumeHandler::IsValid()) + if (m_pFileSystem && !VolumeHandler::IsValid()) { delete m_pFileSystem; m_pFileSystem = nullptr; @@ -294,13 +294,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 // * 0x460a0000 - 0x460a0008 // * 0x7ed40000 - 0x7ed40008 u32 DVDAddress32 = Memory::Read_U32(_BufferIn + 0x08); - if (!( (DVDAddress32 > 0x00000000 && DVDAddress32 < 0x00014000) - || (((DVDAddress32 + Size) > 0x00000000) && (DVDAddress32 + Size) < 0x00014000) - || (DVDAddress32 > 0x460a0000 && DVDAddress32 < 0x460a0008) - || (((DVDAddress32 + Size) > 0x460a0000) && (DVDAddress32 + Size) < 0x460a0008) - || (DVDAddress32 > 0x7ed40000 && DVDAddress32 < 0x7ed40008) - || (((DVDAddress32 + Size) > 0x7ed40000) && (DVDAddress32 + Size) < 0x7ed40008) - )) + if (!((DVDAddress32 > 0x00000000 && DVDAddress32 < 0x00014000) || + (((DVDAddress32 + Size) > 0x00000000) && (DVDAddress32 + Size) < 0x00014000) || + (DVDAddress32 > 0x460a0000 && DVDAddress32 < 0x460a0008) || + (((DVDAddress32 + Size) > 0x460a0000) && (DVDAddress32 + Size) < 0x460a0008) || + (DVDAddress32 > 0x7ed40000 && DVDAddress32 < 0x7ed40008) || + (((DVDAddress32 + Size) > 0x7ed40000) && (DVDAddress32 + Size) < 0x7ed40008))) { WARN_LOG(WII_IPC_DVD, "DVDLowUnencryptedRead: trying to read out of bounds @ %x", DVDAddress32); m_ErrorStatus = ERROR_READY | ERROR_BLOCK_OOB; @@ -317,7 +316,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 PanicAlertT("Detected attempt to read more data from the DVD than fit inside the out buffer. Clamp."); Size = _BufferOutSize; } - if(!VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), DVDAddress, Size)) + if (!VolumeHandler::RAWReadToPtr(Memory::GetPointer(_BufferOut), DVDAddress, Size)) { PanicAlertT("DVDLowUnencryptedRead - Fatal Error: failed to read from volume"); } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp index c34f6affbe4..1c16e496d28 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -803,7 +803,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) TMDCnt += DiscIO::INANDContentLoader::TMD_HEADER_SIZE; TMDCnt += (u32)Loader.GetContentSize() * DiscIO::INANDContentLoader::CONTENT_HEADER_SIZE; } - if(Buffer.NumberPayloadBuffer) + if (Buffer.NumberPayloadBuffer) Memory::Write_U32(TMDCnt, Buffer.PayloadBuffer[0].m_Address); Memory::Write_U32(0, _CommandAddress + 0x4); @@ -1151,7 +1151,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) #endif } - if(!File::Exists(tmdPath)) + if (!File::Exists(tmdPath)) { File::IOFile _pTMDFile(tmdPath, "wb"); if (!_pTMDFile.WriteBytes(_pTMD, _sz)) diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index 723bab998ca..17735bad8ca 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -74,13 +74,13 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress) // Prepare the out buffer(s) with zeros as a safety precaution // to avoid returning bad values - for(u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++) + for (u32 i = 0; i < CommandBuffer.NumberPayloadBuffer; i++) { Memory::Memset(CommandBuffer.PayloadBuffer[i].m_Address, 0, CommandBuffer.PayloadBuffer[i].m_Size); } - switch(CommandBuffer.Parameter) + switch (CommandBuffer.Parameter) { case IOCTLV_READ_DIR: { @@ -253,7 +253,7 @@ bool CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress) s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize) { - switch(_Parameter) + switch (_Parameter) { case IOCTL_GET_STATS: { @@ -508,7 +508,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p) File::CreateDir(Path.c_str()); //now restore from the stream - while(1) { + while (1) { char type = 0; p.Do(type); if (!type) @@ -516,7 +516,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p) std::string filename; p.Do(filename); std::string name = Path + DIR_SEP + filename; - switch(type) + switch (type) { case 'd': { @@ -531,7 +531,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p) File::IOFile handle(name, "wb"); char buf[65536]; u32 count = size; - while(count > 65536) { + while (count > 65536) { p.DoArray(&buf[0], 65536); handle.WriteArray(&buf[0], 65536); count -= 65536; @@ -553,7 +553,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p) todo.insert(todo.end(), parentEntry.children.begin(), parentEntry.children.end()); - while(!todo.empty()) + while (!todo.empty()) { File::FSTEntry &entry = todo.front(); std::string name = entry.physicalName; @@ -574,7 +574,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p) File::IOFile handle(entry.physicalName, "rb"); char buf[65536]; u32 count = size; - while(count > 65536) { + while (count > 65536) { handle.ReadArray(&buf[0], 65536); p.DoArray(&buf[0], 65536); count -= 65536; diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp index 35519e96970..a1f7ba4da4a 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp @@ -390,7 +390,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) struct libusb_config_descriptor *config = nullptr; int cRet = libusb_get_config_descriptor(device, c, &config); // do not try to use usb devices with more than one interface, games can crash - if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES) + if (cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES) { WiiHIDConfigDescriptor wii_config; ConvertConfigToWii(&wii_config, config); @@ -430,7 +430,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) } else { - if(cRet) + if (cRet) DEBUG_LOG(WII_IPC_HID, "libusb_get_config_descriptor failed with: %d", cRet); deviceValid = false; OffsetBuffer = OffsetStart; @@ -471,7 +471,7 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize) for (i=0; i> 48); - if(hidDeviceAliases[i] != 0 && check_cur != check) + if (hidDeviceAliases[i] != 0 && check_cur != check) { DEBUG_LOG(WII_IPC_HID, "Removing: device %d %hX %hX", i, check, check_cur); std::lock_guard lk(s_open_devices); @@ -505,7 +505,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) libusb_device_handle *handle = nullptr; ssize_t cnt; - if(devNum >= MAX_DEVICE_DEVNUM) + if (devNum >= MAX_DEVICE_DEVNUM) return nullptr; @@ -514,7 +514,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) if (open_devices.find(devNum) != open_devices.end()) { handle = open_devices[devNum]; - if(libusb_kernel_driver_active(handle, 0) != LIBUSB_ERROR_NO_DEVICE) + if (libusb_kernel_driver_active(handle, 0) != LIBUSB_ERROR_NO_DEVICE) { return handle; } @@ -549,14 +549,15 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) { if (ret == LIBUSB_ERROR_ACCESS) { - if( dRet ) + if (dRet) { ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID ????:???? (couldn't get id).", bus, port ); } - else{ + else + { ERROR_LOG(WII_IPC_HID, "Dolphin does not have access to this device: Bus %03d Device %03d: ID %04X:%04X.", bus, port, @@ -568,7 +569,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum) #ifdef _WIN32 else if (ret == LIBUSB_ERROR_NOT_SUPPORTED) { - if(!has_warned_about_drivers) + if (!has_warned_about_drivers) { // Max of one warning. has_warned_about_drivers = true; @@ -615,7 +616,7 @@ int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 b for (int i=0; idcid, pHeader->length, DataSize); - if(pHeader->length != DataSize) + if (pHeader->length != DataSize) { INFO_LOG(WII_IPC_WIIMOTE, "Faulty packet. It is dropped."); return; @@ -776,7 +776,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size) CBigEndianBuffer buffer(_pData); - switch(buffer.Read8(0)) + switch (buffer.Read8(0)) { // SDP_ServiceSearchRequest case 0x02: diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/IPC_HLE/WII_Socket.cpp index 63e0130b568..3c05b4af824 100644 --- a/Source/Core/Core/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/IPC_HLE/WII_Socket.cpp @@ -188,7 +188,7 @@ void WiiSocket::update(bool read, bool write, bool except) u32 BufferOut = Memory::Read_U32(it->_CommandAddress + 0x18); u32 BufferOutSize = Memory::Read_U32(it->_CommandAddress + 0x1C); - switch(it->net_type) + switch (it->net_type) { case IOCTL_SO_FCNTL: { @@ -261,8 +261,8 @@ void WiiSocket::update(bool read, bool write, bool except) // Fix blocking error codes if (!nonBlock) { - if (it->net_type == IOCTL_SO_CONNECT - && ReturnValue == -SO_EISCONN) + if (it->net_type == IOCTL_SO_CONNECT && + ReturnValue == -SO_EISCONN) { ReturnValue = SO_SUCCESS; } @@ -305,7 +305,7 @@ void WiiSocket::update(bool read, bool write, bool except) int sslID = Memory::Read_U32(BufferOut) - 1; if (SSLID_VALID(sslID)) { - switch(it->ssl_type) + switch (it->ssl_type) { case IOCTLV_NET_SSL_DOHANDSHAKE: { @@ -511,12 +511,19 @@ void WiiSocket::update(bool read, bool write, bool except) } } - if ( nonBlock || forceNonBlock - || (!it->is_ssl && ReturnValue != -SO_EAGAIN && ReturnValue != -SO_EINPROGRESS && ReturnValue != -SO_EALREADY) - || (it->is_ssl && ReturnValue != SSL_ERR_WAGAIN && ReturnValue != SSL_ERR_RAGAIN)) + if (nonBlock || + forceNonBlock || + (!it->is_ssl && + ReturnValue != -SO_EAGAIN && + ReturnValue != -SO_EINPROGRESS && + ReturnValue != -SO_EALREADY) || + (it->is_ssl && + ReturnValue != SSL_ERR_WAGAIN && + ReturnValue != SSL_ERR_RAGAIN)) { - DEBUG_LOG(WII_IPC_NET, "IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", - fd, it->is_ssl ? (int) it->ssl_type : (int) it->net_type, ReturnValue, nonBlock, forceNonBlock); + DEBUG_LOG(WII_IPC_NET, + "IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", + fd, it->is_ssl ? (int) it->ssl_type : (int) it->net_type, ReturnValue, nonBlock, forceNonBlock); WiiSockMan::EnqueueReply(it->_CommandAddress, ReturnValue); it = pending_sockops.erase(it); } @@ -552,9 +559,9 @@ void WiiSockMan::addSocket(s32 fd) s32 WiiSockMan::newSocket(s32 af, s32 type, s32 protocol) { - if (NetPlay::IsNetPlayRunning() - || Movie::IsRecordingInput() - || Movie::IsPlayingInput()) + if (NetPlay::IsNetPlayRunning() || + Movie::IsRecordingInput() || + Movie::IsPlayingInput()) { return SO_ENOMEM; } diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 2056d722437..6f0f3f9af50 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -120,7 +120,7 @@ std::string GetInputDisplay() void FrameUpdate() { g_currentFrame++; - if(!g_bPolled) + if (!g_bPolled) g_currentLagCount++; if (IsRecordingInput()) @@ -139,7 +139,7 @@ void FrameUpdate() if (g_bFrameStop) *PowerPC::GetStatePtr() = PowerPC::CPU_STEPPING; - if(g_framesToSkip) + if (g_framesToSkip) FrameSkipping(); g_bPolled = false; @@ -222,14 +222,14 @@ void SetPolledDevice() void DoFrameStep() { - if(Core::GetState() == Core::CORE_PAUSE) + if (Core::GetState() == Core::CORE_PAUSE) { // if already paused, frame advance for 1 frame Core::SetState(Core::CORE_RUN); Core::RequestRefreshInfo(); g_bFrameStep = true; } - else if(!g_bFrameStep) + else if (!g_bFrameStep) { // if not paused yet, pause immediately instead Core::SetState(Core::CORE_PAUSE); @@ -409,7 +409,7 @@ void ChangeWiiPads(bool instantly) bool BeginRecordingInput(int controllers) { - if(g_playMode != MODE_NONE || controllers == 0) + if (g_playMode != MODE_NONE || controllers == 0) return false; g_numPads = controllers; @@ -432,7 +432,7 @@ bool BeginRecordingInput(int controllers) if (Core::IsRunning()) { - if(File::Exists(tmpStateFilename)) + if (File::Exists(tmpStateFilename)) File::Delete(tmpStateFilename); State::SaveAs(tmpStateFilename.c_str()); @@ -463,16 +463,16 @@ bool BeginRecordingInput(int controllers) static void Analog2DToString(u8 x, u8 y, const char* prefix, char* str) { - if((x <= 1 || x == 128 || x >= 255) - && (y <= 1 || y == 128 || y >= 255)) + if ((x <= 1 || x == 128 || x >= 255) && + (y <= 1 || y == 128 || y >= 255)) { - if(x != 128 || y != 128) + if (x != 128 || y != 128) { - if(x != 128 && y != 128) + if (x != 128 && y != 128) { sprintf(str, "%s:%s,%s", prefix, x<128?"LEFT":"RIGHT", y<128?"DOWN":"UP"); } - else if(x != 128) + else if (x != 128) { sprintf(str, "%s:%s", prefix, x<128?"LEFT":"RIGHT"); } @@ -494,9 +494,9 @@ static void Analog2DToString(u8 x, u8 y, const char* prefix, char* str) static void Analog1DToString(u8 v, const char* prefix, char* str) { - if(v > 0) + if (v > 0) { - if(v == 255) + if (v == 255) { strcpy(str, prefix); } @@ -517,26 +517,26 @@ void SetInputDisplayString(ControllerState padState, int controllerID) sprintf(inp, "P%d:", controllerID + 1); g_InputDisplay[controllerID] = inp; - if(g_padState.A) + if (g_padState.A) g_InputDisplay[controllerID].append(" A"); - if(g_padState.B) + if (g_padState.B) g_InputDisplay[controllerID].append(" B"); - if(g_padState.X) + if (g_padState.X) g_InputDisplay[controllerID].append(" X"); - if(g_padState.Y) + if (g_padState.Y) g_InputDisplay[controllerID].append(" Y"); - if(g_padState.Z) + if (g_padState.Z) g_InputDisplay[controllerID].append(" Z"); - if(g_padState.Start) + if (g_padState.Start) g_InputDisplay[controllerID].append(" START"); - if(g_padState.DPadUp) + if (g_padState.DPadUp) g_InputDisplay[controllerID].append(" UP"); - if(g_padState.DPadDown) + if (g_padState.DPadDown) g_InputDisplay[controllerID].append(" DOWN"); - if(g_padState.DPadLeft) + if (g_padState.DPadLeft) g_InputDisplay[controllerID].append(" LEFT"); - if(g_padState.DPadRight) + if (g_padState.DPadRight) g_InputDisplay[controllerID].append(" RIGHT"); Analog1DToString(g_padState.TriggerL, " L", inp); @@ -562,41 +562,41 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD sprintf(inp, "R%d:", remoteID + 1); g_InputDisplay[controllerID] = inp; - if(coreData) + if (coreData) { wm_core buttons = *(wm_core*)coreData; - if(buttons & WiimoteEmu::Wiimote::PAD_LEFT) + if (buttons & WiimoteEmu::Wiimote::PAD_LEFT) g_InputDisplay[controllerID].append(" LEFT"); - if(buttons & WiimoteEmu::Wiimote::PAD_RIGHT) + if (buttons & WiimoteEmu::Wiimote::PAD_RIGHT) g_InputDisplay[controllerID].append(" RIGHT"); - if(buttons & WiimoteEmu::Wiimote::PAD_DOWN) + if (buttons & WiimoteEmu::Wiimote::PAD_DOWN) g_InputDisplay[controllerID].append(" DOWN"); - if(buttons & WiimoteEmu::Wiimote::PAD_UP) + if (buttons & WiimoteEmu::Wiimote::PAD_UP) g_InputDisplay[controllerID].append(" UP"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_A) + if (buttons & WiimoteEmu::Wiimote::BUTTON_A) g_InputDisplay[controllerID].append(" A"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_B) + if (buttons & WiimoteEmu::Wiimote::BUTTON_B) g_InputDisplay[controllerID].append(" B"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_PLUS) + if (buttons & WiimoteEmu::Wiimote::BUTTON_PLUS) g_InputDisplay[controllerID].append(" +"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_MINUS) + if (buttons & WiimoteEmu::Wiimote::BUTTON_MINUS) g_InputDisplay[controllerID].append(" -"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_ONE) + if (buttons & WiimoteEmu::Wiimote::BUTTON_ONE) g_InputDisplay[controllerID].append(" 1"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_TWO) + if (buttons & WiimoteEmu::Wiimote::BUTTON_TWO) g_InputDisplay[controllerID].append(" 2"); - if(buttons & WiimoteEmu::Wiimote::BUTTON_HOME) + if (buttons & WiimoteEmu::Wiimote::BUTTON_HOME) g_InputDisplay[controllerID].append(" HOME"); } - if(accelData) + if (accelData) { wm_accel* dt = (wm_accel*)accelData; sprintf(inp, " ACC:%d,%d,%d", dt->x, dt->y, dt->z); g_InputDisplay[controllerID].append(inp); } - if(irData) // incomplete + if (irData) // incomplete { sprintf(inp, " IR:%d,%d", ((u8*)irData)[0], ((u8*)irData)[1]); g_InputDisplay[controllerID].append(inp); @@ -666,7 +666,7 @@ void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& void RecordWiimote(int wiimote, u8 *data, u8 size) { - if(!IsRecordingInput() || !IsUsingWiimote(wiimote)) + if (!IsRecordingInput() || !IsUsingWiimote(wiimote)) return; InputUpdate(); @@ -713,10 +713,10 @@ void ReadHeader() bool PlayInput(const char *filename) { - if(!filename || g_playMode != MODE_NONE) + if (!filename || g_playMode != MODE_NONE) return false; - if(!File::Exists(filename)) + if (!File::Exists(filename)) return false; File::IOFile g_recordfd; @@ -726,7 +726,10 @@ bool PlayInput(const char *filename) g_recordfd.ReadArray(&tmpHeader, 1); - if(tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A) { + if (tmpHeader.filetype[0] != 'D' || + tmpHeader.filetype[1] != 'T' || + tmpHeader.filetype[2] != 'M' || + tmpHeader.filetype[3] != 0x1A) { PanicAlertT("Invalid recording file"); goto cleanup; } @@ -748,10 +751,10 @@ bool PlayInput(const char *filename) g_recordfd.Close(); // Load savestate (and skip to frame data) - if(tmpHeader.bFromSaveState) + if (tmpHeader.bFromSaveState) { const std::string stateFilename = std::string(filename) + ".sav"; - if(File::Exists(stateFilename)) + if (File::Exists(stateFilename)) Core::SetStateFileName(stateFilename); g_bRecordingFromSaveState = true; Movie::LoadInput(filename); @@ -791,7 +794,7 @@ void LoadInput(const char *filename) t_record.ReadArray(&tmpHeader, 1); - if(tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A) + if (tmpHeader.filetype[0] != 'D' || tmpHeader.filetype[1] != 'T' || tmpHeader.filetype[2] != 'M' || tmpHeader.filetype[3] != 0x1A) { PanicAlertT("Savestate movie %s is corrupted, movie recording stopping...", filename); EndPlayInput(false); @@ -838,7 +841,7 @@ void LoadInput(const char *filename) { PanicAlertT("Warning: You loaded a save that's after the end of the current movie. (byte %u > %u) (frame %u > %u). You should load another save before continuing, or load this state with read-only mode off.", (u32)g_currentByte+256, (u32)g_totalBytes+256, (u32)g_currentFrame, (u32)g_totalFrames); } - else if(g_currentByte > 0 && g_totalBytes > 0) + else if (g_currentByte > 0 && g_totalBytes > 0) { // verify identical from movie start to the save's current frame u32 len = (u32)g_currentByte; @@ -850,7 +853,7 @@ void LoadInput(const char *filename) { // this is a "you did something wrong" alert for the user's benefit. // we'll try to say what's going on in excruciating detail, otherwise the user might not believe us. - if(IsUsingWiimote(0)) + if (IsUsingWiimote(0)) { // TODO: more detail PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256); @@ -893,7 +896,7 @@ void LoadInput(const char *filename) { if (g_bReadOnly) { - if(g_playMode != MODE_PLAYING) + if (g_playMode != MODE_PLAYING) { g_playMode = MODE_PLAYING; Core::DisplayMessage("Switched to playback", 2000); @@ -901,7 +904,7 @@ void LoadInput(const char *filename) } else { - if(g_playMode != MODE_RECORDING) + if (g_playMode != MODE_RECORDING) { g_playMode = MODE_RECORDING; Core::DisplayMessage("Switched to recording", 2000); @@ -956,37 +959,37 @@ void PlayController(SPADStatus *PadStatus, int controllerID) PadStatus->button |= PAD_USE_ORIGIN; - if(g_padState.A) + if (g_padState.A) { PadStatus->button |= PAD_BUTTON_A; PadStatus->analogA = 0xFF; } - if(g_padState.B) + if (g_padState.B) { PadStatus->button |= PAD_BUTTON_B; PadStatus->analogB = 0xFF; } - if(g_padState.X) + if (g_padState.X) PadStatus->button |= PAD_BUTTON_X; - if(g_padState.Y) + if (g_padState.Y) PadStatus->button |= PAD_BUTTON_Y; - if(g_padState.Z) + if (g_padState.Z) PadStatus->button |= PAD_TRIGGER_Z; - if(g_padState.Start) + if (g_padState.Start) PadStatus->button |= PAD_BUTTON_START; - if(g_padState.DPadUp) + if (g_padState.DPadUp) PadStatus->button |= PAD_BUTTON_UP; - if(g_padState.DPadDown) + if (g_padState.DPadDown) PadStatus->button |= PAD_BUTTON_DOWN; - if(g_padState.DPadLeft) + if (g_padState.DPadLeft) PadStatus->button |= PAD_BUTTON_LEFT; - if(g_padState.DPadRight) + if (g_padState.DPadRight) PadStatus->button |= PAD_BUTTON_RIGHT; - if(g_padState.L) + if (g_padState.L) PadStatus->button |= PAD_TRIGGER_L; - if(g_padState.R) + if (g_padState.R) PadStatus->button |= PAD_TRIGGER_R; if (g_padState.disc) { @@ -1022,7 +1025,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) bool PlayWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode) { - if(!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == nullptr) + if (!IsPlayingInput() || !IsUsingWiimote(wiimote) || tmpInput == nullptr) return false; if (g_currentByte > g_totalBytes) @@ -1074,7 +1077,7 @@ void EndPlayInput(bool cont) g_playMode = MODE_RECORDING; Core::DisplayMessage("Reached movie end. Resuming recording.", 2000); } - else if(g_playMode != MODE_NONE) + else if (g_playMode != MODE_NONE) { g_rerecords = 0; g_currentByte = 0; diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 53db18d8ea5..c8e4438ef66 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -697,7 +697,7 @@ bool NetPlayServer::UPnPMapPort(const std::string& addr, const u16 port) (std::string("dolphin-emu TCP on ") + addr).c_str(), "TCP", nullptr, nullptr); - if(result != 0) + if (result != 0) return false; m_upnp_mapped = port; diff --git a/Source/Core/Core/PowerPC/GDBStub.cpp b/Source/Core/Core/PowerPC/GDBStub.cpp index bc94a2c68d7..412c808a3e3 100644 --- a/Source/Core/Core/PowerPC/GDBStub.cpp +++ b/Source/Core/Core/PowerPC/GDBStub.cpp @@ -116,7 +116,7 @@ static u8 gdb_calc_chksum() u8 *ptr = cmd_bfr; u8 c = 0; - while(len-- > 0) + while (len-- > 0) c += *ptr++; return c; @@ -306,7 +306,7 @@ static void gdb_reply(const char *reply) u8 *ptr; int n; - if(!gdb_active()) + if (!gdb_active()) return; memset(cmd_bfr, 0, sizeof cmd_bfr); @@ -329,7 +329,8 @@ static void gdb_reply(const char *reply) ptr = cmd_bfr; left = cmd_len + 4; - while (left > 0) { + while (left > 0) + { n = send(sock, ptr, left, 0); if (n < 0) { @@ -719,14 +720,15 @@ static void gdb_remove_bp() void gdb_handle_exception() { - while (gdb_active()) { - if(!gdb_data_available()) + while (gdb_active()) + { + if (!gdb_data_available()) continue; gdb_read_command(); if (cmd_len == 0) continue; - switch(cmd_bfr[0]) { + switch (cmd_bfr[0]) { case 'q': gdb_handle_query(); break; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index 5b32d50fe08..c166f107f24 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -154,11 +154,11 @@ void Interpreter::twi(UGeckoInstruction _inst) ERROR_LOG(POWERPC, "twi rA %x SIMM %x TO %0x", a, b, TO); - if ( ((a < b) && (TO & 0x10)) - || ((a > b) && (TO & 0x08)) - || ((a ==b) && (TO & 0x04)) - || (((u32)a <(u32)b) && (TO & 0x02)) - || (((u32)a >(u32)b) && (TO & 0x01))) + if (((a < b) && (TO & 0x10)) || + ((a > b) && (TO & 0x08)) || + ((a ==b) && (TO & 0x04)) || + (((u32)a <(u32)b) && (TO & 0x02)) || + (((u32)a >(u32)b) && (TO & 0x01))) { Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM); PowerPC::CheckExceptions(); @@ -382,11 +382,11 @@ void Interpreter::tw(UGeckoInstruction _inst) ERROR_LOG(POWERPC, "tw rA %0x rB %0x TO %0x", a, b, TO); - if ( ((a < b) && (TO & 0x10)) - || ((a > b) && (TO & 0x08)) - || ((a ==b) && (TO & 0x04)) - || (((u32)a <(u32)b) && (TO & 0x02)) - || (((u32)a >(u32)b) && (TO & 0x01))) + if (((a < b) && (TO & 0x10)) || + ((a > b) && (TO & 0x08)) || + ((a ==b) && (TO & 0x04)) || + (((u32)a <(u32)b) && (TO & 0x02)) || + (((u32)a >(u32)b) && (TO & 0x01))) { Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_PROGRAM); PowerPC::CheckExceptions(); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp index aeda5a1242c..15399816552 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp @@ -99,7 +99,7 @@ float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quant { // dequantize the value float fResult; - switch(_quantizeType) + switch (_quantizeType) { case QUANTIZE_FLOAT: { diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 7e3eea54586..7ecca1ab5bc 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -253,7 +253,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst) //Our DMA emulation is highly inaccurate - instead of properly emulating the queue //and so on, we simply make all DMA:s complete instantaneously. - switch(iIndex) + switch (iIndex) { case SPR_TL: case SPR_TU: diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp index aa07251c7d7..2092e0eccde 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp @@ -132,7 +132,7 @@ void Jit64::bcx(UGeckoInstruction inst) MOV(32, M(&LR), Imm32(js.compilerPC + 4)); u32 destination; - if(inst.AA) + if (inst.AA) destination = SignExt16(inst.BD << 2); else destination = js.compilerPC + SignExt16(inst.BD << 2); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index a27481c925a..dfb3519da2a 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -18,7 +18,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X if (d == a) { fpr.BindToRegister(d, true); - if(!single) + if (!single) { fpr.BindToRegister(b, true, false); } @@ -29,7 +29,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X if (reversible) { fpr.BindToRegister(d, true); - if(!single) + if (!single) { fpr.BindToRegister(a, true, false); } @@ -47,7 +47,7 @@ void Jit64::fp_tri_op(int d, int a, int b, bool reversible, bool single, void (X { // Sources different from d, can use rather quick solution fpr.BindToRegister(d, !single); - if(!single) + if (!single) { fpr.BindToRegister(b, true, false); } diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index c7d29022c94..0bb27f1eed3 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -135,12 +135,12 @@ void Jit64::GenerateRC() void Jit64::ComputeRC(const Gen::OpArg & arg) { - if( arg.IsImm() ) + if (arg.IsImm()) { s32 value = (s32)arg.offset; - if( value < 0 ) + if (value < 0) MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x8)); - else if( value > 0 ) + else if (value > 0) MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x4)); else MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x2)); @@ -1102,13 +1102,13 @@ void Jit64::mulli(UGeckoInstruction inst) { XOR(32, gpr.R(d), gpr.R(d)); } - else if(imm == (u32)-1) + else if (imm == (u32)-1) { if (d != a) MOV(32, gpr.R(d), gpr.R(a)); NEG(32, gpr.R(d)); } - else if((imm & (imm - 1)) == 0) + else if ((imm & (imm - 1)) == 0) { u32 shift = 0; if (imm & 0xFFFF0000) shift |= 16; @@ -1157,13 +1157,13 @@ void Jit64::mullwx(UGeckoInstruction inst) { XOR(32, gpr.R(d), gpr.R(d)); } - else if(imm == (u32)-1) + else if (imm == (u32)-1) { if (d != src) MOV(32, gpr.R(d), gpr.R(src)); NEG(32, gpr.R(d)); } - else if((imm & (imm - 1)) == 0 && !inst.OE) + else if ((imm & (imm - 1)) == 0 && !inst.OE) { u32 shift = 0; if (imm & 0xFFFF0000) shift |= 16; @@ -1245,7 +1245,7 @@ void Jit64::divwux(UGeckoInstruction inst) if (gpr.R(a).IsImm() && gpr.R(b).IsImm()) { - if( gpr.R(b).offset == 0 ) + if (gpr.R(b).offset == 0) { gpr.SetImmediate32(d, 0); if (inst.OE) @@ -1276,7 +1276,7 @@ void Jit64::divwux(UGeckoInstruction inst) else { u32 shift = 31; - while(!(divisor & (1 << shift))) + while (!(divisor & (1 << shift))) shift--; if (divisor == (u32)(1 << shift)) @@ -1403,7 +1403,7 @@ void Jit64::divwx(UGeckoInstruction inst) if (gpr.R(a).IsImm() && gpr.R(b).IsImm()) { s32 i = (s32)gpr.R(a).offset, j = (s32)gpr.R(b).offset; - if( j == 0 || (i == (s32)0x80000000 && j == -1)) + if (j == 0 || (i == (s32)0x80000000 && j == -1)) { gpr.SetImmediate32(d, (i >> 31) ^ j); if (inst.OE) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index ddbe1260193..3c0732c6928 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -262,7 +262,7 @@ void Jit64::crXXX(UGeckoInstruction inst) SHR(8, R(ECX), Imm8(shiftB)); // Compute combined bit - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 33: // crnor OR(8, R(EAX), R(ECX)); diff --git a/Source/Core/Core/PowerPC/JitArm32/Jit.cpp b/Source/Core/Core/PowerPC/JitArm32/Jit.cpp index b2a58f26636..3aa46240565 100644 --- a/Source/Core/Core/PowerPC/JitArm32/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/Jit.cpp @@ -132,7 +132,7 @@ void JitArm::DoDownCount() ARMReg rB = gpr.GetReg(); MOVI2R(rA, (u32)&CoreTiming::downcount); LDR(rB, rA); - if(js.downcountAmount < 255) // We can enlarge this if we used rotations + if (js.downcountAmount < 255) // We can enlarge this if we used rotations { SUBS(rB, rB, js.downcountAmount); STR(rB, rA); @@ -257,19 +257,19 @@ void JitArm::PrintDebug(UGeckoInstruction inst, u32 level) printf("\tOuts\n"); if (Info->flags & FL_OUT_A) printf("\t-OUT_A: %x\n", inst.RA); - if(Info->flags & FL_OUT_D) + if (Info->flags & FL_OUT_D) printf("\t-OUT_D: %x\n", inst.RD); printf("\tIns\n"); // A, AO, B, C, S - if(Info->flags & FL_IN_A) + if (Info->flags & FL_IN_A) printf("\t-IN_A: %x\n", inst.RA); - if(Info->flags & FL_IN_A0) + if (Info->flags & FL_IN_A0) printf("\t-IN_A0: %x\n", inst.RA); - if(Info->flags & FL_IN_B) + if (Info->flags & FL_IN_B) printf("\t-IN_B: %x\n", inst.RB); - if(Info->flags & FL_IN_C) + if (Info->flags & FL_IN_C) printf("\t-IN_C: %x\n", inst.RC); - if(Info->flags & FL_IN_S) + if (Info->flags & FL_IN_S) printf("\t-IN_S: %x\n", inst.RS); } } @@ -364,7 +364,7 @@ const u8* JitArm::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBlo const u8 *normalEntry = GetCodePtr(); b->normalEntry = normalEntry; - if(ImHereDebug) + if (ImHereDebug) QuickCallFunction(R14, (void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful if (js.fpa.any) diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp index 4e535d2cd34..8a453490668 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Branch.cpp @@ -192,7 +192,7 @@ void JitArm::bcx(UGeckoInstruction inst) gpr.Unlock(rA, rB); u32 destination; - if(inst.AA) + if (inst.AA) destination = SignExt16(inst.BD << 2); else destination = js.compilerPC + SignExt16(inst.BD << 2); @@ -223,7 +223,7 @@ void JitArm::bcctrx(UGeckoInstruction inst) //NPC = CTR & 0xfffffffc; ARMReg rA = gpr.GetReg(); - if(inst.LK_3) + if (inst.LK_3) { u32 Jumpto = js.compilerPC + 4; MOVI2R(rA, Jumpto); diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h b/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h index 265ba2deb65..5b8b0915aea 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_FPUtils.h @@ -31,7 +31,7 @@ static Operand2 VXSQRTException(2, 5); // 0x200 inline void JitArm::SetFPException(ARMReg Reg, u32 Exception) { Operand2 *ExceptionMask; - switch(Exception) + switch (Exception) { case FPSCR_VXCVI: ExceptionMask = &CVIException; diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp index 9aaadea011d..d5e3f9be52c 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_Integer.cpp @@ -283,7 +283,7 @@ void JitArm::arith(UGeckoInstruction inst) break; case 31: // addcx, addx, subfx - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 24: // slwx case 28: // andx @@ -341,7 +341,7 @@ void JitArm::arith(UGeckoInstruction inst) { bool hasCarry = false; u32 dest = d; - switch(inst.OPCD) + switch (inst.OPCD) { case 7: gpr.SetImmediate(d, Mul(Imm[0], Imm[1])); @@ -372,7 +372,7 @@ void JitArm::arith(UGeckoInstruction inst) dest = a; break; case 31: // addcx, addx, subfx - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 24: gpr.SetImmediate(a, Imm[0] << Imm[1]); @@ -439,7 +439,7 @@ void JitArm::arith(UGeckoInstruction inst) return; } // One or the other isn't a IMM - switch(inst.OPCD) + switch (inst.OPCD) { case 7: { @@ -511,7 +511,7 @@ void JitArm::arith(UGeckoInstruction inst) } break; case 31: - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 24: RA = gpr.R(a); diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp index 5f59acb0d10..c660d0387a9 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -89,7 +89,7 @@ void JitArm::SafeStoreFromReg(bool fastmem, s32 dest, u32 value, s32 regOffset, if (regOffset != -1) RB = gpr.R(regOffset); ARMReg RS = gpr.R(value); - switch(accessSize) + switch (accessSize) { case 32: MOVI2R(rA, (u32)&Memory::Write_U32); @@ -129,7 +129,7 @@ void JitArm::stX(UGeckoInstruction inst) bool zeroA = true; bool update = false; bool fastmem = false; - switch(inst.OPCD) + switch (inst.OPCD) { case 45: // sthu update = true; @@ -314,10 +314,10 @@ void JitArm::lXX(UGeckoInstruction inst) bool reverse = false; bool fastmem = false; - switch(inst.OPCD) + switch (inst.OPCD) { case 31: - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 55: // lwzux zeroA = false; diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp index 62389aad102..cc1e0b4e4a8 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp @@ -37,7 +37,7 @@ void JitArm::lfXX(UGeckoInstruction inst) switch (inst.OPCD) { case 31: - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 567: // lfsux single = true; @@ -199,7 +199,7 @@ void JitArm::stfXX(UGeckoInstruction inst) switch (inst.OPCD) { case 31: - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 663: // stfsx single = true; diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp index d49fa330c5c..bcf3485cc67 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_SystemRegisters.cpp @@ -242,7 +242,7 @@ void JitArm::crXXX(UGeckoInstruction inst) LSR(rB, rB, shiftB); // Compute combined bit - switch(inst.SUBOP10) + switch (inst.SUBOP10) { case 33: // crnor ORR(rA, rA, rB); diff --git a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp index 8f44a9c81fb..fcd544a771b 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitFPRCache.cpp @@ -16,14 +16,14 @@ void ArmFPRCache::Init(ARMXEmitter *emitter) ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG); ARMReg *Regs = GetAllocationOrder(NUMARMREG); - for(u8 a = 0; a < NUMPPCREG; ++a) + for (u8 a = 0; a < NUMPPCREG; ++a) { ArmCRegs[a].PPCReg = 33; ArmCRegs[a].Reg = PPCRegs[a]; ArmCRegs[a].LastLoad = 0; ArmCRegs[a].PS1 = false; } - for(u8 a = 0; a < NUMARMREG; ++a) + for (u8 a = 0; a < NUMARMREG; ++a) { ArmRegs[a].Reg = Regs[a]; ArmRegs[a].free = true; @@ -61,8 +61,8 @@ ARMReg *ArmFPRCache::GetAllocationOrder(int &count) ARMReg ArmFPRCache::GetReg(bool AutoLock) { - for(u8 a = 0; a < NUMARMREG; ++a) - if(ArmRegs[a].free) + for (u8 a = 0; a < NUMARMREG; ++a) + if (ArmRegs[a].free) { // Alright, this one is free if (AutoLock) @@ -75,9 +75,9 @@ ARMReg ArmFPRCache::GetReg(bool AutoLock) } void ArmFPRCache::Unlock(ARMReg V0) { - for(u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum) + for (u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum) { - if(ArmRegs[RegNum].Reg == V0) + if (ArmRegs[RegNum].Reg == V0) { _assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked"); ArmRegs[RegNum].free = true; @@ -88,7 +88,7 @@ u32 ArmFPRCache::GetLeastUsedRegister(bool increment) { u32 HighestUsed = 0; u8 lastRegIndex = 0; - for(u8 a = 0; a < NUMPPCREG; ++a){ + for (u8 a = 0; a < NUMPPCREG; ++a){ if (increment) ++ArmCRegs[a].LastLoad; if (ArmCRegs[a].LastLoad > HighestUsed) diff --git a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp index c5f97d43a85..4ba41eab230 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitRegCache.cpp @@ -16,13 +16,13 @@ void ArmRegCache::Init(ARMXEmitter *emitter) ARMReg *PPCRegs = GetPPCAllocationOrder(NUMPPCREG); ARMReg *Regs = GetAllocationOrder(NUMARMREG); - for(u8 a = 0; a < NUMPPCREG; ++a) + for (u8 a = 0; a < NUMPPCREG; ++a) { ArmCRegs[a].PPCReg = 33; ArmCRegs[a].Reg = PPCRegs[a]; ArmCRegs[a].LastLoad = 0; } - for(u8 a = 0; a < NUMARMREG; ++a) + for (u8 a = 0; a < NUMARMREG; ++a) { ArmRegs[a].Reg = Regs[a]; ArmRegs[a].free = true; @@ -57,8 +57,8 @@ ARMReg *ArmRegCache::GetAllocationOrder(int &count) ARMReg ArmRegCache::GetReg(bool AutoLock) { - for(u8 a = 0; a < NUMARMREG; ++a) - if(ArmRegs[a].free) + for (u8 a = 0; a < NUMARMREG; ++a) + if (ArmRegs[a].free) { // Alright, this one is free if (AutoLock) @@ -72,23 +72,24 @@ ARMReg ArmRegCache::GetReg(bool AutoLock) void ArmRegCache::Unlock(ARMReg R0, ARMReg R1, ARMReg R2, ARMReg R3) { - for(u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum) + for (u8 RegNum = 0; RegNum < NUMARMREG; ++RegNum) { - if(ArmRegs[RegNum].Reg == R0) + if (ArmRegs[RegNum].Reg == R0) { _assert_msg_(_DYNA_REC, !ArmRegs[RegNum].free, "This register is already unlocked"); ArmRegs[RegNum].free = true; } - if( R1 != INVALID_REG && ArmRegs[RegNum].Reg == R1) ArmRegs[RegNum].free = true; - if( R2 != INVALID_REG && ArmRegs[RegNum].Reg == R2) ArmRegs[RegNum].free = true; - if( R3 != INVALID_REG && ArmRegs[RegNum].Reg == R3) ArmRegs[RegNum].free = true; + if ( R1 != INVALID_REG && ArmRegs[RegNum].Reg == R1) ArmRegs[RegNum].free = true; + if ( R2 != INVALID_REG && ArmRegs[RegNum].Reg == R2) ArmRegs[RegNum].free = true; + if ( R3 != INVALID_REG && ArmRegs[RegNum].Reg == R3) ArmRegs[RegNum].free = true; } } u32 ArmRegCache::GetLeastUsedRegister(bool increment) { u32 HighestUsed = 0; u8 lastRegIndex = 0; - for(u8 a = 0; a < NUMPPCREG; ++a){ + for (u8 a = 0; a < NUMPPCREG; ++a) + { if (increment) ++ArmCRegs[a].LastLoad; if (ArmCRegs[a].LastLoad > HighestUsed) @@ -118,7 +119,7 @@ ARMReg ArmRegCache::R(u32 preg) u32 lastRegIndex = GetLeastUsedRegister(true); // Check if already Loaded - if(regs[preg].GetType() == REG_REG) + if (regs[preg].GetType() == REG_REG) { u8 a = regs[preg].GetRegIndex(); ArmCRegs[a].LastLoad = 0; diff --git a/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp b/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp index 79f672dfcdf..d85260d15a3 100644 --- a/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp +++ b/Source/Core/Core/PowerPC/JitArmIL/IR_Arm.cpp @@ -165,7 +165,7 @@ static void regWriteExit(RegInfo& RI, InstLoc dest) { } static void regStoreInstToPPCState(RegInfo& RI, unsigned width, InstLoc I, s32 offset) { void (JitArmIL::*op)(ARMReg, ARMReg, Operand2, bool); - switch(width) + switch (width) { case 32: op = &JitArmIL::STR; diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp index 79e494c063e..2cba2ec3e66 100644 --- a/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL.cpp @@ -81,7 +81,7 @@ void JitArmIL::DoDownCount() ARMReg rB = R12; MOVI2R(rA, (u32)&CoreTiming::downcount); LDR(rB, rA); - if(js.downcountAmount < 255) // We can enlarge this if we used rotations + if (js.downcountAmount < 255) // We can enlarge this if we used rotations { SUBS(rB, rB, js.downcountAmount); STR(rB, rA); @@ -155,19 +155,19 @@ void JitArmIL::PrintDebug(UGeckoInstruction inst, u32 level) printf("\tOuts\n"); if (Info->flags & FL_OUT_A) printf("\t-OUT_A: %x\n", inst.RA); - if(Info->flags & FL_OUT_D) + if (Info->flags & FL_OUT_D) printf("\t-OUT_D: %x\n", inst.RD); printf("\tIns\n"); // A, AO, B, C, S - if(Info->flags & FL_IN_A) + if (Info->flags & FL_IN_A) printf("\t-IN_A: %x\n", inst.RA); - if(Info->flags & FL_IN_A0) + if (Info->flags & FL_IN_A0) printf("\t-IN_A0: %x\n", inst.RA); - if(Info->flags & FL_IN_B) + if (Info->flags & FL_IN_B) printf("\t-IN_B: %x\n", inst.RB); - if(Info->flags & FL_IN_C) + if (Info->flags & FL_IN_C) printf("\t-IN_C: %x\n", inst.RC); - if(Info->flags & FL_IN_S) + if (Info->flags & FL_IN_S) printf("\t-IN_S: %x\n", inst.RS); } } diff --git a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp index 66076725d14..7661a75dae0 100644 --- a/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitArmIL/JitIL_Branch.cpp @@ -116,7 +116,7 @@ void JitArmIL::bcx(UGeckoInstruction inst) IREmitter::InstLoc Test = TestBranch(ibuild, inst); u32 destination; - if(inst.AA) + if (inst.AA) destination = SignExt16(inst.BD << 2); else destination = js.compilerPC + SignExt16(inst.BD << 2); diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp index 285c2182d49..85601cd0c50 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_Branch.cpp @@ -108,7 +108,7 @@ void JitILBase::bcx(UGeckoInstruction inst) IREmitter::InstLoc Test = TestBranch(ibuild, inst); u32 destination; - if(inst.AA) + if (inst.AA) destination = SignExt16(inst.BD << 2); else destination = js.compilerPC + SignExt16(inst.BD << 2); diff --git a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp index 0ec93283cf1..5607e852503 100644 --- a/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitILCommon/JitILBase_LoadStore.cpp @@ -139,7 +139,7 @@ void JitILBase::dcbz(UGeckoInstruction inst) // TODO! #if 0 - if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) + if (Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff) {Default(inst); return;} // turn off from debugger INSTRUCTION_START; MOV(32, R(EAX), gpr.R(inst.RB)); diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index daac26b737e..2b6ea69b7c8 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -46,7 +46,7 @@ namespace JitInterface bMMU = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU; CPUCoreBase *ptr = nullptr; - switch(core) + switch (core) { #if _M_X86 case 1: @@ -85,7 +85,7 @@ namespace JitInterface } void InitTables(int core) { - switch(core) + switch (core) { #if _M_X86 case 1: diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index e5e5911f646..da15e21b251 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -273,7 +273,7 @@ bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const const int wxYES_NO = 0x00000002 | 0x00000008; if (functions.size() == 0) { - if(!AskYesNo(StringFromFormat( + if (!AskYesNo(StringFromFormat( "No symbol names are generated. Do you want to replace '%s' with a blank file?", mapFile.c_str()).c_str(), "Confirm", wxYES_NO)) return false; } diff --git a/Source/Core/Core/PowerPC/PPCTables.cpp b/Source/Core/Core/PowerPC/PPCTables.cpp index db7f645ec1c..f355d590a66 100644 --- a/Source/Core/Core/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/PowerPC/PPCTables.cpp @@ -31,7 +31,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst) if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE) { int table = info->type>>24; - switch(table) + switch (table) { case 4: return m_infoTable4[_inst.SUBOP10]; case 19: return m_infoTable19[_inst.SUBOP10]; @@ -60,7 +60,7 @@ Interpreter::_interpreterInstruction GetInterpreterOp(UGeckoInstruction _inst) if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE) { int table = info->type>>24; - switch(table) + switch (table) { case 4: return Interpreter::m_opTable4[_inst.SUBOP10]; case 19: return Interpreter::m_opTable19[_inst.SUBOP10]; diff --git a/Source/Core/DiscIO/BannerLoaderWii.cpp b/Source/Core/DiscIO/BannerLoaderWii.cpp index 5ca4f5f38e8..7b940fda46e 100644 --- a/Source/Core/DiscIO/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/BannerLoaderWii.cpp @@ -45,21 +45,21 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume) // Creating title folder sprintf(titleFolder, "%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID); - if(!File::Exists(titleFolder)) + if (!File::Exists(titleFolder)) File::CreateFullPath(titleFolder); // Extracting banner.bin from opening.bnr sprintf(bnrFilename, "%stitle/%08x/%08x/data/opening.bnr", File::GetUserPath(D_WIIUSER_IDX).c_str(), (u32)(TitleID>>32), (u32)TitleID); - if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) { + if (!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) { m_IsValid = false; return; } CARCFile bnrArc (bnrFilename, 0x600); - if(!bnrArc.ExportFile("meta/banner.bin", Filename)) { + if (!bnrArc.ExportFile("meta/banner.bin", Filename)) { m_IsValid = false; return; } diff --git a/Source/Core/DiscIO/DriveBlob.cpp b/Source/Core/DiscIO/DriveBlob.cpp index 6785ee0cf4b..361a74abdd4 100644 --- a/Source/Core/DiscIO/DriveBlob.cpp +++ b/Source/Core/DiscIO/DriveBlob.cpp @@ -124,7 +124,7 @@ bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *o } #else fseeko(file_.GetHandle(), m_blocksize*block_num, SEEK_SET); - if(fread(out_ptr, 1, m_blocksize * num_blocks, file_.GetHandle()) != m_blocksize * num_blocks) + if (fread(out_ptr, 1, m_blocksize * num_blocks, file_.GetHandle()) != m_blocksize * num_blocks) return false; #endif return true; diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 5ea4daa6373..6915e325d85 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -336,7 +336,7 @@ const INANDContentLoader& CNANDContentManager::GetNANDLoader(const std::string& { CNANDContentMap::iterator lb = m_Map.lower_bound(_rName); - if(lb == m_Map.end() || (m_Map.key_comp()(_rName, lb->first))) + if (lb == m_Map.end() || (m_Map.key_comp()(_rName, lb->first))) { m_Map.insert(lb, CNANDContentMap::value_type(_rName, new CNANDContentLoader(_rName))); } @@ -367,7 +367,7 @@ bool CNANDContentManager::RemoveTitle(u64 _titleID) void CNANDContentLoader::RemoveTitle() const { INFO_LOG(DISCIO, "RemoveTitle %08x/%08x", (u32)(m_TitleID >> 32), (u32)m_TitleID); - if(IsValid()) + if (IsValid()) { // remove tmd? for (u32 i = 0; i < m_numEntries; i++) diff --git a/Source/Core/DiscIO/VolumeCommon.cpp b/Source/Core/DiscIO/VolumeCommon.cpp index 7a19d9f7d6b..f124a656b90 100644 --- a/Source/Core/DiscIO/VolumeCommon.cpp +++ b/Source/Core/DiscIO/VolumeCommon.cpp @@ -81,7 +81,7 @@ IVolume::ECountry CountrySwitch(u8 CountryCode) u8 GetSysMenuRegion(u16 _TitleVersion) { - switch(_TitleVersion) + switch (_TitleVersion) { case 128: case 192: case 224: case 256: case 288: case 352: case 384: case 416: diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp index a8b350c96ba..53dd7380cc6 100644 --- a/Source/Core/DiscIO/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/VolumeDirectory.cpp @@ -42,7 +42,7 @@ CVolumeDirectory::CVolumeDirectory(const std::string& _rDirectory, bool _bIsWii, SetUniqueID("AGBJ01"); SetName("Default name"); - if(_bIsWii) + if (_bIsWii) { SetDiskTypeWii(); } @@ -92,60 +92,60 @@ bool CVolumeDirectory::RAWRead( u64 _Offset, u64 _Length, u8* _pBuffer ) const bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const { // header - if(_Offset < DISKHEADERINFO_ADDRESS) + if (_Offset < DISKHEADERINFO_ADDRESS) { WriteToBuffer(DISKHEADER_ADDRESS, DISKHEADERINFO_ADDRESS, m_diskHeader, _Offset, _Length, _pBuffer); } // header info - if(_Offset >= DISKHEADERINFO_ADDRESS && _Offset < APPLOADER_ADDRESS) + if (_Offset >= DISKHEADERINFO_ADDRESS && _Offset < APPLOADER_ADDRESS) { WriteToBuffer(DISKHEADERINFO_ADDRESS, sizeof(m_diskHeaderInfo), (u8*)m_diskHeaderInfo, _Offset, _Length, _pBuffer); } // apploader - if(_Offset >= APPLOADER_ADDRESS && _Offset < APPLOADER_ADDRESS + m_apploaderSize) + if (_Offset >= APPLOADER_ADDRESS && _Offset < APPLOADER_ADDRESS + m_apploaderSize) { WriteToBuffer(APPLOADER_ADDRESS, m_apploaderSize, m_apploader, _Offset, _Length, _pBuffer); } // dol - if(_Offset >= DOL_ADDRESS && _Offset < DOL_ADDRESS + m_DOLSize) + if (_Offset >= DOL_ADDRESS && _Offset < DOL_ADDRESS + m_DOLSize) { WriteToBuffer(DOL_ADDRESS, m_DOLSize, m_DOL, _Offset, _Length, _pBuffer); } // fst - if(_Offset >= FST_ADDRESS && _Offset < m_dataStartAddress) + if (_Offset >= FST_ADDRESS && _Offset < m_dataStartAddress) { WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer); } - if(m_virtualDisk.empty()) + if (m_virtualDisk.empty()) return true; // Determine which file the offset refers to std::map::const_iterator fileIter = m_virtualDisk.lower_bound(_Offset); - if(fileIter->first > _Offset && fileIter != m_virtualDisk.begin()) + if (fileIter->first > _Offset && fileIter != m_virtualDisk.begin()) --fileIter; // zero fill to start of file data PadToAddress(fileIter->first, _Offset, _Length, _pBuffer); - while(fileIter != m_virtualDisk.end() && _Length > 0) + while (fileIter != m_virtualDisk.end() && _Length > 0) { _dbg_assert_(DVDINTERFACE, fileIter->first <= _Offset); u64 fileOffset = _Offset - fileIter->first; PlainFileReader* reader = PlainFileReader::Create(fileIter->second.c_str()); - if(reader == nullptr) + if (reader == nullptr) return false; u64 fileSize = reader->GetDataSize(); - if(fileOffset < fileSize) + if (fileOffset < fileSize) { u64 fileBytes = fileSize - fileOffset; - if(_Length < fileBytes) + if (_Length < fileBytes) fileBytes = _Length; - if(!reader->Read(fileOffset, fileBytes, _pBuffer)) + if (!reader->Read(fileOffset, fileBytes, _pBuffer)) return false; _Length -= fileBytes; @@ -155,7 +155,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const ++fileIter; - if(fileIter != m_virtualDisk.end()) + if (fileIter != m_virtualDisk.end()) { _dbg_assert_(DVDINTERFACE, fileIter->first >= _Offset); PadToAddress(fileIter->first, _Offset, _Length, _pBuffer); @@ -184,7 +184,7 @@ void CVolumeDirectory::SetUniqueID(std::string _ID) _dbg_assert_(DVDINTERFACE, m_diskHeader); u32 length = (u32)_ID.length(); - if(length > 6) + if (length > 6) length = 6; memcpy(m_diskHeader, _ID.c_str(), length); @@ -215,8 +215,8 @@ void CVolumeDirectory::SetName(std::string _Name) _dbg_assert_(DVDINTERFACE, m_diskHeader); u32 length = (u32)_Name.length(); - if(length > MAX_NAME_LENGTH) - length = MAX_NAME_LENGTH; + if (length > MAX_NAME_LENGTH) + length = MAX_NAME_LENGTH; memcpy(m_diskHeader + 0x20, _Name.c_str(), length); m_diskHeader[length + 0x20] = 0; @@ -248,13 +248,13 @@ std::string CVolumeDirectory::ExtractDirectoryName(const std::string& _rDirector size_t lastSep = directoryName.find_last_of(DIR_SEP_CHR); - if(lastSep != directoryName.size() - 1) + if (lastSep != directoryName.size() - 1) { // TODO: This assumes that file names will always have a dot in them // and directory names never will; both assumptions are often // right but in general wrong. size_t extensionStart = directoryName.find_last_of('.'); - if(extensionStart != std::string::npos && extensionStart > lastSep) + if (extensionStart != std::string::npos && extensionStart > lastSep) { directoryName.resize(lastSep); } @@ -345,7 +345,7 @@ void CVolumeDirectory::SetDOL(const std::string& _rDOL) void CVolumeDirectory::BuildFST() { - if(m_FSTData) + if (m_FSTData) { delete m_FSTData; } @@ -374,7 +374,7 @@ void CVolumeDirectory::BuildFST() // write root entry WriteEntryData(fstOffset, DIRECTORY_ENTRY, 0, 0, totalEntries); - for(auto& entry : rootEntry.children) + for (auto& entry : rootEntry.children) { WriteEntry(entry, fstOffset, nameOffset, curDataAddress, rootOffset); } @@ -392,17 +392,17 @@ void CVolumeDirectory::BuildFST() void CVolumeDirectory::WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _Src, u64& _Address, u64& _Length, u8*& _pBuffer) const { - if(_Length == 0) + if (_Length == 0) return; _dbg_assert_(DVDINTERFACE, _Address >= _SrcStartAddress); u64 srcOffset = _Address - _SrcStartAddress; - if(srcOffset < _SrcLength) + if (srcOffset < _SrcLength) { u64 srcBytes = _SrcLength - srcOffset; - if(_Length < srcBytes) + if (_Length < srcBytes) srcBytes = _Length; memcpy(_pBuffer, _Src + srcOffset, (size_t)srcBytes); @@ -415,14 +415,14 @@ void CVolumeDirectory::WriteToBuffer(u64 _SrcStartAddress, u64 _SrcLength, u8* _ void CVolumeDirectory::PadToAddress(u64 _StartAddress, u64& _Address, u64& _Length, u8*& _pBuffer) const { - if(_StartAddress <= _Address) + if (_StartAddress <= _Address) return; u64 padBytes = _StartAddress - _Address; - if(padBytes > _Length) + if (padBytes > _Length) padBytes = _Length; - if(_Length > 0) + if (_Length > 0) { memset(_pBuffer, 0, (size_t)padBytes); _Length -= padBytes; @@ -463,14 +463,14 @@ void CVolumeDirectory::WriteEntryName(u32& nameOffset, const std::string& name) void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u32& nameOffset, u64& dataOffset, u32 parentEntryNum) { - if(entry.isDirectory) + if (entry.isDirectory) { u32 myOffset = fstOffset; u32 myEntryNum = myOffset / ENTRY_SIZE; WriteEntryData(fstOffset, DIRECTORY_ENTRY, nameOffset, parentEntryNum, (u32)(myEntryNum + entry.size + 1)); WriteEntryName(nameOffset, entry.virtualName); - for(const auto& child : entry.children) + for (const auto& child : entry.children) { WriteEntry(child, fstOffset, nameOffset, dataOffset, myEntryNum); } diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 7dd34c96629..0277156cb1d 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -66,7 +66,7 @@ std::string CVolumeWAD::GetUniqueID() const u32 Offset = ALIGN_40(hdr_size) + ALIGN_40(cert_size); char GameCode[8]; - if(!Read(Offset + 0x01E0, 4, (u8*)GameCode)) + if (!Read(Offset + 0x01E0, 4, (u8*)GameCode)) return "0"; GameCode[4] = temp.at(0); @@ -94,7 +94,7 @@ bool CVolumeWAD::GetTitleID(u8* _pBuffer) const { u32 Offset = ALIGN_40(hdr_size) + ALIGN_40(cert_size); - if(!Read(Offset + 0x01DC, 8, _pBuffer)) + if (!Read(Offset + 0x01DC, 8, _pBuffer)) return false; return true; diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp index 0a095cf1908..4b93244f83e 100644 --- a/Source/Core/DiscIO/WbfsBlob.cpp +++ b/Source/Core/DiscIO/WbfsBlob.cpp @@ -26,7 +26,7 @@ static inline u64 align(u64 value, u64 bounds) WbfsFileReader::WbfsFileReader(const char* filename) : m_total_files(0), m_size(0), m_wlba_table(nullptr), m_good(true) { - if(!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader()) + if (!filename || (strlen(filename) < 4) || !OpenFiles(filename) || !ReadHeader()) { m_good = false; return; @@ -40,7 +40,7 @@ WbfsFileReader::WbfsFileReader(const char* filename) WbfsFileReader::~WbfsFileReader() { - for(u32 i = 0; i != m_files.size(); ++ i) + for (u32 i = 0; i != m_files.size(); ++ i) { delete m_files[i]; } @@ -52,18 +52,18 @@ bool WbfsFileReader::OpenFiles(const char* filename) { m_total_files = 0; - while(true) + while (true) { file_entry* new_entry = new file_entry; // Replace last character with index (e.g. wbfs = wbf1) std::string path = filename; - if(0 != m_total_files) + if (0 != m_total_files) { path[path.length() - 1] = '0' + m_total_files; } - if(!new_entry->file.Open(path, "rb")) + if (!new_entry->file.Open(path, "rb")) { delete new_entry; return 0 != m_total_files; @@ -89,7 +89,7 @@ bool WbfsFileReader::ReadHeader() m_files[0]->file.ReadBytes(&hd_sector_shift, 1); hd_sector_size = 1ull << hd_sector_shift; - if(m_size != hd_sector_count * hd_sector_size) + if (m_size != hd_sector_count * hd_sector_size) { //printf("File size doesn't match expected size\n"); return false; @@ -100,7 +100,7 @@ bool WbfsFileReader::ReadHeader() wbfs_sector_size = 1ull << wbfs_sector_shift; wbfs_sector_count = m_size / wbfs_sector_size; - if(wbfs_sector_size < wii_sector_size) + if (wbfs_sector_size < wii_sector_size) { //Setting this too low would case a very large memory allocation return false; @@ -113,7 +113,7 @@ bool WbfsFileReader::ReadHeader() m_files[0]->file.Seek(2, SEEK_CUR); m_files[0]->file.ReadBytes(disc_table, 500); - if(0 == disc_table[0]) + if (0 == disc_table[0]) { //printf("Game must be in 'slot 0'\n"); return false; @@ -124,7 +124,7 @@ bool WbfsFileReader::ReadHeader() bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr) { - while(nbytes) + while (nbytes) { u64 read_size = 0; File::IOFile& data_file = SeekToCluster(offset, &read_size); @@ -143,18 +143,18 @@ bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr) File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available) { u64 base_cluster = offset >> wbfs_sector_shift; - if(base_cluster < m_blocks_per_disc) + if (base_cluster < m_blocks_per_disc) { u64 cluster_address = wbfs_sector_size * Common::swap16(m_wlba_table[base_cluster]); u64 cluster_offset = offset & (wbfs_sector_size - 1); u64 final_address = cluster_address + cluster_offset; - for(u32 i = 0; i != m_total_files; i ++) + for (u32 i = 0; i != m_total_files; i ++) { - if(final_address < (m_files[i]->base_address + m_files[i]->size)) + if (final_address < (m_files[i]->base_address + m_files[i]->size)) { m_files[i]->file.Seek(final_address - m_files[i]->base_address, SEEK_SET); - if(available) + if (available) { u64 till_end_of_file = m_files[i]->size - (final_address - m_files[i]->base_address); u64 till_end_of_sector = wbfs_sector_size - cluster_offset; @@ -175,7 +175,7 @@ WbfsFileReader* WbfsFileReader::Create(const char* filename) { WbfsFileReader* reader = new WbfsFileReader(filename); - if(reader->IsGood()) + if (reader->IsGood()) { return reader; } diff --git a/Source/Core/DiscIO/WiiWad.cpp b/Source/Core/DiscIO/WiiWad.cpp index 5f1f7be37d1..48e40a4b685 100644 --- a/Source/Core/DiscIO/WiiWad.cpp +++ b/Source/Core/DiscIO/WiiWad.cpp @@ -38,7 +38,7 @@ WiiWAD::WiiWAD(const std::string& _rName) if (pReader == nullptr || File::IsDirectory(_rName)) { m_Valid = false; - if(pReader) delete pReader; + if (pReader) delete pReader; return; } @@ -131,7 +131,7 @@ bool WiiWAD::IsWiiWAD(const std::string& _rName) if (Reader.Read32(0x00) == 0x20) { u32 WADTYpe = Reader.Read32(0x04); - switch(WADTYpe) + switch (WADTYpe) { case 0x49730000: case 0x69620000: diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp index dcac8846977..a504ced08c3 100644 --- a/Source/Core/DolphinWX/ConfigMain.cpp +++ b/Source/Core/DolphinWX/ConfigMain.cpp @@ -203,7 +203,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, CreateGUIControls(); // Update selected ISO paths - for(const std::string& folder : SConfig::GetInstance().m_ISOFolder) + for (const std::string& folder : SConfig::GetInstance().m_ISOFolder) { ISOPaths->Append(StrToWxStr(folder)); } @@ -228,7 +228,7 @@ void CConfigMain::SetSelectedTab(int tab) // Used to restrict changing of some options while emulator is running void CConfigMain::UpdateGUI() { - if(Core::GetState() != Core::CORE_UNINITIALIZED) + if (Core::GetState() != Core::CORE_UNINITIALIZED) { // Disable the Core stuff on GeneralPage CPUThread->Disable(); @@ -1195,7 +1195,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event) int wii_system_lang = WiiSystemLang->GetSelection(); SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang); u8 country_code = GetSADRCountryCode(wii_system_lang); - if(!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1)) + if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1)) { PanicAlert("Failed to update country code in SYSCONF"); } diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index 3e1596e8fad..0d8ce7042ec 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -184,9 +184,9 @@ void CCodeView::InsertBlrNop(int Blr) { // Check if this address has been modified int find = -1; - for(u32 i = 0; i < BlrList.size(); i++) + for (u32 i = 0; i < BlrList.size(); i++) { - if(BlrList.at(i).Address == selection) + if (BlrList.at(i).Address == selection) { find = i; break; diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp index 1add1c96007..ef76d59424c 100644 --- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp @@ -207,7 +207,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) } wxString OpenCommand; OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename)); - if(!OpenCommand.IsEmpty()) + if (!OpenCommand.IsEmpty()) wxExecute(OpenCommand, wxEXEC_SYNC); } } @@ -227,7 +227,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) switch (event.GetId()) { case IDM_CLEARSYMBOLS: - if(!AskYesNo("Do you want to clear the list of symbol names?")) return; + if (!AskYesNo("Do you want to clear the list of symbol names?")) return; g_symbolDB.Clear(); Host_NotifyMapLoaded(); break; @@ -381,9 +381,9 @@ void CCodeWindow::OnSymbolListChange(wxCommandEvent& event) Symbol* pSymbol = static_cast(symbols->GetClientData(index)); if (pSymbol != nullptr) { - if(pSymbol->type == Symbol::SYMBOL_DATA) + if (pSymbol->type == Symbol::SYMBOL_DATA) { - if(m_MemoryWindow)// && m_MemoryWindow->IsVisible()) + if (m_MemoryWindow)// && m_MemoryWindow->IsVisible()) m_MemoryWindow->JumpToAddress(pSymbol->address); } else diff --git a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp index 2b16e4baf3c..333438773dc 100644 --- a/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp +++ b/Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp @@ -83,9 +83,10 @@ void GFXDebuggerPanel::SaveSettings() const // weird values, perhaps because of some conflict with the rendering window // TODO: get the screen resolution and make limits from that - if (GetPosition().x < 1000 && GetPosition().y < 1000 - && GetSize().GetWidth() < 1000 - && GetSize().GetHeight() < 1000) + if (GetPosition().x < 1000 && + GetPosition().y < 1000 && + GetSize().GetWidth() < 1000 && + GetSize().GetHeight() < 1000) { file.Set("VideoWindow", "x", GetPosition().x); file.Set("VideoWindow", "y", GetPosition().y); diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 5aedae6e689..217d94ab6c2 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -130,7 +130,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, void CMemoryWindow::Save(IniFile& _IniFile) const { // Prevent these bad values that can happen after a crash or hanging - if(GetPosition().x != -32000 && GetPosition().y != -32000) + if (GetPosition().x != -32000 && GetPosition().y != -32000) { _IniFile.Set("MemoryWindow", "x", GetPosition().x); _IniFile.Set("MemoryWindow", "y", GetPosition().y); @@ -356,7 +356,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) strcat(tmpstr, WxStrToStr(rawData).c_str()); tmp2 = &Dest.front(); count = 0; - for(i = 0; i < strlen(tmpstr); i++) + for (i = 0; i < strlen(tmpstr); i++) { copy[0] = tmpstr[i]; copy[1] = tmpstr[i+1]; @@ -381,13 +381,13 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) tmp2 = &Dest.front(); sprintf(tmpstr, "%s", WxStrToStr(rawData).c_str()); - for(i = 0; i < size; i++) + for (i = 0; i < size; i++) tmp2[i] = tmpstr[i]; delete[] tmpstr; } - if(size) + if (size) { unsigned char* pnt = &Dest.front(); unsigned int k = 0; @@ -399,19 +399,19 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); } i = addr+4; - for( ; i < szRAM; i++) + for ( ; i < szRAM; ++i) { - for(k = 0; k < size; k++) + for (k = 0; k < size; ++k) { - if(i + k > szRAM) break; - if(k > size) break; - if(pnt[k] != TheRAM[i+k]) + if (i + k > szRAM) break; + if (k > size) break; + if (pnt[k] != TheRAM[i+k]) { k = 0; break; } } - if(k == size) + if (k == size) { //Match was found wxMessageBox(_("A match was found. Placing viewer at the offset.")); diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 8e3a6ea86c1..c7134167cf7 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -105,7 +105,7 @@ CPanel::CPanel( switch (nMsg) { case WM_USER: - switch(wParam) + switch (wParam) { case WM_USER_STOP: main_frame->DoStop(); @@ -497,7 +497,7 @@ void CFrame::OnClose(wxCloseEvent& event) } //Stop Dolphin from saving the minimized Xpos and Ypos - if(main_frame->IsIconized()) + if (main_frame->IsIconized()) main_frame->Iconize(false); // Don't forget the skip or the window won't be destroyed @@ -873,8 +873,8 @@ bool TASInputHasFocus() void CFrame::OnKeyDown(wxKeyEvent& event) { - if(Core::GetState() != Core::CORE_UNINITIALIZED && - (RendererHasFocus() || TASInputHasFocus())) + if (Core::GetState() != Core::CORE_UNINITIALIZED && + (RendererHasFocus() || TASInputHasFocus())) { int WiimoteId = -1; // Toggle fullscreen @@ -1045,7 +1045,7 @@ void CFrame::OnMouse(wxMouseEvent& event) #if defined(HAVE_X11) && HAVE_X11 if (Core::GetState() != Core::CORE_UNINITIALIZED) { - if(event.Dragging()) + if (event.Dragging()) X11Utils::SendMotionEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetPosition().x, event.GetPosition().y); else @@ -1055,7 +1055,7 @@ void CFrame::OnMouse(wxMouseEvent& event) #endif // next handlers are all for FreeLook, so we don't need to check them if disabled - if(!g_Config.bFreeLook) + if (!g_Config.bFreeLook) { event.Skip(); return; @@ -1066,28 +1066,28 @@ void CFrame::OnMouse(wxMouseEvent& event) static bool mouseMoveEnabled = false; static float lastMouse[2]; - if(event.MiddleDown()) + if (event.MiddleDown()) { lastMouse[0] = event.GetX(); lastMouse[1] = event.GetY(); mouseMoveEnabled = true; } - else if(event.RightDown()) + else if (event.RightDown()) { lastMouse[0] = event.GetX(); lastMouse[1] = event.GetY(); mouseLookEnabled = true; } - else if(event.MiddleUp()) + else if (event.MiddleUp()) { mouseMoveEnabled = false; } - else if(event.RightUp()) + else if (event.RightUp()) { mouseLookEnabled = false; } // no button, so it's a move event - else if(event.GetButton() == wxMOUSE_BTN_NONE) + else if (event.GetButton() == wxMOUSE_BTN_NONE) { if (mouseLookEnabled) { diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp index 4845083c392..ba7ae551866 100644 --- a/Source/Core/DolphinWX/FrameAui.cpp +++ b/Source/Core/DolphinWX/FrameAui.cpp @@ -163,7 +163,7 @@ void CFrame::OnToggleWindow(wxCommandEvent& event) { bool bShow = GetMenuBar()->IsChecked(event.GetId()); - switch(event.GetId()) + switch (event.GetId()) { case IDM_LOGWINDOW: if (!g_pCodeWindow) @@ -228,7 +228,7 @@ void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event) // Update the notebook affiliation for (int i = IDM_LOGWINDOW; i <= IDM_CODEWINDOW; i++) { - if(GetNotebookAffiliation(i) >= 0) + if (GetNotebookAffiliation(i) >= 0) g_pCodeWindow->iNbAffiliation[i - IDM_LOGWINDOW] = GetNotebookAffiliation(i); } } @@ -596,7 +596,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event) { ClearStatusBar(); - switch(event.GetId()) + switch (event.GetId()) { case IDM_ADD_PERSPECTIVE: { @@ -693,7 +693,7 @@ void CFrame::TogglePaneStyle(bool On, int EventId) Pane.PinButton(true); Pane.Show(); - switch(EventId) + switch (EventId) { case IDM_EDIT_PERSPECTIVES: Pane.CaptionVisible(On); @@ -977,7 +977,7 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id) continue; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; - for(u32 j = 0; j < NB->GetPageCount(); j++) + for (u32 j = 0; j < NB->GetPageCount(); j++) { if (NB->GetPage(j)->GetId() == Id) return NB->GetPage(j); @@ -1024,7 +1024,7 @@ void CFrame::AddRemoveBlankPage() continue; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; - for(u32 j = 0; j < NB->GetPageCount(); j++) + for (u32 j = 0; j < NB->GetPageCount(); j++) { if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) NB->DeletePage(j); @@ -1043,7 +1043,7 @@ int CFrame::GetNotebookAffiliation(wxWindowID Id) continue; wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window; - for(u32 k = 0; k < NB->GetPageCount(); k++) + for (u32 k = 0; k < NB->GetPageCount(); k++) { if (NB->GetPage(k)->GetId() == Id) return j; diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index a2a5c413308..7b55249af60 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -175,7 +175,7 @@ void CFrame::CreateMenu() wxMenu *skippingMenu = new wxMenu; emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping")); - for(int i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(wxT("%i"), i), wxEmptyString, wxITEM_RADIO); skippingMenu->Check(IDM_FRAMESKIP0 + SConfig::GetInstance().m_FrameSkip, true); Movie::SetFrameSkipping(SConfig::GetInstance().m_FrameSkip); @@ -613,15 +613,15 @@ void CFrame::BootGame(const std::string& filename) if (m_GameListCtrl->GetSelectedISO()->IsValid()) bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName(); } - else if (!StartUp.m_strDefaultGCM.empty() - && wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str()))) + else if (!StartUp.m_strDefaultGCM.empty() && + wxFileExists(wxSafeConvertMB2WX(StartUp.m_strDefaultGCM.c_str()))) { bootfile = StartUp.m_strDefaultGCM; } else { - if (!SConfig::GetInstance().m_LastFilename.empty() - && wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str()))) + if (!SConfig::GetInstance().m_LastFilename.empty() && + wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str()))) { bootfile = SConfig::GetInstance().m_LastFilename; } @@ -716,7 +716,7 @@ void CFrame::OnFrameStep(wxCommandEvent& event) Movie::DoFrameStep(); bool isPaused = (Core::GetState() == Core::CORE_PAUSE); - if(isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when pausing next frame + if (isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when pausing next frame UpdateGUI(); } @@ -747,7 +747,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event)) controllers |= (1 << (i + 4)); } - if(Movie::BeginRecordingInput(controllers)) + if (Movie::BeginRecordingInput(controllers)) BootGame(std::string("")); } @@ -761,7 +761,7 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event)) wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, this); - if(path.IsEmpty()) + if (path.IsEmpty()) return; if (!Movie::IsReadOnly()) @@ -878,7 +878,7 @@ void CFrame::ToggleDisplayMode(bool bFullscreen) if (SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution != "Auto") m_XRRConfig->ToggleDisplayMode(bFullscreen); #elif defined __APPLE__ - if(bFullscreen) + if (bFullscreen) CGDisplayHideCursor(CGMainDisplayID()); else CGDisplayShowCursor(CGMainDisplayID()); @@ -1089,9 +1089,9 @@ void CFrame::DoStop() } // TODO: Show the author/description dialog here - if(Movie::IsRecordingInput()) + if (Movie::IsRecordingInput()) DoRecordingSave(); - if(Movie::IsPlayingInput() || Movie::IsRecordingInput()) + if (Movie::IsPlayingInput() || Movie::IsRecordingInput()) Movie::EndPlayInput(false); NetPlay::StopGame(); @@ -1180,7 +1180,7 @@ void CFrame::DoRecordingSave() wxFD_SAVE | wxFD_PREVIEW | wxFD_OVERWRITE_PROMPT, this); - if(path.IsEmpty()) + if (path.IsEmpty()) return; Movie::SaveRecording(WxStrToStr(path).c_str()); @@ -1392,7 +1392,7 @@ void CFrame::OnInstallWAD(wxCommandEvent& event) { std::string fileName; - switch(event.GetId()) + switch (event.GetId()) { case IDM_LIST_INSTALLWAD: { @@ -1709,8 +1709,8 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(true); } // Prepare to load last selected file, enable play button - else if (!SConfig::GetInstance().m_LastFilename.empty() - && wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str()))) + else if (!SConfig::GetInstance().m_LastFilename.empty() && + wxFileExists(wxSafeConvertMB2WX(SConfig::GetInstance().m_LastFilename.c_str()))) { if (m_ToolBar) m_ToolBar->EnableTool(IDM_PLAY, true); diff --git a/Source/Core/DolphinWX/GLInterface/AGL.cpp b/Source/Core/DolphinWX/GLInterface/AGL.cpp index 09724de80ca..9d295cb5035 100644 --- a/Source/Core/DolphinWX/GLInterface/AGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/AGL.cpp @@ -97,8 +97,8 @@ void cInterfaceAGL::Update() size.width *= scale; size.height *= scale; - if( s_backbuffer_width == size.width - && s_backbuffer_height == size.height) + if (s_backbuffer_width == size.width && + s_backbuffer_height == size.height) return; s_backbuffer_width = size.width; diff --git a/Source/Core/DolphinWX/GLInterface/EGL.cpp b/Source/Core/DolphinWX/GLInterface/EGL.cpp index 20db6169210..4ad45005a1f 100644 --- a/Source/Core/DolphinWX/GLInterface/EGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/EGL.cpp @@ -93,7 +93,7 @@ bool cInterfaceEGL::Create(void *&window_handle) const char *s; EGLint egl_major, egl_minor; - if(!Platform.SelectDisplay()) + if (!Platform.SelectDisplay()) return false; GLWin.egl_dpy = Platform.EGLGetDisplay(); @@ -131,7 +131,7 @@ bool cInterfaceEGL::Create(void *&window_handle) EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; - switch(s_opengl_mode) + switch (s_opengl_mode) { case MODE_OPENGL: attribs[1] = EGL_OPENGL_BIT; @@ -212,11 +212,11 @@ void cInterfaceEGL::Shutdown() if (GLWin.egl_ctx) { eglMakeCurrent(GLWin.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if(!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx)) + if (!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx)) NOTICE_LOG(VIDEO, "Could not destroy drawing context."); - if(!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf)) + if (!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf)) NOTICE_LOG(VIDEO, "Could not destroy window surface."); - if(!eglTerminate(GLWin.egl_dpy)) + if (!eglTerminate(GLWin.egl_dpy)) NOTICE_LOG(VIDEO, "Could not destroy display connection."); GLWin.egl_ctx = nullptr; } diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp index 93e510af656..24534787f59 100644 --- a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp +++ b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp @@ -161,7 +161,7 @@ void cX11Window::XEventThread() for (int num_events = XPending(GLWin.evdpy); num_events > 0; num_events--) { XNextEvent(GLWin.evdpy, &event); - switch(event.type) { + switch (event.type) { case ConfigureNotify: GLInterface->SetBackBufferDimensions(event.xconfigure.width, event.xconfigure.height); break; diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp index 25212818a9b..3ff0055948e 100644 --- a/Source/Core/DolphinWX/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/GameListCtrl.cpp @@ -120,7 +120,7 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is indexOther = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; } - switch(sortData) + switch (sortData) { case CGameListCtrl::COLUMN_TITLE: if (!strcasecmp(iso1->GetName(indexOne).c_str(),iso2->GetName(indexOther).c_str())) @@ -143,9 +143,9 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is return strcasecmp(cmp1.c_str(), cmp2.c_str()) * t; } case CGameListCtrl::COLUMN_COUNTRY: - if(iso1->GetCountry() > iso2->GetCountry()) + if (iso1->GetCountry() > iso2->GetCountry()) return 1 * t; - if(iso1->GetCountry() < iso2->GetCountry()) + if (iso1->GetCountry() < iso2->GetCountry()) return -1 * t; return 0; case CGameListCtrl::COLUMN_SIZE: @@ -155,9 +155,9 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is return -1 * t; return 0; case CGameListCtrl::COLUMN_PLATFORM: - if(iso1->GetPlatform() > iso2->GetPlatform()) + if (iso1->GetPlatform() > iso2->GetPlatform()) return 1 * t; - if(iso1->GetPlatform() < iso2->GetPlatform()) + if (iso1->GetPlatform() < iso2->GetPlatform()) return -1 * t; return 0; @@ -471,7 +471,7 @@ wxColour blend50(const wxColour& c1, const wxColour& c2) void CGameListCtrl::SetBackgroundColor() { - for(long i = 0; i < GetItemCount(); i++) + for (long i = 0; i < GetItemCount(); i++) { wxColour color = (i & 1) ? blend50(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), @@ -564,7 +564,7 @@ void CGameListCtrl::ScanForISOs() { bool list = true; - switch(ISOFile.GetPlatform()) + switch (ISOFile.GetPlatform()) { case GameListItem::WII_DISC: if (!SConfig::GetInstance().m_ListWii) @@ -580,7 +580,7 @@ void CGameListCtrl::ScanForISOs() break; } - switch(ISOFile.GetCountry()) + switch (ISOFile.GetCountry()) { case DiscIO::IVolume::COUNTRY_TAIWAN: if (!SConfig::GetInstance().m_ListTaiwan) @@ -665,7 +665,7 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData) void CGameListCtrl::OnColumnClick(wxListEvent& event) { - if(event.GetColumn() != COLUMN_BANNER) + if (event.GetColumn() != COLUMN_BANNER) { int current_column = event.GetColumn(); if (sorted) @@ -876,7 +876,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) popupMenu->AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO")); // First we have to decide a starting value when we append it - if(selected_iso->GetFileName() == SConfig::GetInstance(). + if (selected_iso->GetFileName() == SConfig::GetInstance(). m_LocalCoreStartupParameter.m_strDefaultGCM) popupMenu->FindItem(IDM_SETDEFAULTGCM)->Check(); @@ -887,8 +887,8 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event) { if (selected_iso->IsCompressed()) popupMenu->Append(IDM_COMPRESSGCM, _("Decompress ISO...")); - else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso" - && selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs") + else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso" && + selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs") popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO...")); } else @@ -1039,7 +1039,7 @@ void CGameListCtrl::OnProperties(wxCommandEvent& WXUNUSED (event)) return; CISOProperties ISOProperties(iso->GetFileName(), this); - if(ISOProperties.ShowModal() == wxID_OK) + if (ISOProperties.ShowModal() == wxID_OK) Update(); } diff --git a/Source/Core/DolphinWX/HotkeyDlg.cpp b/Source/Core/DolphinWX/HotkeyDlg.cpp index 7ec75a3327e..87f7f2a3bc8 100644 --- a/Source/Core/DolphinWX/HotkeyDlg.cpp +++ b/Source/Core/DolphinWX/HotkeyDlg.cpp @@ -75,7 +75,7 @@ void HotkeyConfigDialog::EndGetButtons(void) void HotkeyConfigDialog::OnKeyDown(wxKeyEvent& event) { - if(ClickedButton != nullptr) + if (ClickedButton != nullptr) { // Save the key g_Pressed = event.GetKeyCode(); @@ -136,9 +136,9 @@ void HotkeyConfigDialog::DoGetButtons(int _GetId) const int TimesPerSecond = 40; // How often to run the check // If the Id has changed or the timer is not running we should start one - if( GetButtonWaitingID != _GetId || !m_ButtonMappingTimer->IsRunning() ) + if ( GetButtonWaitingID != _GetId || !m_ButtonMappingTimer->IsRunning() ) { - if(m_ButtonMappingTimer->IsRunning()) + if (m_ButtonMappingTimer->IsRunning()) m_ButtonMappingTimer->Stop(); // Save the button Id diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 75b743fd670..a461389cd1f 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -169,7 +169,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW { char tmp[17]; u8 _tTitleID[8]; - if(OpenISO->GetTitleID(_tTitleID)) + if (OpenISO->GetTitleID(_tTitleID)) { snprintf(tmp, 17, "%016" PRIx64, Common::swap64(_tTitleID)); _iniFilename = tmp; @@ -330,7 +330,7 @@ size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent, char *itemName = strrchr(name, DIR_SEP_CHR); - if(!itemName) + if (!itemName) itemName = name; else itemName++; @@ -678,8 +678,8 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event) wxMenu* popupMenu = new wxMenu; - if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 - && m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) + if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 && + m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) { popupMenu->Append(IDM_EXTRACTDIR, _("Extract Partition...")); } @@ -694,8 +694,8 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event) popupMenu->Append(IDM_EXTRACTALL, _("Extract All Files...")); - if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 - && m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) + if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 && + m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) { popupMenu->AppendSeparator(); popupMenu->Append(IDM_EXTRACTAPPLOADER, _("Extract Apploader...")); @@ -772,7 +772,7 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde } else // Look for the dir we are going to extract { - for(index[0] = 0; index[0] < fst.size(); index[0]++) + for (index[0] = 0; index[0] < fst.size(); index[0]++) { if (!strcmp(fst.at(index[0])->m_FullPath, _rFullPath)) { @@ -896,7 +896,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event) std::size_t partitionNum = (std::size_t)wxAtoi(Directory.Mid(Directory.find_first_of("/"), 1)); Directory.Remove(0, Directory.find_first_of("/") +1); // Remove "Partition x/" - if(WiiDisc.size() > partitionNum) + if (WiiDisc.size() > partitionNum) { // Get the filesystem of the LAST partition FS = WiiDisc.at(partitionNum).FileSystem; @@ -1153,10 +1153,10 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename) withApplication: @"TextEdit"]; #else wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_T("ini")); - if(filetype == nullptr) // From extension failed, trying with MIME type now + if (filetype == nullptr) // From extension failed, trying with MIME type now { filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType(_T("text/plain")); - if(filetype == nullptr) // MIME type failed, aborting mission + if (filetype == nullptr) // MIME type failed, aborting mission { PanicAlertT("Filetype 'ini' is unknown! Will not open!"); return; @@ -1164,10 +1164,10 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename) } wxString OpenCommand; OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename)); - if(OpenCommand.IsEmpty()) + if (OpenCommand.IsEmpty()) PanicAlertT("Couldn't find open command for extension 'ini'!"); else - if(wxExecute(OpenCommand, wxEXEC_SYNC) == -1) + if (wxExecute(OpenCommand, wxEXEC_SYNC) == -1) PanicAlertT("wxExecute returned -1 on application run!"); #endif @@ -1201,8 +1201,8 @@ void CISOProperties::ListSelectionChanged(wxCommandEvent& event) switch (event.GetId()) { case ID_PATCHES_LIST: - if (Patches->GetSelection() == wxNOT_FOUND - || DefaultPatches.find(Patches->GetString(Patches->GetSelection()).ToStdString()) != DefaultPatches.end()) + if (Patches->GetSelection() == wxNOT_FOUND || + DefaultPatches.find(Patches->GetString(Patches->GetSelection()).ToStdString()) != DefaultPatches.end()) { EditPatch->Disable(); RemovePatch->Disable(); @@ -1214,8 +1214,8 @@ void CISOProperties::ListSelectionChanged(wxCommandEvent& event) } break; case ID_CHEATS_LIST: - if (Cheats->GetSelection() == wxNOT_FOUND - || DefaultCheats.find(Cheats->GetString(Cheats->GetSelection()).ToStdString()) != DefaultCheats.end()) + if (Cheats->GetSelection() == wxNOT_FOUND || + DefaultCheats.find(Cheats->GetString(Cheats->GetSelection()).ToStdString()) != DefaultCheats.end()) { EditCheat->Disable(); RemoveCheat->Disable(); diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 7679f6f2dce..454512cefea 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -424,7 +424,7 @@ void DolphinApp::InitLanguageSupport() ini.Get("Interface", "Language", &language, wxLANGUAGE_DEFAULT); // Load language if possible, fall back to system default otherwise - if(wxLocale::IsAvailable(language)) + if (wxLocale::IsAvailable(language)) { m_locale = new wxLocale(language); @@ -434,7 +434,7 @@ void DolphinApp::InitLanguageSupport() m_locale->AddCatalog(wxT("dolphin-emu")); - if(!m_locale->IsOk()) + if (!m_locale->IsOk()) { PanicAlertT("Error loading selected language. Falling back to system default."); delete m_locale; @@ -688,7 +688,7 @@ void Host_SetWiiMoteConnectionState(int _State) wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR); - switch(_State) + switch (_State) { case 0: event.SetString(_("Not connected")); break; case 1: event.SetString(_("Connecting...")); break; diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index ffb3522eae0..04406f32f3d 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -178,7 +178,7 @@ void X11_MainLoop() for (int num_events = XPending(dpy); num_events > 0; num_events--) { XNextEvent(dpy, &event); - switch(event.type) + switch (event.type) { case KeyPress: key = XLookupKeysym((XKeyEvent*)&event, 0); @@ -269,7 +269,7 @@ void X11_MainLoop() void Wayland_MainLoop() { // Wait for display to be initialized - while(!GLWin.wl_display) + while (!GLWin.wl_display) usleep(20000); GLWin.running = 1; diff --git a/Source/Core/DolphinWX/MemcardManager.cpp b/Source/Core/DolphinWX/MemcardManager.cpp index 80b92dfd6d0..1aecc2d9e19 100644 --- a/Source/Core/DolphinWX/MemcardManager.cpp +++ b/Source/Core/DolphinWX/MemcardManager.cpp @@ -165,7 +165,7 @@ bool CMemcardManager::LoadSettings() mcmSettings.column[NUMBER_OF_COLUMN] = false; - for(int i = COLUMN_GAMECODE; i < NUMBER_OF_COLUMN; i++) + for (int i = COLUMN_GAMECODE; i < NUMBER_OF_COLUMN; i++) { mcmSettings.column[i] = mcmSettings.column[NUMBER_OF_COLUMN]; } @@ -300,7 +300,7 @@ void CMemcardManager::ChangePath(int slot) } if (!m_MemcardPath[SLOT_A]->GetPath().CmpNoCase(m_MemcardPath[SLOT_B]->GetPath())) { - if(m_MemcardPath[slot]->GetPath().length()) + if (m_MemcardPath[slot]->GetPath().length()) PanicAlertT("Memcard already opened"); } else @@ -384,7 +384,7 @@ void CMemcardManager::OnPageChange(wxCommandEvent& event) void CMemcardManager::OnMenuChange(wxCommandEvent& event) { int _id = event.GetId(); - switch(_id) + switch (_id) { case ID_MEMCARDPATH_A: case ID_MEMCARDPATH_B: @@ -601,8 +601,8 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) SplitPath(mpath, &path1, &path2, nullptr); path1 += path2; File::CreateDir(path1); - if(PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n" - "%s\nand have the same name as a file on your memcard\nContinue?", path1.c_str())) + if (PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n" + "%s\nand have the same name as a file on your memcard\nContinue?", path1.c_str())) for (int i = 0; i < DIRLEN; i++) { CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, nullptr, path1), -1); diff --git a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp index cf5949d5c6f..7928ae33f07 100644 --- a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp @@ -303,7 +303,7 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() FileHDR _tmpFileHDR; - for(u32 i = 0; i < _numberOfFiles; i++) + for (u32 i = 0; i < _numberOfFiles; i++) { memset(&_tmpFileHDR, 0, FILE_HDR_SZ); memset(IV, 0, 0x10); @@ -365,7 +365,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles() { if (!b_valid) return; - for(u32 i = 0; i < _numberOfFiles; i++) + for (u32 i = 0; i < _numberOfFiles; i++) { FileHDR tmpFileHDR; std::string __name; @@ -558,14 +558,14 @@ bool CWiiSaveCrypted::getPaths(bool forExport) (u8)(m_TitleID >> 24) & 0xFF, (u8)(m_TitleID >> 16) & 0xFF, (u8)(m_TitleID >> 8) & 0xFF, (u8)m_TitleID & 0xFF); - if(!File::IsDirectory(WiiTitlePath)) + if (!File::IsDirectory(WiiTitlePath)) { b_valid = false; PanicAlertT("No save folder found for title %s", GameID); return false; } - if(!File::Exists(WiiTitlePath + "banner.bin")) + if (!File::Exists(WiiTitlePath + "banner.bin")) { b_valid = false; PanicAlertT("No banner file found for title %s", GameID); diff --git a/Source/Core/DolphinWX/NetWindow.cpp b/Source/Core/DolphinWX/NetWindow.cpp index 40b13d8d5be..e8337e7e1c6 100644 --- a/Source/Core/DolphinWX/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetWindow.cpp @@ -277,7 +277,7 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&) if (netplay_server->is_connected) { #ifdef USE_UPNP - if(m_upnp_chk->GetValue()) + if (m_upnp_chk->GetValue()) netplay_server->TryPortmapping(port); #endif MakeNetPlayDiag(port, game, true); diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp index d30c9e7d2ea..12f38eefd48 100644 --- a/Source/Core/DolphinWX/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/TASInputDlg.cpp @@ -244,148 +244,148 @@ void TASInputDlg::ResetValues() void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) { - if(PadStatus->stickX != 128) + if (PadStatus->stickX != 128) { mainX = PadStatus->stickX; mstickx = true; wx_mainX_t->SetValue(wxString::Format(wxT("%i"), mainX)); } - else if(mstickx) + else if (mstickx) { mstickx = false; mainX = 128; wx_mainX_t->SetValue(wxString::Format(wxT("%i"), mainX)); } - if(PadStatus->stickY != 128) + if (PadStatus->stickY != 128) { mainY = PadStatus->stickY; msticky = true; wx_mainY_t->SetValue(wxString::Format(wxT("%i"),mainY)); } - else if(msticky) + else if (msticky) { msticky = false; mainY = 128; wx_mainY_t->SetValue(wxString::Format(wxT("%i"), mainY)); } - if(PadStatus->substickX != 128) + if (PadStatus->substickX != 128) { cX = PadStatus->substickX; cstickx = true; wx_cX_t->SetValue(wxString::Format(wxT("%i"), cX)); } - else if(cstickx) + else if (cstickx) { cstickx = false; cX = 128; wx_cX_t->SetValue(wxString::Format(wxT("%i"), cX)); } - if(PadStatus->substickY != 128) + if (PadStatus->substickY != 128) { cY = PadStatus->substickY; csticky = true; wx_cY_t->SetValue(wxString::Format(wxT("%i"), cY)); } - else if(csticky) + else if (csticky) { csticky = false; cY = 128; wx_cY_t->SetValue(wxString::Format(wxT("%i"), cY)); } - if(((PadStatus->button & PAD_BUTTON_UP) != 0)) + if ((PadStatus->button & PAD_BUTTON_UP) != 0) { wx_up_button->SetValue(true); DU_cont = true; } - else if(DU_cont) + else if (DU_cont) { wx_up_button->SetValue(false); DU_cont = false; } - if(((PadStatus->button & PAD_BUTTON_DOWN) != 0)) + if ((PadStatus->button & PAD_BUTTON_DOWN) != 0) { wx_down_button->SetValue(true); DD_cont = true; } - else if(DD_cont) + else if (DD_cont) { wx_down_button->SetValue(false); DD_cont = false; } - if(((PadStatus->button & PAD_BUTTON_LEFT) != 0)) + if ((PadStatus->button & PAD_BUTTON_LEFT) != 0) { wx_left_button->SetValue(true); DL_cont = true; } - else if(DL_cont) + else if (DL_cont) { wx_left_button->SetValue(false); DL_cont = false; } - if(((PadStatus->button & PAD_BUTTON_RIGHT) != 0)) + if ((PadStatus->button & PAD_BUTTON_RIGHT) != 0) { wx_right_button->SetValue(true); DR_cont = true; } - else if(DR_cont) + else if (DR_cont) { wx_right_button->SetValue(false); DR_cont = false; } - if(((PadStatus->button & PAD_BUTTON_A) != 0)) + if ((PadStatus->button & PAD_BUTTON_A) != 0) { wx_a_button->SetValue(true); A_cont = true; } - else if(A_cont) + else if (A_cont) { wx_a_button->SetValue(false); A_cont = false; } - if(((PadStatus->button & PAD_BUTTON_B) != 0)) + if ((PadStatus->button & PAD_BUTTON_B) != 0) { wx_b_button->SetValue(true); B_cont = true; } - else if(B_cont) + else if (B_cont) { wx_b_button->SetValue(false); B_cont = false; } - if(((PadStatus->button & PAD_BUTTON_X) != 0)) + if ((PadStatus->button & PAD_BUTTON_X) != 0) { wx_x_button->SetValue(true); X_cont = true; } - else if(X_cont) + else if (X_cont) { wx_x_button->SetValue(false); X_cont = false; } - if(((PadStatus->button & PAD_BUTTON_Y) != 0)) + if ((PadStatus->button & PAD_BUTTON_Y) != 0) { wx_y_button->SetValue(true); Y_cont = true; } - else if(Y_cont) + else if (Y_cont) { wx_y_button->SetValue(false); Y_cont = false; } - if(((PadStatus->triggerLeft) != 0)) + if ((PadStatus->triggerLeft) != 0) { if (PadStatus->triggerLeft == 255) { @@ -402,7 +402,7 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) wx_l_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerLeft)); L_cont = true; } - else if(L_cont) + else if (L_cont) { wx_l_button->SetValue(false); wx_l_s->SetValue(0); @@ -410,7 +410,7 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) L_cont = false; } - if(((PadStatus->triggerRight) != 0)) + if ((PadStatus->triggerRight) != 0) { if (PadStatus->triggerRight == 255) { @@ -427,7 +427,7 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) wx_r_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerRight)); R_cont = true; } - else if(R_cont) + else if (R_cont) { wx_r_button->SetValue(false); wx_r_s->SetValue(0); @@ -435,23 +435,23 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) R_cont = false; } - if(((PadStatus->button & PAD_TRIGGER_Z) != 0)) + if ((PadStatus->button & PAD_TRIGGER_Z) != 0) { wx_z_button->SetValue(true); Z_cont = true; } - else if(Z_cont) + else if (Z_cont) { wx_z_button->SetValue(false); Z_cont = false; } - if(((PadStatus->button & PAD_BUTTON_START) != 0)) + if ((PadStatus->button & PAD_BUTTON_START) != 0) { wx_start_button->SetValue(true); START_cont = true; } - else if(START_cont) + else if (START_cont) { wx_start_button->SetValue(false); START_cont = false; @@ -487,27 +487,27 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) PadStatus->triggerLeft = lTrig; PadStatus->triggerRight = rTrig; - if(wx_up_button->IsChecked()) + if (wx_up_button->IsChecked()) PadStatus->button |= PAD_BUTTON_UP; else PadStatus->button &= ~PAD_BUTTON_UP; - if(wx_down_button->IsChecked()) + if (wx_down_button->IsChecked()) PadStatus->button |= PAD_BUTTON_DOWN; else PadStatus->button &= ~PAD_BUTTON_DOWN; - if(wx_left_button->IsChecked()) + if (wx_left_button->IsChecked()) PadStatus->button |= PAD_BUTTON_LEFT; else PadStatus->button &= ~PAD_BUTTON_LEFT; - if(wx_right_button->IsChecked()) + if (wx_right_button->IsChecked()) PadStatus->button |= PAD_BUTTON_RIGHT; else PadStatus->button &= ~PAD_BUTTON_RIGHT; - if(wx_a_button->IsChecked()) + if (wx_a_button->IsChecked()) { PadStatus->button |= PAD_BUTTON_A; PadStatus->analogA = 0xFF; @@ -518,7 +518,7 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) PadStatus->analogA = 0x00; } - if(wx_b_button->IsChecked()) + if (wx_b_button->IsChecked()) { PadStatus->button |= PAD_BUTTON_B; PadStatus->analogB = 0xFF; @@ -529,32 +529,32 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) PadStatus->analogB = 0x00; } - if(wx_x_button->IsChecked()) + if (wx_x_button->IsChecked()) PadStatus->button |= PAD_BUTTON_X; else PadStatus->button &= ~PAD_BUTTON_X; - if(wx_y_button->IsChecked()) + if (wx_y_button->IsChecked()) PadStatus->button |= PAD_BUTTON_Y; else PadStatus->button &= ~PAD_BUTTON_Y; - if(wx_z_button->IsChecked()) + if (wx_z_button->IsChecked()) PadStatus->button |= PAD_TRIGGER_Z; else PadStatus->button &= ~PAD_TRIGGER_Z; - if(wx_start_button->IsChecked()) + if (wx_start_button->IsChecked()) PadStatus->button |= PAD_BUTTON_START; else PadStatus->button &= ~PAD_BUTTON_START; - if(wx_r_button->IsChecked() || rTrig >= 255) + if (wx_r_button->IsChecked() || rTrig >= 255) PadStatus->button |= PAD_TRIGGER_R; else PadStatus->button &= ~PAD_TRIGGER_R; - if(wx_l_button->IsChecked() || lTrig >= 255) + if (wx_l_button->IsChecked() || lTrig >= 255) PadStatus->button |= PAD_TRIGGER_L; else PadStatus->button &= ~PAD_TRIGGER_L; @@ -568,7 +568,7 @@ void TASInputDlg::UpdateFromSliders(wxCommandEvent& event) u8 *v; update = 0; - switch(event.GetId()) + switch (event.GetId()) { case ID_MAIN_X_SLIDER: text = wx_mainX_t; @@ -616,12 +616,12 @@ void TASInputDlg::UpdateFromSliders(wxCommandEvent& event) *v = (u8) value; text->SetValue(wxString::Format(wxT("%i"), value)); - if(update == 1) + if (update == 1) { static_bitmap_main->SetBitmap(TASInputDlg::CreateStickBitmap(xaxis, yaxis)); } - if(update == 2) + if (update == 2) { static_bitmap_c->SetBitmap(TASInputDlg::CreateStickBitmap(c_xaxis, c_yaxis)); } @@ -634,7 +634,7 @@ void TASInputDlg::UpdateFromText(wxCommandEvent& event) update = 0; update_axis = 0; - switch(event.GetId()) + switch (event.GetId()) { case ID_MAIN_X_TEXT: slider = wx_mainX_s; @@ -684,31 +684,28 @@ void TASInputDlg::UpdateFromText(wxCommandEvent& event) *v = (u8) (value > 255 ? 255 : value); slider->SetValue(*v); - if(update == 1) + if (update == 1) + { + if (update_axis == 1) { - if(update_axis == 1) - { - xaxis = *v; - static_bitmap_main->SetBitmap(TASInputDlg::CreateStickBitmap(xaxis,yaxis)); - } - - if(update_axis == 2) - { - yaxis =256 - *v; - static_bitmap_main->SetBitmap(TASInputDlg::CreateStickBitmap(xaxis,yaxis)); - } - + xaxis = *v; + static_bitmap_main->SetBitmap(TASInputDlg::CreateStickBitmap(xaxis,yaxis)); + } + else if (update_axis == 2) + { + yaxis =256 - *v; + static_bitmap_main->SetBitmap(TASInputDlg::CreateStickBitmap(xaxis,yaxis)); } - if(update == 2) + } + else if (update == 2) { - if(update_axis == 1) + if (update_axis == 1) { c_xaxis = *v; static_bitmap_c->SetBitmap(TASInputDlg::CreateStickBitmap(c_xaxis,c_yaxis)); } - - if(update_axis == 2) + else if (update_axis == 2) { c_yaxis =256- *v; static_bitmap_c->SetBitmap(TASInputDlg::CreateStickBitmap(c_xaxis,c_yaxis)); @@ -731,13 +728,13 @@ void TASInputDlg::OnCloseWindow(wxCloseEvent& event) bool TASInputDlg::TASHasFocus() { //allows numbers to be used as hotkeys - if(TextBoxHasFocus()) + if (TextBoxHasFocus()) return false; if (wxWindow::FindFocus() == this) return true; else if (wxWindow::FindFocus() != nullptr && - wxWindow::FindFocus()->GetParent() == this) + wxWindow::FindFocus()->GetParent() == this) return true; else return false; @@ -745,22 +742,22 @@ bool TASInputDlg::TASHasFocus() bool TASInputDlg::TextBoxHasFocus() { - if(wxWindow::FindFocus() == wx_mainX_t) + if (wxWindow::FindFocus() == wx_mainX_t) return true; - if(wxWindow::FindFocus() == wx_mainY_t) + if (wxWindow::FindFocus() == wx_mainY_t) return true; - if(wxWindow::FindFocus() == wx_cX_t) + if (wxWindow::FindFocus() == wx_cX_t) return true; - if(wxWindow::FindFocus() == wx_cY_t) + if (wxWindow::FindFocus() == wx_cY_t) return true; - if(wxWindow::FindFocus() == wx_l_t) + if (wxWindow::FindFocus() == wx_l_t) return true; - if(wxWindow::FindFocus() == wx_r_t) + if (wxWindow::FindFocus() == wx_r_t) return true; return false; @@ -773,7 +770,7 @@ void TASInputDlg::OnMouseUpR(wxMouseEvent& event) wxTextCtrl *textX, *textY; int *x,*y; - switch(event.GetId()) + switch (event.GetId()) { case ID_MAIN_STICK: sliderX = wx_mainX_s; @@ -823,7 +820,7 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event) wxTextCtrl *textX, *textY; int *x,*y; - switch(event.GetId()) + switch (event.GetId()) { case ID_MAIN_STICK: sliderX = wx_mainX_s; @@ -853,10 +850,10 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event) *x = ptM.x *2; *y = ptM.y * 2; - if(*x > 255) + if (*x > 255) *x = 255; - if(*y > 255) + if (*y > 255) *y = 255; sbitmap->SetBitmap(TASInputDlg::CreateStickBitmap(*x,*y)); @@ -871,7 +868,7 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event) void TASInputDlg::SetTurboFalse(wxMouseEvent& event) { - switch(event.GetId()) + switch (event.GetId()) { case ID_A: A_turbo = false; @@ -932,12 +929,12 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) { wxCheckBox* placeholder; - switch(event.GetId()) + switch (event.GetId()) { case ID_A: placeholder = wx_a_button; - if(A_turbo) + if (A_turbo) A_turbo = false; else A_turbo = true; @@ -945,7 +942,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_B: placeholder = wx_b_button; - if(B_turbo) + if (B_turbo) B_turbo = false; else B_turbo = true; @@ -953,7 +950,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_X: placeholder = wx_x_button; - if(X_turbo) + if (X_turbo) X_turbo = false; else X_turbo = true; @@ -961,7 +958,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_Y: placeholder = wx_y_button; - if(Y_turbo) + if (Y_turbo) Y_turbo = false; else Y_turbo = true; @@ -969,7 +966,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_Z: placeholder = wx_z_button; - if(Z_turbo) + if (Z_turbo) Z_turbo = false; else Z_turbo = true; @@ -977,7 +974,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_L: placeholder = wx_l_button; - if(L_turbo) + if (L_turbo) L_turbo = false; else L_turbo = true; @@ -985,7 +982,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_R: placeholder = wx_r_button; - if(R_turbo) + if (R_turbo) R_turbo = false; else R_turbo = true; @@ -993,7 +990,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_START: placeholder = wx_start_button; - if(START_turbo) + if (START_turbo) START_turbo = false; else START_turbo = true; @@ -1001,7 +998,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_UP: placeholder = wx_up_button; - if(DU_turbo) + if (DU_turbo) DU_turbo = false; else DU_turbo = true; @@ -1009,7 +1006,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_DOWN: placeholder = wx_down_button; - if(DD_turbo) + if (DD_turbo) DD_turbo = false; else DD_turbo = true; @@ -1017,7 +1014,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_LEFT: placeholder = wx_left_button; - if(DL_turbo) + if (DL_turbo) DL_turbo = false; else DL_turbo = true; @@ -1025,7 +1022,7 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) case ID_RIGHT: placeholder = wx_right_button; - if(DR_turbo) + if (DR_turbo) DR_turbo = false; else DR_turbo = true; @@ -1038,97 +1035,97 @@ void TASInputDlg::SetTurbo(wxMouseEvent& event) void TASInputDlg::ButtonTurbo() { - if(A_turbo) + if (A_turbo) { - if(wx_a_button->GetValue()) + if (wx_a_button->GetValue()) wx_a_button->SetValue(false); else wx_a_button->SetValue(true); } - if(B_turbo) + if (B_turbo) { - if(wx_b_button->GetValue()) + if (wx_b_button->GetValue()) wx_b_button->SetValue(false); else wx_b_button->SetValue(true); } - if(X_turbo) + if (X_turbo) { - if(wx_x_button->GetValue()) + if (wx_x_button->GetValue()) wx_x_button->SetValue(false); else wx_x_button->SetValue(true); } - if(Y_turbo) + if (Y_turbo) { - if(wx_y_button->GetValue()) + if (wx_y_button->GetValue()) wx_y_button->SetValue(false); else wx_y_button->SetValue(true); } - if(Z_turbo) + if (Z_turbo) { - if(wx_z_button->GetValue()) + if (wx_z_button->GetValue()) wx_z_button->SetValue(false); else wx_z_button->SetValue(true); } - if(L_turbo) + if (L_turbo) { - if(wx_l_button->GetValue()) + if (wx_l_button->GetValue()) wx_l_button->SetValue(false); else wx_l_button->SetValue(true); } - if(R_turbo) + if (R_turbo) { - if(wx_r_button->GetValue()) + if (wx_r_button->GetValue()) wx_r_button->SetValue(false); else wx_r_button->SetValue(true); } - if(START_turbo) + if (START_turbo) { - if(wx_start_button->GetValue()) + if (wx_start_button->GetValue()) wx_start_button->SetValue(false); else wx_start_button->SetValue(true); } - if(DU_turbo) + if (DU_turbo) { - if(wx_up_button->GetValue()) + if (wx_up_button->GetValue()) wx_up_button->SetValue(false); else wx_up_button->SetValue(true); } - if(DD_turbo) + if (DD_turbo) { - if(wx_down_button->GetValue()) + if (wx_down_button->GetValue()) wx_down_button->SetValue(false); else wx_down_button->SetValue(true); } - if(DL_turbo) + if (DL_turbo) { - if(wx_left_button->GetValue()) + if (wx_left_button->GetValue()) wx_left_button->SetValue(false); else wx_left_button->SetValue(true); } - if(DR_turbo) + if (DR_turbo) { - if(wx_right_button->GetValue()) + if (wx_right_button->GetValue()) wx_right_button->SetValue(false); else wx_right_button->SetValue(true); diff --git a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/WiimoteConfigDiag.cpp index b5eabd678ef..191843512df 100644 --- a/Source/Core/DolphinWX/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/WiimoteConfigDiag.cpp @@ -246,7 +246,7 @@ void WiimoteConfigDiag::SelectSource(wxCommandEvent& event) // Revert if the dialog is canceled. int index = m_wiimote_index_from_ctrl_id[event.GetId()]; - if(index != WIIMOTE_BALANCE_BOARD) + if (index != WIIMOTE_BALANCE_BOARD) { WiimoteReal::ChangeWiimoteSource(index, event.GetInt()); if (g_wiimote_sources[index] != WIIMOTE_SRC_EMU && g_wiimote_sources[index] != WIIMOTE_SRC_HYBRID) diff --git a/Source/Core/DolphinWX/X11Utils.cpp b/Source/Core/DolphinWX/X11Utils.cpp index 56232a36da8..a048216ae25 100644 --- a/Source/Core/DolphinWX/X11Utils.cpp +++ b/Source/Core/DolphinWX/X11Utils.cpp @@ -57,8 +57,9 @@ void SendMotionEvent(Display *dpy, int x, int y) void EWMH_Fullscreen(Display *dpy, int action) { - _assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD - || action == _NET_WM_STATE_TOGGLE); + _assert_(action == _NET_WM_STATE_REMOVE || + action == _NET_WM_STATE_ADD || + action == _NET_WM_STATE_TOGGLE); Window win = (Window)Core::GetWindowHandle(); @@ -73,7 +74,7 @@ void EWMH_Fullscreen(Display *dpy, int action) // Send the event if (!XSendEvent(dpy, DefaultRootWindow(dpy), False, - SubstructureRedirectMask | SubstructureNotifyMask, &event)) + SubstructureRedirectMask | SubstructureNotifyMask, &event)) ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode."); } @@ -156,7 +157,7 @@ XRRConfiguration::~XRRConfiguration() void XRRConfiguration::Update() { - if(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution == "Auto") + if (SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution == "Auto") return; if (!bValid) diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index 75b21c0e8cf..7f5a74041a9 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -24,7 +24,7 @@ namespace DInput void GetXInputGUIDS( std::vector& guids ) { -#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } +#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=nullptr; } } IWbemLocator* pIWbemLocator = nullptr; IEnumWbemClassObject* pEnumDevices = nullptr; @@ -50,9 +50,9 @@ void GetXInputGUIDS( std::vector& guids ) if (FAILED(hr) || pIWbemLocator == nullptr) goto LCleanup; - bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2");if(bstrNamespace == nullptr) goto LCleanup; - bstrClassName = SysAllocString(L"Win32_PNPEntity"); if(bstrClassName == nullptr) goto LCleanup; - bstrDeviceID = SysAllocString(L"DeviceID"); if(bstrDeviceID == nullptr) goto LCleanup; + bstrNamespace = SysAllocString(L"\\\\.\\root\\cimv2"); if (bstrNamespace == nullptr) goto LCleanup; + bstrClassName = SysAllocString(L"Win32_PNPEntity"); if (bstrClassName == nullptr) goto LCleanup; + bstrDeviceID = SysAllocString(L"DeviceID"); if (bstrDeviceID == nullptr) goto LCleanup; // Connect to WMI hr = pIWbemLocator->ConnectServer(bstrNamespace, nullptr, nullptr, 0L, 0L, nullptr, nullptr, &pIWbemServices); @@ -105,11 +105,11 @@ void GetXInputGUIDS( std::vector& guids ) } LCleanup: - if(bstrNamespace) + if (bstrNamespace) SysFreeString(bstrNamespace); - if(bstrDeviceID) + if (bstrDeviceID) SysFreeString(bstrDeviceID); - if(bstrClassName) + if (bstrClassName) SysFreeString(bstrClassName); for (UINT iDevice = 0; iDevice < 20; iDevice++) SAFE_RELEASE(pDevices[iDevice]); diff --git a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h index c3b5cef2ef1..986fe2ea3b8 100644 --- a/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h +++ b/Source/Core/InputCommon/ControllerInterface/ForceFeedback/OSX/DirectInputAdapter.h @@ -164,7 +164,7 @@ public: FFDeviceObjectReference ref; HRESULT hr = FFCreateDevice(hidDevice, &ref); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) *pDeviceReference = new FFDeviceAdapter(ref); return hr; @@ -175,7 +175,7 @@ public: FFEffectObjectReference ref; HRESULT hr = FFDeviceCreateEffect(m_device, uuidRef, pEffectDefinition, &ref); - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) *pEffectReference = new FFEffectAdapter(m_device, ref); return hr; diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 64c012c1c1c..56c526a079c 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -36,7 +36,7 @@ void Init( std::vector& devices ) if (SDL_Init( SDL_INIT_FLAGS ) >= 0) { // joysticks - for(int i = 0; i < SDL_NumJoysticks(); ++i) + for (int i = 0; i < SDL_NumJoysticks(); ++i) { SDL_Joystick* dev = SDL_JoystickOpen(i); if (dev) @@ -67,12 +67,11 @@ Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsi std::string lcasename = GetName(); std::transform(lcasename.begin(), lcasename.end(), lcasename.begin(), tolower); - if ((std::string::npos != lcasename.find("xbox 360")) - && (10 == SDL_JoystickNumButtons(joystick)) - && (5 == SDL_JoystickNumAxes(joystick)) - && (1 == SDL_JoystickNumHats(joystick)) - && (0 == SDL_JoystickNumBalls(joystick)) - ) + if ((std::string::npos != lcasename.find("xbox 360")) && + (10 == SDL_JoystickNumButtons(joystick)) && + (5 == SDL_JoystickNumAxes(joystick)) && + (1 == SDL_JoystickNumHats(joystick)) && + (0 == SDL_JoystickNumBalls(joystick))) { // this device won't be used return; diff --git a/Source/Core/InputCommon/UDPWiimote.cpp b/Source/Core/InputCommon/UDPWiimote.cpp index 1dad7d52d2c..1519de350ae 100644 --- a/Source/Core/InputCommon/UDPWiimote.cpp +++ b/Source/Core/InputCommon/UDPWiimote.cpp @@ -115,7 +115,7 @@ UDPWiimote::UDPWiimote(const char *_port, const char * name, int _index) : } // loop through all the results and bind to everything we can - for(p = servinfo; p != nullptr; p = p->ai_next) + for (p = servinfo; p != nullptr; p = p->ai_next) { sock_t sock; if ((sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == BAD_SOCK) diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index 4efacfa6895..bb758f5063f 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -126,7 +126,7 @@ void UnloadDXGI() if (!dxgi_dll_ref) return; if (--dxgi_dll_ref != 0) return; - if(hDXGIDll) FreeLibrary(hDXGIDll); + if (hDXGIDll) FreeLibrary(hDXGIDll); hDXGIDll = nullptr; PCreateDXGIFactory = nullptr; } @@ -136,7 +136,7 @@ void UnloadD3D() if (!d3d_dll_ref) return; if (--d3d_dll_ref != 0) return; - if(hD3DDll) FreeLibrary(hD3DDll); + if (hD3DDll) FreeLibrary(hD3DDll); hD3DDll = nullptr; PD3D11CreateDevice = nullptr; PD3D11CreateDeviceAndSwapChain = nullptr; @@ -365,22 +365,22 @@ void Close() const char* VertexShaderVersionString() { - if(featlevel == D3D_FEATURE_LEVEL_11_0) return "vs_5_0"; - else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "vs_4_1"; + if (featlevel == D3D_FEATURE_LEVEL_11_0) return "vs_5_0"; + else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "vs_4_1"; else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "vs_4_0"; } const char* GeometryShaderVersionString() { - if(featlevel == D3D_FEATURE_LEVEL_11_0) return "gs_5_0"; - else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "gs_4_1"; + if (featlevel == D3D_FEATURE_LEVEL_11_0) return "gs_5_0"; + else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "gs_4_1"; else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "gs_4_0"; } const char* PixelShaderVersionString() { - if(featlevel == D3D_FEATURE_LEVEL_11_0) return "ps_5_0"; - else if(featlevel == D3D_FEATURE_LEVEL_10_1) return "ps_4_1"; + if (featlevel == D3D_FEATURE_LEVEL_11_0) return "ps_5_0"; + else if (featlevel == D3D_FEATURE_LEVEL_10_1) return "ps_4_1"; else /*if(featlevel == D3D_FEATURE_LEVEL_10_0)*/ return "ps_4_0"; } diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp index 7e5270fc507..aeca510f28e 100644 --- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp +++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp @@ -35,13 +35,13 @@ public: int AppendData(void* data, int size, int vertex_size) { D3D11_MAPPED_SUBRESOURCE map; - if(offset + size >= max_size) + if (offset + size >= max_size) { // wrap buffer around and notify observers offset = 0; context->Map(buf, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); - for(bool* observer : observers) + for (bool* observer : observers) *observer = true; } else @@ -623,10 +623,10 @@ void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2) { x2, y1, 0.f, Color }, }; - if(cq_observer || - draw_quad_data.x1 != x1 || draw_quad_data.y1 != y1 || - draw_quad_data.x2 != x2 || draw_quad_data.y2 != y2 || - draw_quad_data.col != Color) + if (cq_observer || + draw_quad_data.x1 != x1 || draw_quad_data.y1 != y1 || + draw_quad_data.x2 != x2 || draw_quad_data.y2 != y2 || + draw_quad_data.col != Color) { cq_offset = util_vbuf->AppendData(coords, sizeof(coords), sizeof(ColVertex)); cq_observer = false; diff --git a/Source/Core/VideoBackends/D3D/GfxState.cpp b/Source/Core/VideoBackends/D3D/GfxState.cpp index af85993e4d8..5b170d0b480 100644 --- a/Source/Core/VideoBackends/D3D/GfxState.cpp +++ b/Source/Core/VideoBackends/D3D/GfxState.cpp @@ -29,7 +29,7 @@ template AutoState::AutoState(const AutoState &source) template AutoState::~AutoState() { - if(state) ((T*)state)->Release(); + if (state) ((T*)state)->Release(); state = nullptr; } @@ -77,4 +77,4 @@ void StateManager::Apply() } // namespace -} // namespace DX11 \ No newline at end of file +} // namespace DX11 diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp index da1f1b0746b..466326f64fe 100644 --- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp +++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp @@ -174,7 +174,7 @@ const char reint_rgba6_to_rgb8_msaa[] = { " int width, height, samples;\n" " Tex0.GetDimensions(width, height, samples);\n" " float4 texcol = 0;\n" - " for(int i = 0; i < samples; ++i)\n" + " for (int i = 0; i < samples; ++i)\n" " texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n" " texcol /= samples;\n" " int4 src6 = round(texcol * 63.f);\n" @@ -216,7 +216,7 @@ const char reint_rgb8_to_rgba6_msaa[] = { " int width, height, samples;\n" " Tex0.GetDimensions(width, height, samples);\n" " float4 texcol = 0;\n" - " for(int i = 0; i < samples; ++i)\n" + " for (int i = 0; i < samples; ++i)\n" " texcol += Tex0.Load(int2(uv0.x*(width), uv0.y*(height)), i);\n" " texcol /= samples;\n" " int4 src8 = round(texcol * 255.f);\n" diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 3b987fe7f7c..885471aca6b 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -233,7 +233,7 @@ Renderer::Renderer() 0.f, 1 << g_ActiveConfig.iMaxAnisotropy, D3D11_COMPARISON_ALWAYS, border, -D3D11_FLOAT32_MAX, D3D11_FLOAT32_MAX); - if(g_ActiveConfig.iMaxAnisotropy != 0) gx_state.sampdc[k].Filter = D3D11_FILTER_ANISOTROPIC; + if (g_ActiveConfig.iMaxAnisotropy != 0) gx_state.sampdc[k].Filter = D3D11_FILTER_ANISOTROPIC; } // Clear EFB textures @@ -362,7 +362,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // Take the mean of the resulting dimensions; TODO: Don't use the center pixel, compute the average color instead D3D11_RECT RectToLock; - if(type == PEEK_COLOR || type == PEEK_Z) + if (type == PEEK_COLOR || type == PEEK_Z) { RectToLock.left = (targetPixelRc.left + targetPixelRc.right) / 2; RectToLock.top = (targetPixelRc.top + targetPixelRc.bottom) / 2; @@ -409,7 +409,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) float val = *(float*)map.pData; u32 ret = 0; - if(bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) + if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) { // if Z is in 16 bit format you must return a 16 bit integer ret = ((u32)(val * 0xffff)); @@ -433,7 +433,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // read the data from system memory D3D::context->Map(read_tex, 0, D3D11_MAP_READ, 0, &map); u32 ret = 0; - if(map.pData) + if (map.pData) ret = *(u32*)map.pData; D3D::context->Unmap(read_tex, 0); @@ -448,13 +448,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) { ret = RGBA8ToRGB565ToRGBA8(ret); } - if(bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) + if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) { ret |= 0xFF000000; } - if(alpha_read_mode.ReadMode == 2) return ret; // GX_READ_NONE - else if(alpha_read_mode.ReadMode == 1) return (ret | 0xFF000000); // GX_READ_FF + if (alpha_read_mode.ReadMode == 2) return ret; // GX_READ_NONE + else if (alpha_read_mode.ReadMode == 1) return (ret | 0xFF000000); // GX_READ_FF else /*if(alpha_read_mode.ReadMode == 0)*/ return (ret & 0x00FFFFFF); // GX_READ_00 } else //if(type == POKE_COLOR) @@ -784,7 +784,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl s_television.Submit(xfbAddr, fbWidth, fbHeight); s_television.Render(); } - else if(g_ActiveConfig.bUseXFB) + else if (g_ActiveConfig.bUseXFB) { const XFBSourceBase* xfbSource; @@ -1084,7 +1084,7 @@ void Renderer::ApplyState(bool bUseDstAlpha) // TODO: unnecessary state changes, we should store a list of shader resources //if (shader_resources[stage]) { - if(g_ActiveConfig.iMaxAnisotropy > 0) gx_state.sampdc[stage].Filter = D3D11_FILTER_ANISOTROPIC; + if (g_ActiveConfig.iMaxAnisotropy > 0) gx_state.sampdc[stage].Filter = D3D11_FILTER_ANISOTROPIC; hr = D3D::device->CreateSamplerState(&gx_state.sampdc[stage], &samplerstate[stage]); if (FAILED(hr)) PanicAlert("Fail %s %d, stage=%d\n", __FILE__, __LINE__, stage); else D3D::SetDebugObjectName((ID3D11DeviceChild*)samplerstate[stage], "sampler state used to emulate the GX pipeline"); diff --git a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp index a9ccedf46da..f7557cc1b23 100644 --- a/Source/Core/VideoBackends/OGL/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/FramebufferManager.cpp @@ -353,7 +353,7 @@ void FramebufferManager::ReinterpretPixelData(unsigned int convtype) GLuint src_texture = 0; - if(m_msaaSamples > 1) + if (m_msaaSamples > 1) { // MSAA mode, so resolve first glBindFramebuffer(GL_READ_FRAMEBUFFER, m_efbFramebuffer); diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp index 1e43f2a1377..9c5226309d5 100644 --- a/Source/Core/VideoBackends/OGL/GLUtil.cpp +++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp @@ -64,9 +64,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha GLsizei stringBufferUsage = 0; glGetShaderiv(vertexShaderID, GL_COMPILE_STATUS, &Result); glGetShaderInfoLog(vertexShaderID, 1024, &stringBufferUsage, stringBuffer); - if(Result && stringBufferUsage) { + if (Result && stringBufferUsage) { ERROR_LOG(VIDEO, "GLSL vertex shader warnings:\n%s%s", stringBuffer, vertexShader); - } else if(!Result) { + } else if (!Result) { ERROR_LOG(VIDEO, "GLSL vertex shader error:\n%s%s", stringBuffer, vertexShader); } else { DEBUG_LOG(VIDEO, "GLSL vertex shader compiled:\n%s", vertexShader); @@ -80,9 +80,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha #if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) glGetShaderiv(fragmentShaderID, GL_COMPILE_STATUS, &Result); glGetShaderInfoLog(fragmentShaderID, 1024, &stringBufferUsage, stringBuffer); - if(Result && stringBufferUsage) { + if (Result && stringBufferUsage) { ERROR_LOG(VIDEO, "GLSL fragment shader warnings:\n%s%s", stringBuffer, fragmentShader); - } else if(!Result) { + } else if (!Result) { ERROR_LOG(VIDEO, "GLSL fragment shader error:\n%s%s", stringBuffer, fragmentShader); } else { DEBUG_LOG(VIDEO, "GLSL fragment shader compiled:\n%s", fragmentShader); @@ -97,9 +97,9 @@ GLuint OpenGL_CompileProgram ( const char* vertexShader, const char* fragmentSha #if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) glGetProgramiv(programID, GL_LINK_STATUS, &Result); glGetProgramInfoLog(programID, 1024, &stringBufferUsage, stringBuffer); - if(Result && stringBufferUsage) { + if (Result && stringBufferUsage) { ERROR_LOG(VIDEO, "GLSL linker warnings:\n%s%s%s", stringBuffer, vertexShader, fragmentShader); - } else if(!Result && !shader_errors) { + } else if (!Result && !shader_errors) { ERROR_LOG(VIDEO, "GLSL linker error:\n%s%s%s", stringBuffer, vertexShader, fragmentShader); } #endif diff --git a/Source/Core/VideoBackends/OGL/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/PostProcessing.cpp index 929fcd0de88..a4a4c0bbf32 100644 --- a/Source/Core/VideoBackends/OGL/PostProcessing.cpp +++ b/Source/Core/VideoBackends/OGL/PostProcessing.cpp @@ -77,7 +77,7 @@ void BindTargetFramebuffer () void BlitToScreen() { - if(!s_enable) return; + if (!s_enable) return; glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glViewport(0, 0, s_width, s_height); @@ -101,7 +101,7 @@ void Update ( u32 width, u32 height ) { ApplyShader(); - if(s_enable && (width != s_width || height != s_height)) { + if (s_enable && (width != s_width || height != s_height)) { s_width = width; s_height = height; @@ -133,7 +133,7 @@ void ApplyShader() // Fallback to shared user dir path = File::GetSysDirectory() + SHADERS_DIR DIR_SEP + g_ActiveConfig.sPostProcessingShader + ".glsl"; } - if(!File::ReadFileToString(path.c_str(), code)) { + if (!File::ReadFileToString(path.c_str(), code)) { ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str()); return; } diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index c4e150d7d07..8751ec35c46 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -47,9 +47,9 @@ void SHADER::SetProgramVariables() GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock"); GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock"); - if(PSBlock_id != -1) + if (PSBlock_id != -1) glUniformBlockBinding(glprogid, PSBlock_id, 1); - if(VSBlock_id != -1) + if (VSBlock_id != -1) glUniformBlockBinding(glprogid, VSBlock_id, 2); } @@ -89,7 +89,7 @@ void SHADER::SetProgramBindings() glBindAttribLocation(glprogid, SHADER_NORM1_ATTRIB, "rawnorm1"); glBindAttribLocation(glprogid, SHADER_NORM2_ATTRIB, "rawnorm2"); - for(int i=0; i<8; i++) { + for (int i=0; i<8; i++) { char attrib_name[8]; snprintf(attrib_name, 8, "tex%d", i); glBindAttribLocation(glprogid, SHADER_TEXTURE0_ATTRIB+i, attrib_name); @@ -98,7 +98,7 @@ void SHADER::SetProgramBindings() void SHADER::Bind() { - if(CurrentProgram != glprogid) + if (CurrentProgram != glprogid) { glUseProgram(glprogid); CurrentProgram = glprogid; @@ -107,7 +107,7 @@ void SHADER::Bind() void ProgramShaderCache::UploadConstants() { - if(PixelShaderManager::dirty || VertexShaderManager::dirty) + if (PixelShaderManager::dirty || VertexShaderManager::dirty) { auto buffer = s_buffer->Map(s_ubo_buffer_size, s_ubo_align); @@ -210,7 +210,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons GLuint vsid = CompileSingleShader(GL_VERTEX_SHADER, vcode); GLuint psid = CompileSingleShader(GL_FRAGMENT_SHADER, pcode); - if(!vsid || !psid) + if (!vsid || !psid) { glDeleteShader(vsid); glDeleteShader(psid); @@ -250,7 +250,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons file << s_glsl_header << vcode << s_glsl_header << pcode << infoLog; file.close(); - if(linkStatus != GL_TRUE) + if (linkStatus != GL_TRUE) PanicAlert("Failed to link shaders!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s", szTemp, g_ogl_config.gl_vendor, @@ -308,7 +308,7 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) file << s_glsl_header << code << infoLog; file.close(); - if(compileStatus != GL_TRUE) + if (compileStatus != GL_TRUE) PanicAlert("Failed to compile %s shader!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%s, %s, %s):\n%s", type==GL_VERTEX_SHADER ? "vertex" : "pixel", szTemp, @@ -373,7 +373,7 @@ void ProgramShaderCache::Init(void) { GLint Supported; glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported); - if(!Supported) + if (!Supported) { ERROR_LOG(VIDEO, "GL_ARB_get_program_binary is supported, but no binary format is known. So disable shader cache."); g_ogl_config.bSupportsGLSLCache = false; @@ -406,14 +406,14 @@ void ProgramShaderCache::Shutdown(void) { for (auto& entry : pshaders) { - if(entry.second.in_cache) + if (entry.second.in_cache) { continue; } GLint binary_size; glGetProgramiv(entry.second.shader.glprogid, GL_PROGRAM_BINARY_LENGTH, &binary_size); - if(!binary_size) + if (!binary_size) { continue; } diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h index 8db3eb7ccb0..9b9511fd11e 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h @@ -25,9 +25,9 @@ public: bool operator <(const SHADERUID& r) const { - if(puid < r.puid) return true; - if(r.puid < puid) return false; - if(vuid < r.vuid) return true; + if (puid < r.puid) return true; + if (r.puid < puid) return false; + if (vuid < r.vuid) return true; return false; } diff --git a/Source/Core/VideoBackends/OGL/RasterFont.cpp b/Source/Core/VideoBackends/OGL/RasterFont.cpp index 1b7845887bd..55b6f280b32 100644 --- a/Source/Core/VideoBackends/OGL/RasterFont.cpp +++ b/Source/Core/VideoBackends/OGL/RasterFont.cpp @@ -141,9 +141,9 @@ RasterFont::RasterFont() glActiveTexture(GL_TEXTURE0+8); glBindTexture(GL_TEXTURE_2D, texture); u32* texture_data = new u32[char_width*char_count*char_height]; - for(u32 y=0; y= char_count+char_offset) continue; + if (c < char_offset || c >= char_count+char_offset) continue; vertices[usage++] = x; vertices[usage++] = y; @@ -245,7 +245,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta x += delta_x + border_x; } - if(!usage) { + if (!usage) { delete [] vertices; return; } @@ -258,7 +258,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta s_shader.Bind(); - if(color != cached_color) { + if (color != cached_color) { glUniform4f(uniform_color_id, GLfloat((color>>16)&0xff)/255.f,GLfloat((color>>8)&0xff)/255.f,GLfloat((color>>0)&0xff)/255.f,GLfloat((color>>24)&0xff)/255.f); cached_color = color; } diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 3116961f5db..cd682137b6d 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -147,7 +147,7 @@ int GetNumMSAASamples(int MSAAMode) samples = 1; } - if(samples <= g_ogl_config.max_samples) return samples; + if (samples <= g_ogl_config.max_samples) return samples; // TODO: move this to InitBackendInfo OSD::AddMessage(StringFromFormat("%d Anti Aliasing samples selected, but only %d supported by your GPU.", samples, g_ogl_config.max_samples), 10000); @@ -172,7 +172,7 @@ int GetNumMSAACoverageSamples(int MSAAMode) default: samples = 0; } - if(g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples; + if (g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples; // TODO: move this to InitBackendInfo OSD::AddMessage("CSAA Anti Aliasing isn't supported by your GPU.", 10000); @@ -183,15 +183,15 @@ void ApplySSAASettings() { // GLES3 doesn't support SSAA if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL) { - if(g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) { - if(g_ogl_config.bSupportSampleShading) { + if (g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) { + if (g_ogl_config.bSupportSampleShading) { glEnable(GL_SAMPLE_SHADING_ARB); glMinSampleShadingARB(s_MSAASamples); } else { // TODO: move this to InitBackendInfo OSD::AddMessage("SSAA Anti Aliasing isn't supported by your GPU.", 10000); } - } else if(g_ogl_config.bSupportSampleShading) { + } else if (g_ogl_config.bSupportSampleShading) { glDisable(GL_SAMPLE_SHADING_ARB); } } @@ -202,7 +202,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev const char *s_source; const char *s_type; - switch(source) + switch (source) { case GL_DEBUG_SOURCE_API_ARB: s_source = "API"; break; case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: s_source = "Window System"; break; @@ -212,7 +212,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev case GL_DEBUG_SOURCE_OTHER_ARB: s_source = "Other"; break; default: s_source = "Unknown"; break; } - switch(type) + switch (type) { case GL_DEBUG_TYPE_ERROR_ARB: s_type = "Error"; break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: s_type = "Deprecated"; break; @@ -222,7 +222,7 @@ void GLAPIENTRY ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum sev case GL_DEBUG_TYPE_OTHER_ARB: s_type = "Other"; break; default: s_type = "Unknown"; break; } - switch(severity) + switch (severity) { case GL_DEBUG_SEVERITY_HIGH_ARB: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break; case GL_DEBUG_SEVERITY_MEDIUM_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break; @@ -277,7 +277,7 @@ void InitDriverInfo() vendor = DriverDetails::VENDOR_VIVANTE; // Get device family and driver version...if we care about it - switch(vendor) + switch (vendor) { case DriverDetails::VENDOR_QUALCOMM: { @@ -292,16 +292,16 @@ void InitDriverInfo() case DriverDetails::VENDOR_ARM: if (std::string::npos != srenderer.find("Mali-T6")) driver = DriverDetails::DRIVER_ARM_T6XX; - else if(std::string::npos != srenderer.find("Mali-4")) + else if (std::string::npos != srenderer.find("Mali-4")) driver = DriverDetails::DRIVER_ARM_4XX; break; case DriverDetails::VENDOR_MESA: { - if(svendor == "nouveau") + if (svendor == "nouveau") driver = DriverDetails::DRIVER_NOUVEAU; - else if(svendor == "Intel Open Source Technology Center") + else if (svendor == "Intel Open Source Technology Center") driver = DriverDetails::DRIVER_I965; - else if(std::string::npos != srenderer.find("AMD") || std::string::npos != srenderer.find("ATI")) + else if (std::string::npos != srenderer.find("AMD") || std::string::npos != srenderer.find("ATI")) driver = DriverDetails::DRIVER_R600; int major = 0; @@ -474,19 +474,19 @@ Renderer::Renderer() g_ogl_config.eSupportedGLSLVersion = GLSLES3; else { - if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20")) + if (strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10") || strstr(g_ogl_config.glsl_version, "1.20")) { PanicAlert("GPU: OGL ERROR: Need at least GLSL 1.30\n" "GPU: Does your video card support OpenGL 3.0?\n" "GPU: Your driver supports GLSL %s", g_ogl_config.glsl_version); bSuccess = false; } - else if(strstr(g_ogl_config.glsl_version, "1.30")) + else if (strstr(g_ogl_config.glsl_version, "1.30")) { g_ogl_config.eSupportedGLSLVersion = GLSL_130; g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+ } - else if(strstr(g_ogl_config.glsl_version, "1.40")) + else if (strstr(g_ogl_config.glsl_version, "1.40")) { g_ogl_config.eSupportedGLSLVersion = GLSL_140; g_Config.backend_info.bSupportsEarlyZ = false; // layout keyword is only supported on glsl150+ @@ -512,7 +512,7 @@ Renderer::Renderer() #endif int samples; glGetIntegerv(GL_SAMPLES, &samples); - if(samples > 1) + if (samples > 1) { // MSAA on default framebuffer isn't working because of glBlitFramebuffer. // It also isn't useful as we don't render anything to the default framebuffer. @@ -531,7 +531,7 @@ Renderer::Renderer() } glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples); - if(g_ogl_config.max_samples < 1) + if (g_ogl_config.max_samples < 1) g_ogl_config.max_samples = 1; UpdateActiveConfig(); @@ -599,12 +599,12 @@ Renderer::Renderer() glBlendColor(0, 0, 0, 0.5f); glClearDepthf(1.0f); - if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart) + if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart) { if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3) glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX); else - if(g_ogl_config.bSupportOGL31) + if (g_ogl_config.bSupportOGL31) { glEnable(GL_PRIMITIVE_RESTART); glPrimitiveRestartIndex(65535); @@ -988,7 +988,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // Scale the 32-bit value returned by glReadPixels to a 24-bit // value (GC uses a 24-bit Z-buffer). // TODO: in RE0 this value is often off by one, which causes lighting to disappear - if(bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) + if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) { // if Z is in 16 bit format you must return a 16 bit integer z = z >> 16; @@ -1054,12 +1054,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) { color = RGBA8ToRGB565ToRGBA8(color); } - if(bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) + if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) { color |= 0xFF000000; } - if(alpha_read_mode.ReadMode == 2) return color; // GX_READ_NONE - else if(alpha_read_mode.ReadMode == 1) return (color | 0xFF000000); // GX_READ_FF + if (alpha_read_mode.ReadMode == 2) return color; // GX_READ_NONE + else if (alpha_read_mode.ReadMode == 1) return (color | 0xFF000000); // GX_READ_FF else /*if(alpha_read_mode.ReadMode == 0)*/ return (color & 0x00FFFFFF); // GX_READ_00 } @@ -1110,7 +1110,7 @@ void Renderer::SetViewport() } // Update the view port - if(g_ogl_config.bSupportViewportFloat) + if (g_ogl_config.bSupportViewportFloat) { glViewportIndexedf(0, X, Y, Width, Height); } @@ -1317,7 +1317,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl const XFBSourceBase* xfbSource = nullptr; - if(g_ActiveConfig.bUseXFB) + if (g_ActiveConfig.bUseXFB) { // Render to the real/postprocessing buffer now. PostProcessing::BindTargetFramebuffer(); @@ -1583,7 +1583,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl GL_REPORT_ERRORD(); } - if(s_vsync != g_ActiveConfig.IsVSync()) + if (s_vsync != g_ActiveConfig.IsVSync()) { s_vsync = g_ActiveConfig.IsVSync(); GLInterface->SwapInterval(s_vsync); @@ -1767,7 +1767,7 @@ void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width) // Flip image upside down. Damn OpenGL. for (int y = 0; y < h / 2; ++y) { - for(int x = 0; x < w; ++x) + for (int x = 0; x < w; ++x) { for (int delta = 0; delta < pixel_width; ++delta) std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]); diff --git a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp index be7f4eeacd5..03d9d71de37 100644 --- a/Source/Core/VideoBackends/OGL/StreamBuffer.cpp +++ b/Source/Core/VideoBackends/OGL/StreamBuffer.cpp @@ -66,7 +66,7 @@ static const u32 SYNC_POINTS = 16; void StreamBuffer::CreateFences() { fences = new GLsync[SYNC_POINTS]; - for(u32 i=0; i Map(size_t size, u32 stride) override { Align(stride); - if(m_iterator + size >= m_size) { + if (m_iterator + size >= m_size) { glBufferData(m_buffertype, m_size, nullptr, GL_STREAM_DRAW); m_iterator = 0; } @@ -350,9 +350,9 @@ public: StreamBuffer* StreamBuffer::Create(u32 type, size_t size) { // without basevertex support, only streaming methods whith uploads everything to zero works fine: - if(!g_ogl_config.bSupportsGLBaseVertex) + if (!g_ogl_config.bSupportsGLBaseVertex) { - if(!DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM)) + if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENBUFFERSTREAM)) return new BufferSubData(type, size); // BufferData is by far the worst way, only use it if needed @@ -360,7 +360,7 @@ StreamBuffer* StreamBuffer::Create(u32 type, size_t size) } // Prefer the syncing buffers over the orphaning one - if(g_ogl_config.bSupportsGLSync) + if (g_ogl_config.bSupportsGLSync) { // try to use buffer storage whenever possible if (g_ogl_config.bSupportsGLBufferStorage && @@ -368,16 +368,16 @@ StreamBuffer* StreamBuffer::Create(u32 type, size_t size) return new BufferStorage(type, size); // pinned memory is almost as fine - if(g_ogl_config.bSupportsGLPinnedMemory && + if (g_ogl_config.bSupportsGLPinnedMemory && !(DriverDetails::HasBug(DriverDetails::BUG_BROKENPINNEDMEMORY) && type == GL_ELEMENT_ARRAY_BUFFER)) return new PinnedMemory(type, size); // don't fall back to MapAnd* for nvidia drivers - if(DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING)) + if (DriverDetails::HasBug(DriverDetails::BUG_BROKENUNSYNCMAPPING)) return new BufferSubData(type, size); // mapping fallback - if(g_ogl_config.bSupportsGLSync) + if (g_ogl_config.bSupportsGLSync) return new MapAndSync(type, size); } diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp index 9262f9f4d17..6a20813e803 100644 --- a/Source/Core/VideoBackends/OGL/TextureCache.cpp +++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp @@ -84,8 +84,8 @@ TextureCache::TCacheEntry::~TCacheEntry() { if (texture) { - for(auto& gtex : s_Textures) - if(gtex == texture) + for (auto& gtex : s_Textures) + if (gtex == texture) gtex = 0; glDeleteTextures(1, &texture); texture = 0; @@ -282,14 +282,17 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo glViewport(0, 0, virtual_width, virtual_height); - if(srcFormat == PIXELFMT_Z24) { + if (srcFormat == PIXELFMT_Z24) + { s_DepthMatrixProgram.Bind(); - if(s_DepthCbufid != cbufid) + if (s_DepthCbufid != cbufid) glUniform4fv(s_DepthMatrixUniform, 5, colmat); s_DepthCbufid = cbufid; - } else { + } + else + { s_ColorMatrixProgram.Bind(); - if(s_ColorCbufid != cbufid) + if (s_ColorCbufid != cbufid) glUniform4fv(s_ColorMatrixUniform, 7, colmat); s_ColorCbufid = cbufid; } @@ -391,7 +394,7 @@ TextureCache::TextureCache() s_DepthCopyPositionUniform = glGetUniformLocation(s_DepthMatrixProgram.glprogid, "copy_position"); s_ActiveTexture = -1; - for(auto& gtex : s_Textures) + for (auto& gtex : s_Textures) gtex = -1; } @@ -409,7 +412,7 @@ void TextureCache::DisableStage(unsigned int stage) void TextureCache::SetStage () { // -1 is the initial value as we don't know which testure should be bound - if(s_ActiveTexture != (u32)-1) + if (s_ActiveTexture != (u32)-1) glActiveTexture(GL_TEXTURE0 + s_ActiveTexture); } diff --git a/Source/Core/VideoBackends/OGL/VertexManager.cpp b/Source/Core/VideoBackends/OGL/VertexManager.cpp index 89dfda38e20..e58b2d777fd 100644 --- a/Source/Core/VideoBackends/OGL/VertexManager.cpp +++ b/Source/Core/VideoBackends/OGL/VertexManager.cpp @@ -106,7 +106,7 @@ void VertexManager::Draw(u32 stride) u32 max_index = IndexGenerator::GetNumVerts(); GLenum primitive_mode = 0; - switch(current_primitive_type) + switch (current_primitive_type) { case PRIMITIVE_POINTS: primitive_mode = GL_POINTS; @@ -119,7 +119,7 @@ void VertexManager::Draw(u32 stride) break; } - if(g_ogl_config.bSupportsGLBaseVertex) { + if (g_ogl_config.bSupportsGLBaseVertex) { glDrawRangeElementsBaseVertex(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset, (GLint)s_baseVertex); } else { glDrawRangeElements(primitive_mode, 0, max_index, index_size, GL_UNSIGNED_SHORT, (u8*)nullptr+s_index_offset); @@ -132,7 +132,7 @@ void VertexManager::vFlush(bool useDstAlpha) GLVertexFormat *nativeVertexFmt = (GLVertexFormat*)g_nativeVertexFmt; u32 stride = nativeVertexFmt->GetVertexStride(); - if(m_last_vao != nativeVertexFmt->VAO) { + if (m_last_vao != nativeVertexFmt->VAO) { glBindVertexArray(nativeVertexFmt->VAO); m_last_vao = nativeVertexFmt->VAO; } diff --git a/Source/Core/VideoBackends/Software/Clipper.cpp b/Source/Core/VideoBackends/Software/Clipper.cpp index 976bbeb1044..e1081da1428 100644 --- a/Source/Core/VideoBackends/Software/Clipper.cpp +++ b/Source/Core/VideoBackends/Software/Clipper.cpp @@ -179,7 +179,7 @@ namespace Clipper if (mask != 0) { - for(int i = 0; i < 3; i += 3) + for (int i = 0; i < 3; i += 3) { int vlist[2][2*6+1]; int *inlist = vlist[0], *outlist = vlist[1]; @@ -273,7 +273,7 @@ namespace Clipper bool backface; - if(!CullTest(v0, v1, v2, backface)) + if (!CullTest(v0, v1, v2, backface)) return; int indices[NUM_INDICES] = { 0, 1, 2, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, SKIP_FLAG, @@ -296,10 +296,10 @@ namespace Clipper ClipTriangle(indices, numIndices); - for(int i = 0; i+3 <= numIndices; i+=3) + for (int i = 0; i+3 <= numIndices; i+=3) { _assert_(i < NUM_INDICES); - if(indices[i] != SKIP_FLAG) + if (indices[i] != SKIP_FLAG) { PerspectiveDivide(Vertices[indices[i]]); PerspectiveDivide(Vertices[indices[i+1]]); @@ -339,7 +339,7 @@ namespace Clipper ClipLine(indices); - if(indices[0] != SKIP_FLAG) + if (indices[0] != SKIP_FLAG) { OutputVertexData *v0 = Vertices[indices[0]]; OutputVertexData *v1 = Vertices[indices[1]]; @@ -353,16 +353,16 @@ namespace Clipper float screenDx = 0; float screenDy = 0; - if(fabsf(dx) > fabsf(dy)) + if (fabsf(dx) > fabsf(dy)) { - if(dx > 0) + if (dx > 0) screenDy = bpmem.lineptwidth.linesize / -12.0f; else screenDy = bpmem.lineptwidth.linesize / 12.0f; } else { - if(dy > 0) + if (dy > 0) screenDx = bpmem.lineptwidth.linesize / 12.0f; else screenDx = bpmem.lineptwidth.linesize / -12.0f; @@ -389,7 +389,7 @@ namespace Clipper mask &= CalcClipMask(v1); mask &= CalcClipMask(v2); - if(mask) + if (mask) { INCSTAT(swstats.thisFrame.numTrianglesRejected) return false; diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp index e6995b5068e..1c1629fba87 100644 --- a/Source/Core/VideoBackends/Software/DebugUtil.cpp +++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp @@ -84,7 +84,7 @@ s32 GetMaxTextureLod(u32 texmap) u8 mip = maxLod >> 4; u8 fract = maxLod & 0xf; - if(fract) + if (fract) ++mip; return (s32)mip; diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp index a8bd0bf16e5..6018e2b3ce7 100644 --- a/Source/Core/VideoBackends/Software/EfbCopy.cpp +++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp @@ -34,7 +34,7 @@ namespace EfbCopy INFO_LOG(VIDEO, "xfbaddr: %x, fbwidth: %i, fbheight: %i, source: (%i, %i, %i, %i), Gamma %f", xfbAddr, fbWidth, fbHeight, sourceRc.top, sourceRc.left, sourceRc.bottom, sourceRc.right, Gamma); - if(!g_SWVideoConfig.bBypassXFB) + if (!g_SWVideoConfig.bBypassXFB) { EfbInterface::yuv422_packed* xfb_in_ram = (EfbInterface::yuv422_packed *) Memory::GetPointer(xfbAddr); diff --git a/Source/Core/VideoBackends/Software/EfbInterface.cpp b/Source/Core/VideoBackends/Software/EfbInterface.cpp index ea066934d81..dffe392e6fb 100644 --- a/Source/Core/VideoBackends/Software/EfbInterface.cpp +++ b/Source/Core/VideoBackends/Software/EfbInterface.cpp @@ -552,7 +552,7 @@ namespace EfbInterface // Like CopyToXFB, but we copy directly into the opengl colour texture without going via Gamecube main memory or doing a yuyv conversion void BypassXFB(u8* texture, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma) { - if(fbWidth*fbHeight > 640*568) { + if (fbWidth*fbHeight > 640*568) { ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight); return; } diff --git a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp index ff2b4f0bb88..f9d01b7de5c 100644 --- a/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp +++ b/Source/Core/VideoBackends/Software/OpcodeDecoder.cpp @@ -139,7 +139,7 @@ void DecodeStandard(u32 bufferSize) DebugUtil::OnObjectBegin(); } #endif - switch(Cmd) + switch (Cmd) { case GX_NOP: break; @@ -250,7 +250,7 @@ bool CommandRunnable(u32 iBufferSize) u8 Cmd = DataPeek8(0); u32 minSize = 1; - switch(Cmd) + switch (Cmd) { case GX_LOAD_CP_REG: //0x08 minSize = 6; diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index 80be2adada2..7054fab3044 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -87,7 +87,7 @@ inline int iround(float x) int t; t = (int)x; - if((x - t) >= 0.5) + if ((x - t) >= 0.5) return t + 1; return t; @@ -149,7 +149,7 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi) // colors for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++) { - for(int comp = 0; comp < 4; comp++) + for (int comp = 0; comp < 4; comp++) { u16 color = (u16)ColorSlopes[i][comp].GetValue(dx, dy); @@ -299,7 +299,7 @@ void BuildBlock(s32 blockX, s32 blockY) { int stageOdd = i&1; TwoTevStageOrders &order = bpmem.tevorders[i >> 1]; - if(order.getEnable(stageOdd)) + if (order.getEnable(stageOdd)) { u32 texmap = order.getTexMap(stageOdd); u32 texcoord = order.getTexCoord(stageOdd); @@ -384,15 +384,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer if (!bpmem.genMode.zfreeze || !g_SWVideoConfig.bZFreeze) InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31); - for(unsigned int i = 0; i < bpmem.genMode.numcolchans; i++) + for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++) { - for(int comp = 0; comp < 4; comp++) + for (int comp = 0; comp < 4; comp++) InitSlope(&ColorSlopes[i][comp], v0->color[i][comp], v1->color[i][comp], v2->color[i][comp], fltdx31, fltdx12, fltdy12, fltdy31); } - for(unsigned int i = 0; i < bpmem.genMode.numtexgens; i++) + for (unsigned int i = 0; i < bpmem.genMode.numtexgens; i++) { - for(int comp = 0; comp < 3; comp++) + for (int comp = 0; comp < 3; comp++) InitSlope(&TexSlopes[i][comp], v0->texCoords[i][comp] * w[0], v1->texCoords[i][comp] * w[1], v2->texCoords[i][comp] * w[2], fltdx31, fltdx12, fltdy12, fltdy31); } @@ -406,14 +406,14 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer s32 C3 = DY31 * X3 - DX31 * Y3; // Correct for fill convention - if(DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++; - if(DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++; - if(DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++; + if (DY12 < 0 || (DY12 == 0 && DX12 > 0)) C1++; + if (DY23 < 0 || (DY23 == 0 && DX23 > 0)) C2++; + if (DY31 < 0 || (DY31 == 0 && DX31 > 0)) C3++; // Loop through blocks - for(s32 y = miny; y < maxy; y += BLOCK_SIZE) + for (s32 y = miny; y < maxy; y += BLOCK_SIZE) { - for(s32 x = minx; x < maxx; x += BLOCK_SIZE) + for (s32 x = minx; x < maxx; x += BLOCK_SIZE) { // Corners of block s32 x0 = x << 4; @@ -441,17 +441,17 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer int c = (c00 << 0) | (c10 << 1) | (c01 << 2) | (c11 << 3); // Skip block when outside an edge - if(a == 0x0 || b == 0x0 || c == 0x0) + if (a == 0x0 || b == 0x0 || c == 0x0) continue; BuildBlock(x, y); // Accept whole block when totally covered - if(a == 0xF && b == 0xF && c == 0xF) + if (a == 0xF && b == 0xF && c == 0xF) { - for(s32 iy = 0; iy < BLOCK_SIZE; iy++) + for (s32 iy = 0; iy < BLOCK_SIZE; iy++) { - for(s32 ix = 0; ix < BLOCK_SIZE; ix++) + for (s32 ix = 0; ix < BLOCK_SIZE; ix++) { Draw(x + ix, y + iy, ix, iy); } @@ -463,15 +463,15 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer s32 CY2 = C2 + DX23 * y0 - DY23 * x0; s32 CY3 = C3 + DX31 * y0 - DY31 * x0; - for(s32 iy = 0; iy < BLOCK_SIZE; iy++) + for (s32 iy = 0; iy < BLOCK_SIZE; iy++) { s32 CX1 = CY1; s32 CX2 = CY2; s32 CX3 = CY3; - for(s32 ix = 0; ix < BLOCK_SIZE; ix++) + for (s32 ix = 0; ix < BLOCK_SIZE; ix++) { - if(CX1 > 0 && CX2 > 0 && CX3 > 0) + if (CX1 > 0 && CX2 > 0 && CX3 > 0) { Draw(x + ix, y + iy, ix, iy); } diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index deb934ee2f8..8c1a7e40f8c 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -160,7 +160,7 @@ void SWRenderer::swapColorTexture() { void SWRenderer::UpdateColorTexture(EfbInterface::yuv422_packed *xfb, u32 fbWidth, u32 fbHeight) { - if(fbWidth*fbHeight > 640*568) { + if (fbWidth*fbHeight > 640*568) { ERROR_LOG(VIDEO, "Framebuffer is too large: %ix%i", fbWidth, fbHeight); return; } diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index 4651e444a40..60ab61300ee 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -223,7 +223,7 @@ void VideoSoftware::Video_EndField() } if (!g_SWVideoConfig.bHwRasterizer) { - if(!g_SWVideoConfig.bBypassXFB) + if (!g_SWVideoConfig.bBypassXFB) { EfbInterface::yuv422_packed *xfb = (EfbInterface::yuv422_packed *) Memory::GetPointer(s_beginFieldArgs.xfbAddr); diff --git a/Source/Core/VideoBackends/Software/SetupUnit.cpp b/Source/Core/VideoBackends/Software/SetupUnit.cpp index c324dcf767f..560e1d48630 100644 --- a/Source/Core/VideoBackends/Software/SetupUnit.cpp +++ b/Source/Core/VideoBackends/Software/SetupUnit.cpp @@ -22,7 +22,7 @@ void SetupUnit::Init(u8 primitiveType) void SetupUnit::SetupVertex() { - switch(m_PrimType) + switch (m_PrimType) { case GX_DRAW_QUADS: SetupQuad(); diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index dc4c4904cf7..ad21496e88d 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -126,7 +126,7 @@ inline s16 Clamp1024(s16 in) void Tev::SetRasColor(int colorChan, int swaptable) { - switch(colorChan) + switch (colorChan) { case 0: // Color0 { @@ -209,7 +209,7 @@ void Tev::DrawColorCompare(TevStageCombiner::ColorCombiner &cc) InputRegType InputReg; - switch(cmp) { + switch (cmp) { case TEVCMP_R8_GT: { a = *m_ColorInputLUT[cc.a][RED_INP] & 0xff; @@ -336,7 +336,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac) InputRegType InputReg; - switch(cmp) { + switch (cmp) { case TEVCMP_R8_GT: { a = m_AlphaInputLUT[ac.a][RED_C] & 0xff; @@ -415,7 +415,7 @@ void Tev::DrawAlphaCompare(TevStageCombiner::AlphaCombiner &ac) static bool AlphaCompare(int alpha, int ref, int comp) { - switch(comp) { + switch (comp) { case ALPHACMP_ALWAYS: return true; case ALPHACMP_NEVER: return false; case ALPHACMP_LEQUAL: return alpha <= ref; @@ -497,7 +497,7 @@ void Tev::Indirect(unsigned int stageNum, s32 s, s32 t) bias[2] = indirect.bias&4?biasValue:0; // format - switch(indirect.fmt) + switch (indirect.fmt) { case ITF_8: indcoord[0] = indmap[TextureSampler::ALP_SMP] + bias[0]; @@ -756,7 +756,7 @@ void Tev::Draw() } - if(bpmem.fogRange.Base.Enabled) + if (bpmem.fogRange.Base.Enabled) { // TODO: This is untested and should definitely be checked against real hw. // - No idea if offset is really normalized against the viewport width or against the projection matrix or yet something else diff --git a/Source/Core/VideoBackends/Software/TextureEncoder.cpp b/Source/Core/VideoBackends/Software/TextureEncoder.cpp index 6c24257fe3f..cf99dbf911a 100644 --- a/Source/Core/VideoBackends/Software/TextureEncoder.cpp +++ b/Source/Core/VideoBackends/Software/TextureEncoder.cpp @@ -261,7 +261,7 @@ void EncodeRGBA6(u8 *dst, u8 *src, u32 format) u32 readStride = 3; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_I4: SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize); @@ -498,7 +498,7 @@ void EncodeRGBA6halfscale(u8 *dst, u8 *src, u32 format) u32 readStride = 6; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_I4: SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize); @@ -732,7 +732,7 @@ void EncodeRGB8(u8 *dst, u8 *src, u32 format) u32 readStride = 3; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_I4: SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize); @@ -947,7 +947,7 @@ void EncodeRGB8halfscale(u8 *dst, u8 *src, u32 format) u32 readStride = 6; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_I4: SetBlockDimensions(3, 3, sBlkCount, tBlkCount, sBlkSize, tBlkSize); @@ -1177,7 +1177,7 @@ void EncodeZ24(u8 *dst, u8 *src, u32 format) u32 readStride = 3; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_Z8: SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize); @@ -1282,7 +1282,7 @@ void EncodeZ24halfscale(u8 *dst, u8 *src, u32 format) u8 r, g, b; u8 *dstBlockStart = dst; - switch(format) + switch (format) { case GX_TF_Z8: SetBlockDimensions(3, 2, sBlkCount, tBlkCount, sBlkSize, tBlkSize); diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index 3089aa85f21..411d2daa004 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -324,7 +324,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height) if (s_Stream->codec->coded_frame->pts != (unsigned int)AV_NOPTS_VALUE) pkt.pts = av_rescale_q(s_Stream->codec->coded_frame->pts, s_Stream->codec->time_base, s_Stream->time_base); - if(s_Stream->codec->coded_frame->key_frame) + if (s_Stream->codec->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = s_Stream->index; pkt.data = s_OutBuffer; diff --git a/Source/Core/VideoCommon/BPMemory.h b/Source/Core/VideoCommon/BPMemory.h index 35f1e79d9b0..2c5a0811f0d 100644 --- a/Source/Core/VideoCommon/BPMemory.h +++ b/Source/Core/VideoCommon/BPMemory.h @@ -340,9 +340,9 @@ struct TevStageCombiner // several discoveries: // GXSetTevIndBumpST(tevstage, indstage, matrixind) -// if( matrix == 2 ) realmat = 6; // 10 -// else if( matrix == 3 ) realmat = 7; // 11 -// else if( matrix == 1 ) realmat = 5; // 9 +// if ( matrix == 2 ) realmat = 6; // 10 +// else if ( matrix == 3 ) realmat = 7; // 11 +// else if ( matrix == 1 ) realmat = 5; // 9 // GXSetTevIndirect(tevstage, indstage, 0, 3, realmat, 6, 6, 0, 0, 0) // GXSetTevIndirect(tevstage+1, indstage, 0, 3, realmat+4, 6, 6, 1, 0, 0) // GXSetTevIndirect(tevstage+2, indstage, 0, 0, 0, 0, 0, 1, 0, 0) @@ -886,7 +886,7 @@ union AlphaTest inline TEST_RESULT TestResult() const { - switch(logic) + switch (logic) { case 0: // AND if (comp0 == ALPHACMP_ALWAYS && comp1 == ALPHACMP_ALWAYS) diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 19df3ba0088..ff60ff63920 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -66,17 +66,17 @@ void BPWritten(const BPCmd& bp) if (((s32*)&bpmem)[bp.address] == bp.newvalue) { - if (!(bp.address == BPMEM_TRIGGER_EFB_COPY - || bp.address == BPMEM_CLEARBBOX1 - || bp.address == BPMEM_CLEARBBOX2 - || bp.address == BPMEM_SETDRAWDONE - || bp.address == BPMEM_PE_TOKEN_ID - || bp.address == BPMEM_PE_TOKEN_INT_ID - || bp.address == BPMEM_LOADTLUT0 - || bp.address == BPMEM_LOADTLUT1 - || bp.address == BPMEM_TEXINVALIDATE - || bp.address == BPMEM_PRELOAD_MODE - || bp.address == BPMEM_CLEAR_PIXEL_PERF)) + if (!(bp.address == BPMEM_TRIGGER_EFB_COPY || + bp.address == BPMEM_CLEARBBOX1 || + bp.address == BPMEM_CLEARBBOX2 || + bp.address == BPMEM_SETDRAWDONE || + bp.address == BPMEM_PE_TOKEN_ID || + bp.address == BPMEM_PE_TOKEN_INT_ID || + bp.address == BPMEM_LOADTLUT0 || + bp.address == BPMEM_LOADTLUT1 || + bp.address == BPMEM_TEXINVALIDATE || + bp.address == BPMEM_PRELOAD_MODE || + bp.address == BPMEM_CLEAR_PIXEL_PERF)) { return; } @@ -91,9 +91,9 @@ void BPWritten(const BPCmd& bp) case BPMEM_GENMODE: // Set the Generation Mode { PRIM_LOG("genmode: texgen=%d, col=%d, multisampling=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d", - bpmem.genMode.numtexgens, bpmem.genMode.numcolchans, - bpmem.genMode.multisampling, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode, - bpmem.genMode.numindstages, bpmem.genMode.zfreeze); + bpmem.genMode.numtexgens, bpmem.genMode.numcolchans, + bpmem.genMode.multisampling, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode, + bpmem.genMode.numindstages, bpmem.genMode.zfreeze); // Only call SetGenerationMode when cull mode changes. if (bp.changes & 0xC000) @@ -109,15 +109,15 @@ void BPWritten(const BPCmd& bp) case BPMEM_IND_MTXA+6: case BPMEM_IND_MTXB+6: case BPMEM_IND_MTXC+6: - if(bp.changes) + if (bp.changes) PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3); break; case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0 - if(bp.changes) + if (bp.changes) PixelShaderManager::SetIndTexScaleChanged(false); break; case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1 - if(bp.changes) + if (bp.changes) PixelShaderManager::SetIndTexScaleChanged(true); break; // ---------------- @@ -166,9 +166,9 @@ void BPWritten(const BPCmd& bp) case BPMEM_CONSTANTALPHA: // Set Destination Alpha { PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable); - if(bp.changes & 0xFF) + if (bp.changes & 0xFF) PixelShaderManager::SetDestAlpha(); - if(bp.changes & 0x100) + if (bp.changes & 0x100) SetBlendMode(); break; } @@ -306,14 +306,14 @@ void BPWritten(const BPCmd& bp) case BPMEM_ALPHACOMPARE: // Compare Alpha Values PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alpha_test.ref0, bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1, bpmem.alpha_test.logic); - if(bp.changes & 0xFFFF) + if (bp.changes & 0xFFFF) PixelShaderManager::SetAlpha(); - if(bp.changes) + if (bp.changes) g_renderer->SetColorMask(); break; case BPMEM_BIAS: // BIAS PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias); - if(bp.changes) + if (bp.changes) PixelShaderManager::SetZTextureBias(); break; case BPMEM_ZTEX2: // Z Texture type @@ -390,7 +390,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format OnPixelFormatChange(); - if(bp.changes & 7) + if (bp.changes & 7) { SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24 g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel @@ -424,7 +424,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_CLEAR_PIXEL_PERF: // GXClearPixMetric writes 0xAAA here, Sunshine alternates this register between values 0x000 and 0xAAA - if(PerfQueryBase::ShouldEmulate()) + if (PerfQueryBase::ShouldEmulate()) g_perf_query->ResetQuery(); break; @@ -505,7 +505,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_SU_TSIZE+12: case BPMEM_SU_SSIZE+14: case BPMEM_SU_TSIZE+14: - if(bp.changes) + if (bp.changes) PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1); break; // ------------------------ diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index 0ccd2517180..e92e3560f54 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -310,8 +310,9 @@ void STACKALIGN GatherPipeBursted() { // In multibuffer mode is not allowed write in the same FIFO attached to the GPU. // Fix Pokemon XD in DC mode. - if((ProcessorInterface::Fifo_CPUEnd == fifo.CPEnd) && (ProcessorInterface::Fifo_CPUBase == fifo.CPBase) - && fifo.CPReadWriteDistance > 0) + if ((ProcessorInterface::Fifo_CPUEnd == fifo.CPEnd) && + (ProcessorInterface::Fifo_CPUBase == fifo.CPBase) && + fifo.CPReadWriteDistance > 0) { ProcessFifoAllDistance(); } @@ -509,17 +510,17 @@ void SetCpControlRegister() fifo.bFF_LoWatermarkInt = m_CPCtrlReg.FifoUnderflowIntEnable; fifo.bFF_GPLinkEnable = m_CPCtrlReg.GPLinkEnable; - if(m_CPCtrlReg.GPReadEnable && m_CPCtrlReg.GPLinkEnable) + if (m_CPCtrlReg.GPReadEnable && m_CPCtrlReg.GPLinkEnable) { ProcessorInterface::Fifo_CPUWritePointer = fifo.CPWritePointer; ProcessorInterface::Fifo_CPUBase = fifo.CPBase; ProcessorInterface::Fifo_CPUEnd = fifo.CPEnd; } - if(fifo.bFF_GPReadEnable && !m_CPCtrlReg.GPReadEnable) + if (fifo.bFF_GPReadEnable && !m_CPCtrlReg.GPReadEnable) { fifo.bFF_GPReadEnable = m_CPCtrlReg.GPReadEnable; - while(fifo.isGpuReadingData) Common::YieldCPU(); + while (fifo.isGpuReadingData) Common::YieldCPU(); } else { diff --git a/Source/Core/VideoCommon/Debugger.cpp b/Source/Core/VideoCommon/Debugger.cpp index bd711439a96..98db44bd050 100644 --- a/Source/Core/VideoCommon/Debugger.cpp +++ b/Source/Core/VideoCommon/Debugger.cpp @@ -54,7 +54,7 @@ void GFXDebuggerCheckAndPause(bool update) if (GFXDebuggerPauseFlag) { g_pdebugger->OnPause(); - while( GFXDebuggerPauseFlag ) + while ( GFXDebuggerPauseFlag ) { g_video_backend->UpdateFPSDisplay("Paused by Video Debugger"); @@ -93,7 +93,7 @@ void GFXDebuggerBase::DumpPixelShader(const char* path) } else { - if(g_ActiveConfig.backend_info.bSupportsDualSourceBlend) + if (g_ActiveConfig.backend_info.bSupportsDualSourceBlend) { output = "Using dual source blending for destination alpha:\n"; /// output += GeneratePixelShaderCode(DSTALPHA_DUAL_SOURCE_BLEND, g_ActiveConfig.backend_info.APIType, g_nativeVertexFmt->m_components); diff --git a/Source/Core/VideoCommon/DriverDetails.cpp b/Source/Core/VideoCommon/DriverDetails.cpp index 1a0475f0a6d..6880b1ce608 100644 --- a/Source/Core/VideoCommon/DriverDetails.cpp +++ b/Source/Core/VideoCommon/DriverDetails.cpp @@ -69,7 +69,7 @@ namespace DriverDetails m_family = family; if (driver == DRIVER_UNKNOWN) - switch(vendor) + switch (vendor) { case VENDOR_NVIDIA: case VENDOR_TEGRA: @@ -91,15 +91,14 @@ namespace DriverDetails break; } - for(auto& bug : m_known_bugs) + for (auto& bug : m_known_bugs) { - if( - ( bug.m_os & m_os ) && - ( bug.m_vendor == m_vendor || bug.m_vendor == VENDOR_ALL ) && - ( bug.m_driver == m_driver || bug.m_driver == DRIVER_ALL ) && - ( bug.m_family == m_family || bug.m_family == -1) && - ( bug.m_versionstart <= m_version || bug.m_versionstart == -1 ) && - ( bug.m_versionend > m_version || bug.m_versionend == -1 ) + if (( bug.m_os & m_os ) && + ( bug.m_vendor == m_vendor || bug.m_vendor == VENDOR_ALL ) && + ( bug.m_driver == m_driver || bug.m_driver == DRIVER_ALL ) && + ( bug.m_family == m_family || bug.m_family == -1) && + ( bug.m_versionstart <= m_version || bug.m_versionstart == -1 ) && + ( bug.m_versionend > m_version || bug.m_versionend == -1 ) ) m_bugs.insert(std::make_pair(bug.m_bug, bug)); } diff --git a/Source/Core/VideoCommon/EmuWindow.cpp b/Source/Core/VideoCommon/EmuWindow.cpp index 46c2b4ffa03..8030316d310 100644 --- a/Source/Core/VideoCommon/EmuWindow.cpp +++ b/Source/Core/VideoCommon/EmuWindow.cpp @@ -43,7 +43,7 @@ HWND GetParentWnd() LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) { - switch( iMsg ) + switch ( iMsg ) { case WM_PAINT: { @@ -65,7 +65,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) /* Post the mouse events to the main window, it's necessary, because the difference between the keyboard inputs is that these events only appear here, not in the parent window or any other WndProc()*/ case WM_LBUTTONDOWN: - if(g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision) + if (g_ActiveConfig.backend_info.bSupports3DVision && g_ActiveConfig.b3DVision) { // This basically throws away the left button down input when b3DVision is activated so WX // can't get access to it, stopping focus pulling on mouse click. diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp index 02e80ceccf4..2886498acb2 100644 --- a/Source/Core/VideoCommon/Fifo.cpp +++ b/Source/Core/VideoCommon/Fifo.cpp @@ -95,7 +95,7 @@ void ExitGpuLoop() // This should break the wait loop in CPU thread CommandProcessor::fifo.bFF_GPReadEnable = false; SCPFifoStruct &fifo = CommandProcessor::fifo; - while(fifo.isGpuReadingData) Common::YieldCPU(); + while (fifo.isGpuReadingData) Common::YieldCPU(); // Terminate GPU thread loop GpuRunningState = false; EmuRunningState = true; @@ -180,7 +180,7 @@ void RunGpuLoop() Common::AtomicStore(fifo.CPReadPointer, readPtr); Common::AtomicAdd(fifo.CPReadWriteDistance, -32); - if((GetVideoBufferEndPtr() - g_pVideoData) == 0) + if ((GetVideoBufferEndPtr() - g_pVideoData) == 0) Common::AtomicStore(fifo.SafeCPReadPointer, fifo.CPReadPointer); } diff --git a/Source/Core/VideoCommon/IndexGenerator.cpp b/Source/Core/VideoCommon/IndexGenerator.cpp index 0989b652832..949ee342b1c 100644 --- a/Source/Core/VideoCommon/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/IndexGenerator.cpp @@ -19,7 +19,7 @@ static u16* (*primitive_table[8])(u16*, u32, u32); void IndexGenerator::Init() { - if(g_Config.backend_info.bSupportsPrimitiveRestart) + if (g_Config.backend_info.bSupportsPrimitiveRestart) { primitive_table[0] = IndexGenerator::AddQuads; primitive_table[2] = IndexGenerator::AddList; @@ -58,7 +58,7 @@ template __forceinline u16* IndexGenerator::WriteTriangle(u16 *Iptr, u *Iptr++ = index1; *Iptr++ = index2; *Iptr++ = index3; - if(pr) + if (pr) *Iptr++ = s_primitive_restart; return Iptr; } @@ -74,7 +74,7 @@ template u16* IndexGenerator::AddList(u16 *Iptr, u32 const numVerts, u template u16* IndexGenerator::AddStrip(u16 *Iptr, u32 const numVerts, u32 index) { - if(pr) + if (pr) { for (u32 i = 0; i < numVerts; ++i) { @@ -122,9 +122,9 @@ template u16* IndexGenerator::AddFan(u16 *Iptr, u32 numVerts, u32 inde { u32 i = 2; - if(pr) + if (pr) { - for(; i+3<=numVerts; i+=3) + for (; i+3<=numVerts; i+=3) { *Iptr++ = index + i - 1; *Iptr++ = index + i + 0; @@ -134,7 +134,7 @@ template u16* IndexGenerator::AddFan(u16 *Iptr, u32 numVerts, u32 inde *Iptr++ = s_primitive_restart; } - for(; i+2<=numVerts; i+=2) + for (; i+2<=numVerts; i+=2) { *Iptr++ = index + i - 1; *Iptr++ = index + i + 0; @@ -173,7 +173,7 @@ template u16* IndexGenerator::AddQuads(u16 *Iptr, u32 numVerts, u32 in u32 i = 3; for (; i < numVerts; i+=4) { - if(pr) + if (pr) { *Iptr++ = index + i - 2; *Iptr++ = index + i - 1; @@ -189,7 +189,7 @@ template u16* IndexGenerator::AddQuads(u16 *Iptr, u32 numVerts, u32 in } // three vertices remaining, so render a triangle - if(i == numVerts) + if (i == numVerts) { Iptr = WriteTriangle(Iptr, index+numVerts-3, index+numVerts-2, index+numVerts-1); } diff --git a/Source/Core/VideoCommon/LightingShaderGen.h b/Source/Core/VideoCommon/LightingShaderGen.h index 9379f65775b..7afcff2ef76 100644 --- a/Source/Core/VideoCommon/LightingShaderGen.h +++ b/Source/Core/VideoCommon/LightingShaderGen.h @@ -207,7 +207,7 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com object.Write("lacc.w = 1.0;\n"); } - if(color.enablelighting && alpha.enablelighting) + if (color.enablelighting && alpha.enablelighting) { // both have lighting, test if they use the same lights int mask = 0; @@ -217,10 +217,10 @@ static void GenerateLightingShader(T& object, LightingUidData& uid_data, int com uid_data.diffusefunc |= alpha.diffusefunc << (2*(j+2)); uid_data.light_mask |= color.GetFullLightMask() << (8*j); uid_data.light_mask |= alpha.GetFullLightMask() << (8*(j+2)); - if(color.lightparams == alpha.lightparams) + if (color.lightparams == alpha.lightparams) { mask = color.GetFullLightMask() & alpha.GetFullLightMask(); - if(mask) + if (mask) { for (int i = 0; i < 8; ++i) { diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index 8694fe2d1a6..f491d06f975 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -68,7 +68,7 @@ void VideoBackendHardware::Video_SetRendering(bool bEnabled) // Run from the graphics thread (from Fifo.cpp) void VideoFifo_CheckSwapRequest() { - if(g_ActiveConfig.bUseXFB) + if (g_ActiveConfig.bUseXFB) { if (Common::AtomicLoadAcquire(s_swapRequested)) { @@ -84,7 +84,7 @@ void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight) { if (g_ActiveConfig.bUseXFB) { - if(Common::AtomicLoadAcquire(s_swapRequested)) + if (Common::AtomicLoadAcquire(s_swapRequested)) { u32 aLower = xfbAddr; u32 aUpper = xfbAddr + 2 * fbWidth * fbHeight; @@ -194,7 +194,7 @@ void VideoFifo_CheckPerfQueryRequest() u32 VideoBackendHardware::Video_GetQueryResult(PerfQueryType type) { - if(!g_perf_query->ShouldEmulate()) + if (!g_perf_query->ShouldEmulate()) { return 0; } diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 7ea6d55daaf..1e4a8b41ec7 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -37,7 +37,7 @@ void AddMessage(const std::string& str, u32 ms) void DrawMessages() { - if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages) return; int left = 25, top = 15; diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 1b8bae79352..9f634d4def3 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -371,7 +371,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T for (unsigned int i = 0; i < numTexgen; ++i) out.Write(",\n in %s float3 uv%d : TEXCOORD%d", optCentroid, i, i); out.Write(",\n in %s float4 clipPos : TEXCOORD%d", optCentroid, numTexgen); - if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) + if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) out.Write(",\n in %s float4 Normal : TEXCOORD%d", optCentroid, numTexgen + 1); out.Write(" ) {\n"); } @@ -484,7 +484,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T RegisterStates[0].AlphaNeedOverflowControl = false; RegisterStates[0].ColorNeedOverflowControl = false; RegisterStates[0].AuxStored = false; - for(int i = 1; i < 4; i++) + for (int i = 1; i < 4; i++) { RegisterStates[i].AlphaNeedOverflowControl = true; RegisterStates[i].ColorNeedOverflowControl = true; @@ -515,13 +515,13 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T { // The results of the last texenv stage are put onto the screen, // regardless of the used destination register - if(bpmem.combiners[numStages - 1].colorC.dest != 0) + if (bpmem.combiners[numStages - 1].colorC.dest != 0) { bool retrieveFromAuxRegister = !RegisterStates[bpmem.combiners[numStages - 1].colorC.dest].ColorNeedOverflowControl && RegisterStates[bpmem.combiners[numStages - 1].colorC.dest].AuxStored; out.Write("\tprev.rgb = %s%s;\n", retrieveFromAuxRegister ? "c" : "" , tevCOutputTable[bpmem.combiners[numStages - 1].colorC.dest]); RegisterStates[0].ColorNeedOverflowControl = RegisterStates[bpmem.combiners[numStages - 1].colorC.dest].ColorNeedOverflowControl; } - if(bpmem.combiners[numStages - 1].alphaC.dest != 0) + if (bpmem.combiners[numStages - 1].alphaC.dest != 0) { bool retrieveFromAuxRegister = !RegisterStates[bpmem.combiners[numStages - 1].alphaC.dest].AlphaNeedOverflowControl && RegisterStates[bpmem.combiners[numStages - 1].alphaC.dest].AuxStored; out.Write("\tprev.a = %s%s;\n", retrieveFromAuxRegister ? "c" : "" , tevAOutputTable[bpmem.combiners[numStages - 1].alphaC.dest]); @@ -529,7 +529,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T } } // emulation of unsigned 8 overflow when casting if needed - if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) + if (RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) out.Write("\tprev = frac(prev * (255.0/256.0)) * (256.0/255.0);\n"); AlphaTest::TEST_RESULT Pretest = bpmem.alpha_test.TestResult(); @@ -766,12 +766,12 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP uid_data.stagehash[n].cc = cc.hex & 0xFFFFFF; uid_data.stagehash[n].ac = ac.hex & 0xFFFFF0; // Storing rswap and tswap later - if(cc.a == TEVCOLORARG_RASA || cc.a == TEVCOLORARG_RASC - || cc.b == TEVCOLORARG_RASA || cc.b == TEVCOLORARG_RASC - || cc.c == TEVCOLORARG_RASA || cc.c == TEVCOLORARG_RASC - || cc.d == TEVCOLORARG_RASA || cc.d == TEVCOLORARG_RASC - || ac.a == TEVALPHAARG_RASA || ac.b == TEVALPHAARG_RASA - || ac.c == TEVALPHAARG_RASA || ac.d == TEVALPHAARG_RASA) + if (cc.a == TEVCOLORARG_RASA || cc.a == TEVCOLORARG_RASC || + cc.b == TEVCOLORARG_RASA || cc.b == TEVCOLORARG_RASC || + cc.c == TEVCOLORARG_RASA || cc.c == TEVCOLORARG_RASC || + cc.d == TEVCOLORARG_RASA || cc.d == TEVCOLORARG_RASC || + ac.a == TEVALPHAARG_RASA || ac.b == TEVALPHAARG_RASA || + ac.c == TEVALPHAARG_RASA || ac.d == TEVALPHAARG_RASA) { const int i = bpmem.combiners[n].alphaC.rswap; uid_data.stagehash[n].ac |= bpmem.combiners[n].alphaC.rswap; @@ -792,7 +792,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP if (!bHasIndStage) { // calc tevcord - if(bHasTexCoord) + if (bHasTexCoord) out.Write("tevcoord.xy = uv%d.xy;\n", texcoord); else out.Write("tevcoord.xy = float2(0.0, 0.0);\n"); @@ -820,15 +820,17 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP } - if (cc.a == TEVCOLORARG_KONST || cc.b == TEVCOLORARG_KONST || cc.c == TEVCOLORARG_KONST || cc.d == TEVCOLORARG_KONST - || ac.a == TEVALPHAARG_KONST || ac.b == TEVALPHAARG_KONST || ac.c == TEVALPHAARG_KONST || ac.d == TEVALPHAARG_KONST) + if (cc.a == TEVCOLORARG_KONST || cc.b == TEVCOLORARG_KONST || + cc.c == TEVCOLORARG_KONST || cc.d == TEVCOLORARG_KONST || + ac.a == TEVALPHAARG_KONST || ac.b == TEVALPHAARG_KONST || + ac.c == TEVALPHAARG_KONST || ac.d == TEVALPHAARG_KONST) { int kc = bpmem.tevksel[n / 2].getKC(n & 1); int ka = bpmem.tevksel[n / 2].getKA(n & 1); uid_data.stagehash[n].tevksel_kc = kc; uid_data.stagehash[n].tevksel_ka = ka; out.Write("konsttemp = float4(%s, %s);\n", tevKSelTableC[kc], tevKSelTableA[ka]); - if(kc > 7 || ka > 7) + if (kc > 7 || ka > 7) { out.Write("ckonsttemp = frac(konsttemp * (255.0/256.0)) * (256.0/255.0);\n"); } @@ -842,12 +844,13 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP out.SetConstantsUsed(C_KCOLORS+((ka-0xc)%4),C_KCOLORS+((ka-0xc)%4)); } - if(cc.a == TEVCOLORARG_CPREV || cc.a == TEVCOLORARG_APREV - || cc.b == TEVCOLORARG_CPREV || cc.b == TEVCOLORARG_APREV - || cc.c == TEVCOLORARG_CPREV || cc.c == TEVCOLORARG_APREV - || ac.a == TEVALPHAARG_APREV || ac.b == TEVALPHAARG_APREV || ac.c == TEVALPHAARG_APREV) + if (cc.a == TEVCOLORARG_CPREV || cc.a == TEVCOLORARG_APREV || + cc.b == TEVCOLORARG_CPREV || cc.b == TEVCOLORARG_APREV || + cc.c == TEVCOLORARG_CPREV || cc.c == TEVCOLORARG_APREV || + ac.a == TEVALPHAARG_APREV || ac.b == TEVALPHAARG_APREV || + ac.c == TEVALPHAARG_APREV) { - if(RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) + if (RegisterStates[0].AlphaNeedOverflowControl || RegisterStates[0].ColorNeedOverflowControl) { out.Write("cprev = frac(prev * (255.0/256.0)) * (256.0/255.0);\n"); RegisterStates[0].AlphaNeedOverflowControl = false; @@ -860,13 +863,14 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP RegisterStates[0].AuxStored = true; } - if(cc.a == TEVCOLORARG_C0 || cc.a == TEVCOLORARG_A0 - || cc.b == TEVCOLORARG_C0 || cc.b == TEVCOLORARG_A0 - || cc.c == TEVCOLORARG_C0 || cc.c == TEVCOLORARG_A0 - || ac.a == TEVALPHAARG_A0 || ac.b == TEVALPHAARG_A0 || ac.c == TEVALPHAARG_A0) + if (cc.a == TEVCOLORARG_C0 || cc.a == TEVCOLORARG_A0 || + cc.b == TEVCOLORARG_C0 || cc.b == TEVCOLORARG_A0 || + cc.c == TEVCOLORARG_C0 || cc.c == TEVCOLORARG_A0 || + ac.a == TEVALPHAARG_A0 || ac.b == TEVALPHAARG_A0 || + ac.c == TEVALPHAARG_A0) { out.SetConstantsUsed(C_COLORS+1,C_COLORS+1); - if(RegisterStates[1].AlphaNeedOverflowControl || RegisterStates[1].ColorNeedOverflowControl) + if (RegisterStates[1].AlphaNeedOverflowControl || RegisterStates[1].ColorNeedOverflowControl) { out.Write("cc0 = frac(c0 * (255.0/256.0)) * (256.0/255.0);\n"); RegisterStates[1].AlphaNeedOverflowControl = false; @@ -879,13 +883,14 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP RegisterStates[1].AuxStored = true; } - if(cc.a == TEVCOLORARG_C1 || cc.a == TEVCOLORARG_A1 - || cc.b == TEVCOLORARG_C1 || cc.b == TEVCOLORARG_A1 - || cc.c == TEVCOLORARG_C1 || cc.c == TEVCOLORARG_A1 - || ac.a == TEVALPHAARG_A1 || ac.b == TEVALPHAARG_A1 || ac.c == TEVALPHAARG_A1) + if (cc.a == TEVCOLORARG_C1 || cc.a == TEVCOLORARG_A1 || + cc.b == TEVCOLORARG_C1 || cc.b == TEVCOLORARG_A1 || + cc.c == TEVCOLORARG_C1 || cc.c == TEVCOLORARG_A1 || + ac.a == TEVALPHAARG_A1 || ac.b == TEVALPHAARG_A1 || + ac.c == TEVALPHAARG_A1) { out.SetConstantsUsed(C_COLORS+2,C_COLORS+2); - if(RegisterStates[2].AlphaNeedOverflowControl || RegisterStates[2].ColorNeedOverflowControl) + if (RegisterStates[2].AlphaNeedOverflowControl || RegisterStates[2].ColorNeedOverflowControl) { out.Write("cc1 = frac(c1 * (255.0/256.0)) * (256.0/255.0);\n"); RegisterStates[2].AlphaNeedOverflowControl = false; @@ -898,13 +903,14 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP RegisterStates[2].AuxStored = true; } - if(cc.a == TEVCOLORARG_C2 || cc.a == TEVCOLORARG_A2 - || cc.b == TEVCOLORARG_C2 || cc.b == TEVCOLORARG_A2 - || cc.c == TEVCOLORARG_C2 || cc.c == TEVCOLORARG_A2 - || ac.a == TEVALPHAARG_A2 || ac.b == TEVALPHAARG_A2 || ac.c == TEVALPHAARG_A2) + if (cc.a == TEVCOLORARG_C2 || cc.a == TEVCOLORARG_A2 || + cc.b == TEVCOLORARG_C2 || cc.b == TEVCOLORARG_A2 || + cc.c == TEVCOLORARG_C2 || cc.c == TEVCOLORARG_A2 || + ac.a == TEVALPHAARG_A2 || ac.b == TEVALPHAARG_A2 || + ac.c == TEVALPHAARG_A2) { out.SetConstantsUsed(C_COLORS+3,C_COLORS+3); - if(RegisterStates[3].AlphaNeedOverflowControl || RegisterStates[3].ColorNeedOverflowControl) + if (RegisterStates[3].AlphaNeedOverflowControl || RegisterStates[3].ColorNeedOverflowControl) { out.Write("cc2 = frac(c2 * (255.0/256.0)) * (256.0/255.0);\n"); RegisterStates[3].AlphaNeedOverflowControl = false; @@ -948,7 +954,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP if (cc.shift > TEVSCALE_1) out.Write("%s*(", tevScaleTable[cc.shift]); - if(!(cc.d == TEVCOLORARG_ZERO && cc.op == TEVOP_ADD)) + if (!(cc.d == TEVCOLORARG_ZERO && cc.op == TEVOP_ADD)) out.Write("%s%s", tevCInputTable[cc.d], tevOpTable[cc.op]); if (cc.a == cc.b) @@ -997,7 +1003,7 @@ static inline void WriteStage(T& out, pixel_shader_uid_data& uid_data, int n, AP if (ac.shift > TEVSCALE_1) out.Write("%s*(", tevScaleTable[ac.shift]); - if(!(ac.d == TEVALPHAARG_ZERO && ac.op == TEVOP_ADD)) + if (!(ac.d == TEVALPHAARG_ZERO && ac.op == TEVOP_ADD)) out.Write("%s.a%s", tevAInputTable[ac.d], tevOpTable[ac.op]); if (ac.a == ac.b) @@ -1095,7 +1101,7 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_T out.Write("\t\tocol0 = float4(0.0, 0.0, 0.0, 0.0);\n"); if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND) out.Write("\t\tocol1 = float4(0.0, 0.0, 0.0, 0.0);\n"); - if(per_pixel_depth) + if (per_pixel_depth) out.Write("\t\tdepth = 1.0;\n"); // HAXX: zcomploc (aka early_ztest) is a way to control whether depth test is done before @@ -1138,7 +1144,7 @@ template static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data) { uid_data.fog_fsel = bpmem.fog.c_proj_fsel.fsel; - if(bpmem.fog.c_proj_fsel.fsel == 0) + if (bpmem.fog.c_proj_fsel.fsel == 0) return; // no Fog uid_data.fog_proj = bpmem.fog.c_proj_fsel.proj; diff --git a/Source/Core/VideoCommon/PixelShaderManager.cpp b/Source/Core/VideoCommon/PixelShaderManager.cpp index 74cc5c1be3d..9ed7ff2a766 100644 --- a/Source/Core/VideoCommon/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/PixelShaderManager.cpp @@ -72,7 +72,7 @@ void PixelShaderManager::SetConstants() { // set by two components, so keep changed flag here // TODO: try to split both registers and move this logic to the shader - if(!g_ActiveConfig.bDisableFog && bpmem.fogRange.Base.Enabled == 1) + if (!g_ActiveConfig.bDisableFog && bpmem.fogRange.Base.Enabled == 1) { //bpmem.fogRange.Base.Center : center of the viewport in x axis. observation: bpmem.fogRange.Base.Center = realcenter + 342; int center = ((u32)bpmem.fogRange.Base.Center) - 342; @@ -137,7 +137,7 @@ void PixelShaderManager::SetConstants() } } - if(s_bViewPortChanged) + if (s_bViewPortChanged) { constants.zbias[1][0] = xfregs.viewport.farZ / 16777216.0f; constants.zbias[1][1] = xfregs.viewport.zRange / 16777216.0f; @@ -179,7 +179,7 @@ void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height, u32 wra { // TODO: move this check out to callee. There we could just call this function on texture changes // or better, use textureSize() in glsl - if(constants.texdims[texmapid][0] != 1.0f/width || constants.texdims[texmapid][1] != 1.0f/height) + if (constants.texdims[texmapid][0] != 1.0f/width || constants.texdims[texmapid][1] != 1.0f/height) dirty = true; constants.texdims[texmapid][0] = 1.0f/width; @@ -280,7 +280,7 @@ void PixelShaderManager::SetFogColorChanged() void PixelShaderManager::SetFogParamChanged() { - if(!g_ActiveConfig.bDisableFog) + if (!g_ActiveConfig.bDisableFog) { constants.fog[1][0] = bpmem.fog.a.GetA(); constants.fog[1][1] = (float)bpmem.fog.b_magnitude / 0xFFFFFF; @@ -324,7 +324,7 @@ void PixelShaderManager::InvalidateXFRange(int start, int end) void PixelShaderManager::SetMaterialColorChanged(int index, u32 color) { - if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) + if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { constants.pmaterials[index][0] = ((color >> 24) & 0xFF) / 255.0f; constants.pmaterials[index][1] = ((color >> 16) & 0xFF) / 255.0f; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 52668c4511f..ec15fe131bb 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -288,7 +288,7 @@ void Renderer::DrawDebugText() } const char* ar_text = ""; - switch(g_ActiveConfig.iAspectRatio) + switch (g_ActiveConfig.iAspectRatio) { case ASPECT_AUTO: ar_text = "Auto"; diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index c5f4f127f20..7bbbc4aff63 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -46,7 +46,7 @@ TextureCache::TextureCache() TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter); - if(g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures) + if (g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures) HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures); @@ -88,7 +88,7 @@ void TextureCache::OnConfigChanged(VideoConfig& config) { g_texture_cache->Invalidate(); - if(g_ActiveConfig.bHiresTextures) + if (g_ActiveConfig.bHiresTextures) HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str()); SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures); @@ -125,10 +125,9 @@ void TextureCache::Cleanup() TexCache::iterator tcend = textures.end(); while (iter != tcend) { - if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount - - // EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted - && ! iter->second->IsEfbCopy() ) + if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount && + // EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted + !iter->second->IsEfbCopy()) { delete iter->second; textures.erase(iter++); @@ -421,9 +420,14 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, // // TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies? // TODO: Actually, it should be enough if the internal texture format matches... - if ((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height - && full_format == entry->format && entry->num_mipmaps > maxlevel) - || (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height)) + if ((entry->type == TCET_NORMAL && + width == entry->virtual_width && + height == entry->virtual_height && + full_format == entry->format && + entry->num_mipmaps > maxlevel) || + (entry->type == TCET_EC_DYNAMIC && + entry->native_width == width && + entry->native_height == height)) { // reuse the texture } @@ -449,7 +453,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, expandedHeight = height; // If we thought we could reuse the texture before, make sure to pool it now! - if(entry) + if (entry) { delete entry; entry = nullptr; @@ -750,7 +754,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat ColorMask[4] = ColorMask[7] = 1.0f / 15.0f; cbufid = 16; - if(!efbHasAlpha) { + if (!efbHasAlpha) { ColorMask[3] = 0.0f; fConstAdd[3] = 1.0f; cbufid = 17; @@ -760,7 +764,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1.0f; cbufid = 18; - if(!efbHasAlpha) { + if (!efbHasAlpha) { ColorMask[3] = 0.0f; fConstAdd[3] = 1.0f; cbufid = 19; @@ -771,7 +775,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1.0f; cbufid = 20; - if(!efbHasAlpha) { + if (!efbHasAlpha) { ColorMask[3] = 0.0f; fConstAdd[0] = 1.0f; fConstAdd[1] = 1.0f; @@ -818,7 +822,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat ColorMask[7] = 1.0f / 7.0f; cbufid = 27; - if(!efbHasAlpha) { + if (!efbHasAlpha) { ColorMask[3] = 0.0f; fConstAdd[3] = 1.0f; cbufid = 28; @@ -828,7 +832,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1.0f; cbufid = 29; - if(!efbHasAlpha) { + if (!efbHasAlpha) { ColorMask[3] = 0.0f; fConstAdd[3] = 1.0f; cbufid = 30; diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp index f7fd921c275..0bcf0b9d0d5 100644 --- a/Source/Core/VideoCommon/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/TextureConversionShader.cpp @@ -584,7 +584,7 @@ void WriteZ24Encoder(char*& p, API_TYPE ApiType) WRITE(p, " expanded%i.b = depth%i;\n", i, i); } - WRITE(p, " if(!first) {\n"); + WRITE(p, " if (!first) {\n"); // upper 16 WRITE(p, " ocol0.b = expanded0.g / 255.0;\n"); WRITE(p, " ocol0.g = expanded0.b / 255.0;\n"); diff --git a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp index 91fb723e843..b7141b77782 100644 --- a/Source/Core/VideoCommon/TextureDecoder_Generic.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_Generic.cpp @@ -728,7 +728,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh { u16 *ptr = (u16 *)dst + (y + iy) * width + x; u16 *s = (u16 *)(src + 8 * xStep); - for(int j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) *ptr++ = Common::swap16(*s++); } } @@ -758,7 +758,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh { u16 *ptr = (u16 *)dst + (y + iy) * width + x; u16 *s = (u16 *)(src + 8 * xStep); - for(int j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) *ptr++ = Common::swap16(*s++); } } @@ -857,7 +857,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++) decodebytesC4_5A3_To_rgba32(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr); } - else if(tlutfmt == 0) + else if (tlutfmt == 0) { for (int y = 0; y < height; y += 8) for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++) @@ -919,7 +919,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC8_5A3_To_RGBA32((u32*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr); } - else if(tlutfmt == 0) + else if (tlutfmt == 0) { for (int y = 0; y < height; y += 4) for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++) @@ -992,7 +992,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he { u32 *ptr = dst + (y + iy) * width + x; u16 *s = (u16 *)src; - for(int j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) *ptr++ = decode565RGBA(Common::swap16(*s++)); } } @@ -1093,7 +1093,7 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in { for (int x=0; x < xcnt; x++) { - switch(retval) + switch (retval) { case PC_TEX_FMT_I8: { diff --git a/Source/Core/VideoCommon/TextureDecoder_x64.cpp b/Source/Core/VideoCommon/TextureDecoder_x64.cpp index 875ba8f8e2e..ae113745386 100644 --- a/Source/Core/VideoCommon/TextureDecoder_x64.cpp +++ b/Source/Core/VideoCommon/TextureDecoder_x64.cpp @@ -791,7 +791,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh { u16 *ptr = (u16 *)dst + (y + iy) * width + x; u16 *s = (u16 *)(src + 8 * xStep); - for(int j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) *ptr++ = Common::swap16(*s++); } @@ -825,7 +825,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh { u16 *ptr = (u16 *)dst + (y + iy) * width + x; u16 *s = (u16 *)(src + 8 * xStep); - for(int j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) *ptr++ = Common::swap16(*s++); } } @@ -974,7 +974,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++) decodebytesC4_5A3_To_rgba32(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr); } - else if(tlutfmt == 0) + else if (tlutfmt == 0) { #pragma omp parallel for for (int y = 0; y < height; y += 8) @@ -1229,7 +1229,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) decodebytesC8_5A3_To_RGBA32((u32*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr); } - else if(tlutfmt == 0) + else if (tlutfmt == 0) { #pragma omp parallel for for (int y = 0; y < height; y += 4) @@ -2068,7 +2068,7 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in { for (int x=0; x < xcnt; x++) { - switch(retval) + switch (retval) { case PC_TEX_FMT_I8: { diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index c943b3c04d7..d2fb50fec72 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -567,7 +567,7 @@ void VertexLoader::CompileVertexTranslator() if (m_VtxDesc.Tex7MatIdx) {m_VertexSize += 1; components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); } // Write vertex position loader - if(g_ActiveConfig.bUseBBox) + if (g_ActiveConfig.bUseBBox) { WriteCall(UpdateBoundingBoxPrepare); WriteCall(VertexLoader_Position::GetFunction(m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements)); @@ -947,7 +947,7 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2) m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat; m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac; - if(!m_VtxAttr.ByteDequant) { + if (!m_VtxAttr.ByteDequant) { ERROR_LOG(VIDEO, "ByteDequant is set to zero"); } }; diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 62134854ec1..ee72d074cd4 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -66,7 +66,7 @@ void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 strid { Flush(); - if(count > IndexGenerator::GetRemainingIndices()) + if (count > IndexGenerator::GetRemainingIndices()) ERROR_LOG(VIDEO, "Too little remaining index values. Use 32-bit or reset them on flush."); if (count > GetRemainingIndices(primitive)) ERROR_LOG(VIDEO, "VertexManager: Buffer not large enough for all indices! " @@ -77,7 +77,7 @@ void VertexManager::PrepareForAdditionalData(int primitive, u32 count, u32 strid } // need to alloc new buffer - if(IsFlushed) + if (IsFlushed) { g_vertex_manager->ResetBuffer(stride); IsFlushed = false; @@ -88,7 +88,7 @@ u32 VertexManager::GetRemainingIndices(int primitive) { u32 index_len = MAXIBUFFERSIZE - IndexGenerator::GetIndexLen(); - if(g_Config.backend_info.bSupportsPrimitiveRestart) + if (g_Config.backend_info.bSupportsPrimitiveRestart) { switch (primitive) { @@ -216,13 +216,15 @@ void VertexManager::Flush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); - bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate - && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; + bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && + bpmem.dstalpha.enable && + bpmem.blendmode.alphaupdate && + bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; - if(PerfQueryBase::ShouldEmulate()) + if (PerfQueryBase::ShouldEmulate()) g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP); g_vertex_manager->vFlush(useDstAlpha); - if(PerfQueryBase::ShouldEmulate()) + if (PerfQueryBase::ShouldEmulate()) g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP); GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 67c18286aaa..a4893ce2dc9 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -49,7 +49,7 @@ static inline void GenerateVSOutputStruct(T& object, API_TYPE api_type) DefineVSOutputStructMember(object, api_type, "float4", "clipPos", -1, "TEXCOORD", xfregs.numTexGen.numTexGens); - if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) + if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) DefineVSOutputStructMember(object, api_type, "float4", "Normal", -1, "TEXCOORD", xfregs.numTexGen.numTexGens + 1); object.Write("};\n"); @@ -104,7 +104,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ uid_data.components = components; uid_data.pixel_lighting = (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting); - if(api_type == API_OPENGL) + if (api_type == API_OPENGL) { out.Write("in float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB); if (components & VB_HAS_POSMTXIDX) @@ -384,7 +384,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ // clipPos/w needs to be done in pixel shader, not here out.Write("o.clipPos = float4(pos.x,pos.y,o.pos.z,o.pos.w);\n"); - if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) + if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { out.Write("o.Normal = float4(_norm0.x,_norm0.y,_norm0.z,pos.z);\n"); @@ -418,7 +418,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ //seems to get rather complicated } - if(api_type == API_OPENGL) + if (api_type == API_OPENGL) { // Bit ugly here // TODO: Make pretty @@ -428,7 +428,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) out.Write(" uv%d_2.xyz = o.tex%d;\n", i, i); out.Write(" clipPos_2 = o.clipPos;\n"); - if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) + if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) out.Write(" Normal_2 = o.Normal;\n"); out.Write("colors_02 = o.colors_0;\n"); diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index a9a9f4de8dd..e505fbba371 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -233,7 +233,7 @@ void VertexShaderManager::SetConstants() { int startn = nNormalMatricesChanged[0] / 3; int endn = (nNormalMatricesChanged[1] + 2) / 3; - for(int i=startn; iSetViewport(); // Update projection if the viewport isn't 1:1 useable - if(!g_ActiveConfig.backend_info.bSupportsOversizedViewports) + if (!g_ActiveConfig.backend_info.bSupportsOversizedViewports) { ViewportCorrectionMatrix(s_viewportCorrection); bProjectionChanged = true; @@ -385,7 +385,7 @@ void VertexShaderManager::SetConstants() float *rawProjection = xfregs.projection.rawProjection; - switch(xfregs.projection.type) + switch (xfregs.projection.type) { case GX_PERSPECTIVE: diff --git a/Source/DSPSpy/main_spy.cpp b/Source/DSPSpy/main_spy.cpp index a003f04c604..e3a718e87ce 100644 --- a/Source/DSPSpy/main_spy.cpp +++ b/Source/DSPSpy/main_spy.cpp @@ -682,7 +682,7 @@ int main() #endif { curUcode++; - if(curUcode == NUM_UCODES) + if (curUcode == NUM_UCODES) curUcode = 0; // Reset step counters since we're in a new ucode. diff --git a/Source/DSPTool/DSPTool.cpp b/Source/DSPTool/DSPTool.cpp index f84abaac5c4..da3b2e1a8f0 100644 --- a/Source/DSPTool/DSPTool.cpp +++ b/Source/DSPTool/DSPTool.cpp @@ -201,7 +201,7 @@ void RunAsmTests() // So far, all this binary can do is test partially that itself works correctly. int main(int argc, const char *argv[]) { - if(argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-?"))))) + if (argc == 1 || (argc == 2 && (!strcmp(argv[1], "--help") || (!strcmp(argv[1], "-?"))))) { printf("USAGE: DSPTool [-?] [--help] [-f] [-d] [-m] [-p ] [-o ] [-h ] \n"); printf("-? / --help: Prints this message\n"); @@ -278,7 +278,7 @@ int main(int argc, const char *argv[]) } } - if(multiple && (compare || disassemble || !output_name.empty() || + if (multiple && (compare || disassemble || !output_name.empty() || input_name.empty())) { printf("ERROR: Multiple files can only be used with assembly " "and must compile a header file.\n"); @@ -398,7 +398,7 @@ int main(int argc, const char *argv[]) std::string source; if (File::ReadFileToString(input_name.c_str(), source)) { - if(multiple) + if (multiple) { // When specifying a list of files we must compile a header // (we can't assemble multiple files to one binary) @@ -411,17 +411,17 @@ int main(int argc, const char *argv[]) source.append("\n"); - while((pos = source.find('\n', lastPos)) != std::string::npos) + while ((pos = source.find('\n', lastPos)) != std::string::npos) { std::string temp = source.substr(lastPos, pos - lastPos); - if(!temp.empty()) + if (!temp.empty()) files.push_back(temp); lastPos = pos + 1; } lines = (int)files.size(); - if(lines == 0) + if (lines == 0) { printf("ERROR: Must specify at least one file\n"); return 1;