From 8ab2332854fbace5f8bf90f7b543527367bf29d8 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 28 Jan 2013 20:50:22 -0600 Subject: [PATCH 01/14] Enabled more warnings. Get to work! --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8efd8c495d..990ee60a1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,21 @@ add_definitions(-msse2) # Enabling all warnings in MSVC spams too much if(NOT MSVC) - add_definitions(-Wall) + add_definitions(-Wall +# TODO: would like these but they produce overwhelming amounts of warnings +# -Wextra +# -Wmissing-field-initializers +# -Wswitch-default +# -Wfloat-equal +# -Wconversion +# -Wzero-as-null-pointer-constant + -Wtype-limits + -Wsign-compare + -Wignored-qualifiers + -Wuninitialized + -Wlogical-op + -Wshadow + -Winit-self) endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag From 2ab1cccbe476f8e6a4fef8c7ebdf883ff1f043f8 Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 29 Jan 2013 22:43:56 +1100 Subject: [PATCH 02/14] Preset HBeamPos to -1. Fixes NTSC-U N64 VC games. Fixes issue 5950. --- Source/Core/Core/Src/HW/VideoInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index 95c06d1f88..bf9f7f8b84 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -144,8 +144,8 @@ void Preset(bool _bNTSC) m_HorizontalStepping.FbSteps = 40; m_HorizontalStepping.FieldSteps = 40; - m_HBeamPos = 0; - m_VBeamPos = 0; + m_HBeamPos = -1; // NTSC-U N64 VC games check for a non-zero HBeamPos + m_VBeamPos = 0; // RG4JC0 checks for a zero VBeamPos // 54MHz, capable of progressive scan m_Clock = Core::g_CoreStartupParameter.bProgressive; From 570997e6a11424bcd274fe08ef6e6fe0439e9e85 Mon Sep 17 00:00:00 2001 From: parlane Date: Tue, 29 Jan 2013 19:47:58 +0000 Subject: [PATCH 03/14] 4000 warnings about not supporting a warning... --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 990ee60a1f..cfab6b224b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,9 @@ if(NOT MSVC) -Wsign-compare -Wignored-qualifiers -Wuninitialized +if (NOT "${CMAKE_CXX_COMPILER}" MATCHES "clang++") -Wlogical-op +endif(NOT "${CMAKE_CXX_COMPILER}" MATCHES "clang++") -Wshadow -Winit-self) endif(NOT MSVC) From 4efbe1725f7030a552d40e05feab58b5f87c7283 Mon Sep 17 00:00:00 2001 From: parlane Date: Tue, 29 Jan 2013 19:52:44 +0000 Subject: [PATCH 04/14] Fix for the fix that didn't fix. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfab6b224b..a71b3f1b5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,9 +123,9 @@ if(NOT MSVC) -Wsign-compare -Wignored-qualifiers -Wuninitialized -if (NOT "${CMAKE_CXX_COMPILER}" MATCHES "clang++") +if (NOT ${CMAKE_CXX_COMPILER} MATCHES "clang++") -Wlogical-op -endif(NOT "${CMAKE_CXX_COMPILER}" MATCHES "clang++") +endif() -Wshadow -Winit-self) endif(NOT MSVC) From 65dea7da367259ef392482312c50947025ef9126 Mon Sep 17 00:00:00 2001 From: parlane Date: Tue, 29 Jan 2013 19:54:10 +0000 Subject: [PATCH 05/14] I blame Billiard. --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a71b3f1b5f..634709dbb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,9 +123,6 @@ if(NOT MSVC) -Wsign-compare -Wignored-qualifiers -Wuninitialized -if (NOT ${CMAKE_CXX_COMPILER} MATCHES "clang++") - -Wlogical-op -endif() -Wshadow -Winit-self) endif(NOT MSVC) From 75f2ba14b4cb165dc313caeb3845692d1e91b258 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 29 Jan 2013 13:59:03 -0600 Subject: [PATCH 06/14] Hey Parlane. Fixed it. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 634709dbb3..77c4d5b114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,9 @@ if(NOT MSVC) -Wuninitialized -Wshadow -Winit-self) + if (NOT (${CMAKE_C_COMPILER} MATCHES "clang")) + -Wlogical-op + endif() endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag From d2528615fa549d4ca467c65975adcebd7ba1696e Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 29 Jan 2013 14:06:43 -0600 Subject: [PATCH 07/14] hah, woops. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77c4d5b114..ed233c03d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,7 +126,7 @@ if(NOT MSVC) -Wshadow -Winit-self) if (NOT (${CMAKE_C_COMPILER} MATCHES "clang")) - -Wlogical-op + add_definitions(-Wlogical-op) endif() endif(NOT MSVC) From f13a07fb82eb979953183d3a5c4eff873a5d9605 Mon Sep 17 00:00:00 2001 From: Sonicadvance1 Date: Tue, 29 Jan 2013 21:05:42 +0000 Subject: [PATCH 08/14] Remove this double flush in the idleskipping code. --- Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 1dae2ec17e..a6f2dfb29f 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -140,13 +140,12 @@ void Jit64::lXXx(UGeckoInstruction inst) gpr.UnlockAll(); gpr.Flush(FLUSH_ALL); + fpr.Flush(FLUSH_ALL); // if it's still 0, we can wait until the next event TEST(32, R(EAX), R(EAX)); FixupBranch noIdle = J_CC(CC_NZ); - - gpr.Flush(FLUSH_ALL); - fpr.Flush(FLUSH_ALL); + ABI_CallFunctionC((void *)&PowerPC::OnIdle, PowerPC::ppcState.gpr[a] + (s32)(s16)inst.SIMM_16); // ! we must continue executing of the loop after exception handling, maybe there is still 0 in r0 From 0e04e0c305a4ba2519a9d7466374793ae9ff7e13 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 29 Jan 2013 16:40:15 -0600 Subject: [PATCH 09/14] Fix some shadowing warnings. --- .../Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 4 +-- .../Core/VideoCommon/Src/TextureCacheBase.h | 26 +++++++++---------- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 8 +++--- .../Plugin_VideoOGL/Src/TextureCache.cpp | 6 ++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index a6f2dfb29f..04e4d09cc9 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -139,8 +139,8 @@ void Jit64::lXXx(UGeckoInstruction inst) MOV(32, gpr.R(d), R(EAX)); gpr.UnlockAll(); - gpr.Flush(FLUSH_ALL); - fpr.Flush(FLUSH_ALL); + gpr.Flush(FLUSH_ALL); + fpr.Flush(FLUSH_ALL); // if it's still 0, we can wait until the next event TEST(32, R(EAX), R(EAX)); diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h index 4ef3b8a985..1f8d9ebbd9 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.h +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h @@ -60,26 +60,26 @@ public: int frameCount; - void SetGeneralParameters(u32 addr, u32 size, u32 format, unsigned int num_mipmaps) + void SetGeneralParameters(u32 _addr, u32 _size, u32 _format, unsigned int _num_mipmaps) { - this->addr = addr; - this->size_in_bytes = size; - this->format = format; - this->num_mipmaps = num_mipmaps; + addr = _addr; + size_in_bytes = _size; + format = _format; + num_mipmaps = _num_mipmaps; } - void SetDimensions(unsigned int native_width, unsigned int native_height, unsigned int virtual_width, unsigned int virtual_height) + void SetDimensions(unsigned int _native_width, unsigned int _native_height, unsigned int _virtual_width, unsigned int _virtual_height) { - this->native_width = native_width; - this->native_height = native_height; - this->virtual_width = virtual_width; - this->virtual_height = virtual_height; + native_width = _native_width; + native_height = _native_height; + virtual_width = _virtual_width; + virtual_height = _virtual_height; } - void SetHashes(u64 hash/*, u32 pal_hash*/) + void SetHashes(u64 _hash/*, u32 _pal_hash*/) { - this->hash = hash; - //this->pal_hash = pal_hash; + hash = _hash; + //pal_hash = _pal_hash; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index cd924acd8a..a10aaf7204 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1289,10 +1289,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons if (FramebufferManagerBase::LastXfbWidth() != fbWidth || FramebufferManagerBase::LastXfbHeight() != fbHeight) { xfbchanged = true; - unsigned int w = (fbWidth < 1 || fbWidth > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbWidth; - unsigned int h = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight; - FramebufferManagerBase::SetLastXfbWidth(w); - FramebufferManagerBase::SetLastXfbHeight(h); + unsigned int const last_w = (fbWidth < 1 || fbWidth > MAX_XFB_WIDTH) ? MAX_XFB_WIDTH : fbWidth; + unsigned int const last_h = (fbHeight < 1 || fbHeight > MAX_XFB_HEIGHT) ? MAX_XFB_HEIGHT : fbHeight; + FramebufferManagerBase::SetLastXfbWidth(last_w); + FramebufferManagerBase::SetLastXfbHeight(last_h); } bool WindowResized = false; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp index 7a62131f90..1c43ed1d59 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp @@ -330,15 +330,15 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo srcRect); u8* dst = Memory::GetPointer(addr); - u64 hash = GetHash64(dst,encoded_size,g_ActiveConfig.iSafeTextureCache_ColorSamples); + u64 const new_hash = GetHash64(dst,encoded_size,g_ActiveConfig.iSafeTextureCache_ColorSamples); // Mark texture entries in destination address range dynamic unless caching is enabled and the texture entry is up to date if (!g_ActiveConfig.bEFBCopyCacheEnable) TextureCache::MakeRangeDynamic(addr,encoded_size); - else if (!TextureCache::Find(addr, hash)) + else if (!TextureCache::Find(addr, new_hash)) TextureCache::MakeRangeDynamic(addr,encoded_size); - this->hash = hash; + hash = new_hash; } FramebufferManager::SetFramebuffer(0); From 7676c4d43b1763c03e1fdfeb11f2ecfa48403ec8 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 29 Jan 2013 21:28:55 -0600 Subject: [PATCH 10/14] For each of the recently added warning flags check to see if the compiler supports the flag before adding it. --- CMakeLists.txt | 53 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed233c03d6..e72468854b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,32 +109,37 @@ endif() # Various compile flags add_definitions(-msse2) +include(CheckCXXCompilerFlag) +macro(check_and_add_flag var flag) + CHECK_CXX_COMPILER_FLAG(${flag} FLAG_${var}) + if(FLAG_${var}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") + endif() +endmacro() + # Enabling all warnings in MSVC spams too much if(NOT MSVC) - add_definitions(-Wall -# TODO: would like these but they produce overwhelming amounts of warnings -# -Wextra -# -Wmissing-field-initializers -# -Wswitch-default -# -Wfloat-equal -# -Wconversion -# -Wzero-as-null-pointer-constant - -Wtype-limits - -Wsign-compare - -Wignored-qualifiers - -Wuninitialized - -Wshadow - -Winit-self) - if (NOT (${CMAKE_C_COMPILER} MATCHES "clang")) - add_definitions(-Wlogical-op) - endif() + add_definitions(-Wall) + + # TODO: would like these but they produce overwhelming amounts of warnings + #check_and_add_flag(EXTRA -Wextra) + #check_and_add_flag(MISSING_FIELD_INITIALIZERS -Wmissing-field-initializers) + #check_and_add_flag(SWITCH_DEFAULT -Wswitch-default) + #check_and_add_flag(FLOAT_EQUAL -Wfloat-equal) + #check_and_add_flag(CONVERSION -Wconversion) + #check_and_add_flag(ZERO_AS_NULL_POINTER_CONSTANT -Wzero-as-null-pointer-constant) + check_and_add_flag(TYPE_LIMITS -Wtype-limits) + check_and_add_flag(SIGN_COMPARE -Wsign-compare) + check_and_add_flag(IGNORED_QUALIFIERS -Wignored-qualifiers) + check_and_add_flag(UNINITIALIZED -Wuninitialized) + check_and_add_flag(LOGICAL_OP -Wlogical-op) + check_and_add_flag(SHADOW -Wshadow) + check_and_add_flag(INIT_SELF -Winit-self) endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag add_definitions(-fno-strict-aliasing -fno-exceptions -Wno-psabi) -include(CheckCXXCompilerFlag) - # We call fread numerous times without checking return values. Hide the # corresponding compiler warnings if the compiler supports doing so. CHECK_CXX_COMPILER_FLAG(-Wunused-result NO_UNUSED_RESULT) @@ -142,16 +147,10 @@ if(NO_UNUSED_RESULT) add_definitions(-Wno-unused-result) endif(NO_UNUSED_RESULT) -CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden VISIBILITY_INLINES_HIDDEN) -if(VISIBILITY_INLINES_HIDDEN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") -endif(VISIBILITY_INLINES_HIDDEN) +check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden) if(UNIX AND NOT APPLE) - CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden VISIBILITY_HIDDEN) - if(VISIBILITY_HIDDEN) - add_definitions(-fvisibility=hidden) - endif(VISIBILITY_HIDDEN) + check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden) endif() if(APPLE) From 18e69acc15ccdd5b63e76c0bc4c2e2d4397861c3 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 29 Jan 2013 21:48:26 -0600 Subject: [PATCH 11/14] Re-enable a few more warnings. --- CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e72468854b..647a84cb6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,14 +138,7 @@ if(NOT MSVC) endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag -add_definitions(-fno-strict-aliasing -fno-exceptions -Wno-psabi) - -# We call fread numerous times without checking return values. Hide the -# corresponding compiler warnings if the compiler supports doing so. -CHECK_CXX_COMPILER_FLAG(-Wunused-result NO_UNUSED_RESULT) -if(NO_UNUSED_RESULT) - add_definitions(-Wno-unused-result) -endif(NO_UNUSED_RESULT) +add_definitions(-fno-strict-aliasing -fno-exceptions) check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden) From 0ffdd2607f4ce56e4a35e959d1f5adcc07959320 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 29 Jan 2013 23:24:51 -0600 Subject: [PATCH 12/14] Fix the majority of the compiler warnings unearthed by the addition of the new warning flags. --- Source/Core/AudioCommon/Src/DPL2Decoder.cpp | 70 +++++++++---------- Source/Core/AudioCommon/Src/Mixer.h | 2 +- Source/Core/AudioCommon/Src/OpenALStream.cpp | 4 +- Source/Core/Core/Src/GeckoCode.cpp | 4 +- Source/Core/Core/Src/HW/EXI_DeviceIPL.h | 2 +- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 10 +-- .../Core/Src/PowerPC/Jit64IL/JitILAsm.cpp | 4 +- Source/Core/DiscIO/Src/VolumeWad.cpp | 6 +- Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp | 13 ++-- Source/Core/DolphinWX/Src/TASInputDlg.cpp | 6 +- .../Plugin_VideoSoftware/Src/HwRasterizer.cpp | 32 ++++----- 11 files changed, 76 insertions(+), 77 deletions(-) diff --git a/Source/Core/AudioCommon/Src/DPL2Decoder.cpp b/Source/Core/AudioCommon/Src/DPL2Decoder.cpp index a5d2720878..6a63f696de 100644 --- a/Source/Core/AudioCommon/Src/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/Src/DPL2Decoder.cpp @@ -232,70 +232,70 @@ float passive_lock(float x) void matrix_decode(const float *in, const int k, const int il, const int ir, bool decode_rear, - const int dlbuflen, - float l_fwr, float r_fwr, - float lpr_fwr, float lmr_fwr, - float *adapt_l_gain, float *adapt_r_gain, - float *adapt_lpr_gain, float *adapt_lmr_gain, - float *lf, float *rf, float *lr, - float *rr, float *cf) + const int _dlbuflen, + float _l_fwr, float _r_fwr, + float _lpr_fwr, float _lmr_fwr, + float *_adapt_l_gain, float *_adapt_r_gain, + float *_adapt_lpr_gain, float *_adapt_lmr_gain, + float *_lf, float *_rf, float *_lr, + float *_rr, float *_cf) { static const float M9_03DB = 0.3535533906f; static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */ static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */ static const float MATCOMPGAIN = 0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */ - const int kr = (k + olddelay) % dlbuflen; - float l_gain = (l_fwr + r_fwr) / (1 + l_fwr + l_fwr); - float r_gain = (l_fwr + r_fwr) / (1 + r_fwr + r_fwr); + const int kr = (k + olddelay) % _dlbuflen; + float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr); + float r_gain = (_l_fwr + _r_fwr) / (1 + _r_fwr + _r_fwr); /* The 2nd axis has strong gain fluctuations, and therefore require limits. The factor corresponds to the 1 / amplification of (Lt - Rt) when (Lt, Rt) is strongly correlated. (e.g. during dialogues). It should be bigger than -12 dB to prevent distortion. */ - float lmr_lim_fwr = lmr_fwr > M9_03DB * lpr_fwr ? lmr_fwr : M9_03DB * lpr_fwr; - float lpr_gain = (lpr_fwr + lmr_lim_fwr) / (1 + lpr_fwr + lpr_fwr); - float lmr_gain = (lpr_fwr + lmr_lim_fwr) / (1 + lmr_lim_fwr + lmr_lim_fwr); - float lmr_unlim_gain = (lpr_fwr + lmr_fwr) / (1 + lmr_fwr + lmr_fwr); + float lmr_lim_fwr = _lmr_fwr > M9_03DB * _lpr_fwr ? _lmr_fwr : M9_03DB * _lpr_fwr; + float lpr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + _lpr_fwr + _lpr_fwr); + float lmr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + lmr_lim_fwr + lmr_lim_fwr); + float lmr_unlim_gain = (_lpr_fwr + _lmr_fwr) / (1 + _lmr_fwr + _lmr_fwr); float lpr, lmr; float l_agc, r_agc, lpr_agc, lmr_agc; float f, d_gain, c_gain, c_agc_cfk; /*** AXIS NO. 1: (Lt, Rt) -> (C, Ls, Rs) ***/ /* AGC adaption */ - d_gain = (fabs(l_gain - *adapt_l_gain) + fabs(r_gain - *adapt_r_gain)) * 0.5f; + d_gain = (fabs(l_gain - *_adapt_l_gain) + fabs(r_gain - *_adapt_r_gain)) * 0.5f; f = d_gain * (1.0f / MATAGCTRIG); f = MATAGCDECAY - MATAGCDECAY / (1 + f * f); - *adapt_l_gain = (1 - f) * *adapt_l_gain + f * l_gain; - *adapt_r_gain = (1 - f) * *adapt_r_gain + f * r_gain; + *_adapt_l_gain = (1 - f) * *_adapt_l_gain + f * l_gain; + *_adapt_r_gain = (1 - f) * *_adapt_r_gain + f * r_gain; /* Matrix */ - l_agc = in[il] * passive_lock(*adapt_l_gain); - r_agc = in[ir] * passive_lock(*adapt_r_gain); - cf[k] = (l_agc + r_agc) * (float)M_SQRT1_2; + l_agc = in[il] * passive_lock(*_adapt_l_gain); + r_agc = in[ir] * passive_lock(*_adapt_r_gain); + _cf[k] = (l_agc + r_agc) * (float)M_SQRT1_2; if (decode_rear) { - lr[kr] = rr[kr] = (l_agc - r_agc) * (float)M_SQRT1_2; + _lr[kr] = _rr[kr] = (l_agc - r_agc) * (float)M_SQRT1_2; /* Stereo rear channel is steered with the same AGC steering as the decoding matrix. Note this requires a fast updating AGC at the order of 20 ms (which is the case here). */ - lr[kr] *= (l_fwr + l_fwr) / (1 + l_fwr + r_fwr); - rr[kr] *= (r_fwr + r_fwr) / (1 + l_fwr + r_fwr); + _lr[kr] *= (_l_fwr + _l_fwr) / (1 + _l_fwr + _r_fwr); + _rr[kr] *= (_r_fwr + _r_fwr) / (1 + _l_fwr + _r_fwr); } /*** AXIS NO. 2: (Lt + Rt, Lt - Rt) -> (L, R) ***/ lpr = (in[il] + in[ir]) * (float)M_SQRT1_2; lmr = (in[il] - in[ir]) * (float)M_SQRT1_2; /* AGC adaption */ - d_gain = fabs(lmr_unlim_gain - *adapt_lmr_gain); + d_gain = fabs(lmr_unlim_gain - *_adapt_lmr_gain); f = d_gain * (1.0f / MATAGCTRIG); f = MATAGCDECAY - MATAGCDECAY / (1 + f * f); - *adapt_lpr_gain = (1 - f) * *adapt_lpr_gain + f * lpr_gain; - *adapt_lmr_gain = (1 - f) * *adapt_lmr_gain + f * lmr_gain; + *_adapt_lpr_gain = (1 - f) * *_adapt_lpr_gain + f * lpr_gain; + *_adapt_lmr_gain = (1 - f) * *_adapt_lmr_gain + f * lmr_gain; /* Matrix */ - lpr_agc = lpr * passive_lock(*adapt_lpr_gain); - lmr_agc = lmr * passive_lock(*adapt_lmr_gain); - lf[k] = (lpr_agc + lmr_agc) * (float)M_SQRT1_2; - rf[k] = (lpr_agc - lmr_agc) * (float)M_SQRT1_2; + lpr_agc = lpr * passive_lock(*_adapt_lpr_gain); + lmr_agc = lmr * passive_lock(*_adapt_lmr_gain); + _lf[k] = (lpr_agc + lmr_agc) * (float)M_SQRT1_2; + _rf[k] = (lpr_agc - lmr_agc) * (float)M_SQRT1_2; /*** CENTER FRONT CANCELLATION ***/ /* A heuristic approach exploits that Lt + Rt gain contains the @@ -303,16 +303,16 @@ void matrix_decode(const float *in, const int k, const int il, the front and rear "cones" to concentrate Lt + Rt to C and introduce Lt - Rt in L, R. */ /* 0.67677 is the empirical lower bound for lpr_gain. */ - c_gain = 8 * (*adapt_lpr_gain - 0.67677f); + c_gain = 8 * (*_adapt_lpr_gain - 0.67677f); c_gain = c_gain > 0 ? c_gain : 0; /* c_gain should not be too high, not even reaching full cancellation (~ 0.50 - 0.55 at current AGC implementation), or the center will sound too narrow. */ c_gain = MATCOMPGAIN / (1 + c_gain * c_gain); - c_agc_cfk = c_gain * cf[k]; - lf[k] -= c_agc_cfk; - rf[k] -= c_agc_cfk; - cf[k] += c_agc_cfk + c_agc_cfk; + c_agc_cfk = c_gain * _cf[k]; + _lf[k] -= c_agc_cfk; + _rf[k] -= c_agc_cfk; + _cf[k] += c_agc_cfk + c_agc_cfk; } void dpl2decode(float *samples, int numsamples, float *out) diff --git a/Source/Core/AudioCommon/Src/Mixer.h b/Source/Core/AudioCommon/Src/Mixer.h index c1a387cf49..a9de2cee72 100644 --- a/Source/Core/AudioCommon/Src/Mixer.h +++ b/Source/Core/AudioCommon/Src/Mixer.h @@ -92,7 +92,7 @@ public: std::mutex& MixerCritical() { return m_csMixing; } - volatile float GetCurrentSpeed() const { return m_speed; } + float GetCurrentSpeed() const { return m_speed; } void UpdateSpeed(volatile float val) { m_speed = val; } protected: diff --git a/Source/Core/AudioCommon/Src/OpenALStream.cpp b/Source/Core/AudioCommon/Src/OpenALStream.cpp index cfe6a40630..6b239a584c 100644 --- a/Source/Core/AudioCommon/Src/OpenALStream.cpp +++ b/Source/Core/AudioCommon/Src/OpenALStream.cpp @@ -316,7 +316,7 @@ void OpenALStream::SoundLoop() if (iBuffersFilled == numBuffers) { alSourcePlay(uiSource); - ALenum err = alGetError(); + err = alGetError(); if (err != 0) { ERROR_LOG(AUDIO, "Error occurred during playback: %08x", err); @@ -328,7 +328,7 @@ void OpenALStream::SoundLoop() { // Buffer underrun occurred, resume playback alSourcePlay(uiSource); - ALenum err = alGetError(); + err = alGetError(); if (err != 0) { ERROR_LOG(AUDIO, "Error occurred resuming playback: %08x", err); diff --git a/Source/Core/Core/Src/GeckoCode.cpp b/Source/Core/Core/Src/GeckoCode.cpp index 2d5f694ded..a42f6629ad 100644 --- a/Source/Core/Core/Src/GeckoCode.cpp +++ b/Source/Core/Core/Src/GeckoCode.cpp @@ -171,9 +171,9 @@ bool InstallCodeHandler() Memory::Write_U8(1, 0x80001807); // Invalidate the icache - for (unsigned int i = 0; i < data.length(); i += 32) + for (unsigned int j = 0; j < data.length(); j += 32) { - PowerPC::ppcState.iCache.Invalidate(0x80001800 + i); + PowerPC::ppcState.iCache.Invalidate(0x80001800 + j); } return true; } diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h index ed5cf0c922..bce8fee9ed 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h @@ -78,7 +78,7 @@ private: virtual void TransferByte(u8 &_uByte); bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); } - const u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; } + u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; } void LoadFileToIPL(std::string filename, u32 offset); }; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index c5ea6fcb06..64d1dc79ba 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -382,18 +382,18 @@ void ExecuteCommand(u32 _Address) } else { - IWII_IPC_HLE_Device* pDevice = CreateFileIO(DeviceID, DeviceName); - CmdSuccess = pDevice->Open(_Address, Mode); + IWII_IPC_HLE_Device* _pDevice = CreateFileIO(DeviceID, DeviceName); + CmdSuccess = _pDevice->Open(_Address, Mode); INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)", - pDevice->GetDeviceName().c_str(), DeviceID, Mode); + _pDevice->GetDeviceName().c_str(), DeviceID, Mode); if (Memory::Read_U32(_Address + 4) == (u32)DeviceID) { - g_FdMap[DeviceID] = pDevice; + g_FdMap[DeviceID] = _pDevice; } else { - delete pDevice; + delete _pDevice; } } diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp index d04c58b143..74c290aa9c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp @@ -71,7 +71,7 @@ void JitILAsmRoutineManager::Generate() #endif // INT3(); - const u8 *outerLoop = GetCodePtr(); + const u8 *outer_loop = GetCodePtr(); ABI_CallFunction(reinterpret_cast(&CoreTiming::Advance)); FixupBranch skipToRealDispatch = J(); //skip the sync and compare first time @@ -220,7 +220,7 @@ void JitILAsmRoutineManager::Generate() MOV(32, M(&PC), R(EAX)); TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF)); - J_CC(CC_Z, outerLoop, true); + J_CC(CC_Z, outer_loop, true); //Landing pad for drec space ABI_PopAllCalleeSavedRegsAndAdjustStack(); RET(); diff --git a/Source/Core/DiscIO/Src/VolumeWad.cpp b/Source/Core/DiscIO/Src/VolumeWad.cpp index 0cdfc85925..2f9f0ef961 100644 --- a/Source/Core/DiscIO/Src/VolumeWad.cpp +++ b/Source/Core/DiscIO/Src/VolumeWad.cpp @@ -129,10 +129,10 @@ bool CVolumeWAD::GetWName(std::vector& _rwNames) const _rwNames.push_back(L""); continue; } - for (int i = 0; i < 42; ++i) + for (int j = 0; j < 42; ++j) { - u16 t = Common::swap16(temp[i]); - if (t == 0 && i > 0) + u16 t = Common::swap16(temp[j]); + if (t == 0 && j > 0) { if (out_temp.at(out_temp.size()-1) != ' ') out_temp.push_back(' '); diff --git a/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp index d33f507282..254b1a6bc7 100644 --- a/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp +++ b/Source/Core/DolphinWX/Src/FifoPlayerDlg.cpp @@ -483,8 +483,7 @@ void FifoPlayerDlg::OnBeginSearch(wxCommandEvent& event) SearchResult result; result.frame_idx = frame_idx; - int obj_idx = m_objectsList->GetSelection(); - result.obj_idx = obj_idx; + result.obj_idx = m_objectsList->GetSelection(); result.cmd_idx = 0; for (unsigned int cmd_idx = 1; cmd_idx < m_objectCmdOffsets.size(); ++cmd_idx) { @@ -642,8 +641,8 @@ void FifoPlayerDlg::OnObjectListSelectionChanged(wxCommandEvent& event) { m_objectCmdOffsets.push_back(objectdata - objectdata_start); int new_offset = objectdata - &fifo_frame.fifoData[frame.objectStarts[0]]; - int cmd = *objectdata++; - switch (cmd) + int command = *objectdata++; + switch (command) { case GX_NOP: newLabel = _("NOP"); @@ -691,9 +690,9 @@ void FifoPlayerDlg::OnObjectListSelectionChanged(wxCommandEvent& event) case GX_LOAD_INDX_C: case GX_LOAD_INDX_D: objectdata += 4; - newLabel = wxString::Format(wxT("LOAD INDX %s"), (cmd == GX_LOAD_INDX_A) ? _("A") : - (cmd == GX_LOAD_INDX_B) ? _("B") : - (cmd == GX_LOAD_INDX_C) ? _("C") : _("D")); + newLabel = wxString::Format(wxT("LOAD INDX %s"), (command == GX_LOAD_INDX_A) ? _("A") : + (command == GX_LOAD_INDX_B) ? _("B") : + (command == GX_LOAD_INDX_C) ? _("C") : _("D")); break; case GX_CMD_CALL_DL: diff --git a/Source/Core/DolphinWX/Src/TASInputDlg.cpp b/Source/Core/DolphinWX/Src/TASInputDlg.cpp index 51b340c55a..493fade776 100644 --- a/Source/Core/DolphinWX/Src/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/Src/TASInputDlg.cpp @@ -1099,8 +1099,8 @@ wxBitmap TASInputDlg::CreateStickBitmap(int x, int y) y = y/2; wxMemoryDC memDC; - wxBitmap bitmap(127, 127); - memDC.SelectObject(bitmap); + wxBitmap stick_bitmap(127, 127); + memDC.SelectObject(stick_bitmap); memDC.SetBackground(*wxLIGHT_GREY_BRUSH); memDC.Clear(); memDC.SetBrush(*wxWHITE_BRUSH); @@ -1116,5 +1116,5 @@ wxBitmap TASInputDlg::CreateStickBitmap(int x, int y) memDC.SetBrush(*wxBLUE_BRUSH); memDC.DrawCircle(x,y,5); memDC.SelectObject(wxNullBitmap); - return bitmap; + return stick_bitmap; } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp index a5609f51b2..a1fd7c4733 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp @@ -33,7 +33,7 @@ namespace HwRasterizer float efbHalfHeight; bool hasTexture; - u8 *temp; + u8 *temp; // Programs static GLuint colProg, texProg, clearProg; @@ -61,7 +61,7 @@ namespace HwRasterizer " gl_FragColor = " TEXFUNC "(Texture, TexCoordOut.xy);\n" "}\n"; // Clear shader - static const char *fragclearText = + static const char *fragclearText = "uniform " PREC " vec4 Color;\n" "void main() {\n" " gl_FragColor = Color;\n" @@ -75,7 +75,7 @@ namespace HwRasterizer " gl_Position = pos;\n" " TexCoordOut = TexCoordIn;\n" "}\n"; - static const char *vertclearText = + static const char *vertclearText = "attribute vec4 pos;\n" "void main() {\n" " gl_Position = pos;\n" @@ -92,11 +92,11 @@ namespace HwRasterizer // Color attributes col_apos = glGetAttribLocation(colProg, "pos"); - col_atex = glGetAttribLocation(colProg, "TexCoordIn"); + col_atex = glGetAttribLocation(colProg, "TexCoordIn"); // Texture attributes tex_apos = glGetAttribLocation(texProg, "pos"); - tex_atex = glGetAttribLocation(texProg, "TexCoordIn"); - tex_utex = glGetUniformLocation(texProg, "Texture"); + tex_atex = glGetAttribLocation(texProg, "TexCoordIn"); + tex_utex = glGetUniformLocation(texProg, "Texture"); // Clear attributes clear_apos = glGetAttribLocation(clearProg, "pos"); clear_ucol = glGetUniformLocation(clearProg, "Color"); @@ -131,7 +131,7 @@ namespace HwRasterizer glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glClientActiveTexture(GL_TEXTURE0); + glClientActiveTexture(GL_TEXTURE0); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_TEXTURE_RECTANGLE_ARB); @@ -179,7 +179,7 @@ namespace HwRasterizer hasTexture = bpmem.tevorders[0].enable0; if (hasTexture) - LoadTexture(); + LoadTexture(); } void EndTriangles() @@ -204,15 +204,15 @@ namespace HwRasterizer float z2 = v2->screenPosition.z / (float)0x00ffffff; float r0 = v0->color[0][OutputVertexData::RED_C] / 255.0f; - float g0 = v0->color[0][OutputVertexData::GRN_C] / 255.0f; + float g0 = v0->color[0][OutputVertexData::GRN_C] / 255.0f; float b0 = v0->color[0][OutputVertexData::BLU_C] / 255.0f; float r1 = v1->color[0][OutputVertexData::RED_C] / 255.0f; - float g1 = v1->color[0][OutputVertexData::GRN_C] / 255.0f; + float g1 = v1->color[0][OutputVertexData::GRN_C] / 255.0f; float b1 = v1->color[0][OutputVertexData::BLU_C] / 255.0f; float r2 = v2->color[0][OutputVertexData::RED_C] / 255.0f; - float g2 = v2->color[0][OutputVertexData::GRN_C] / 255.0f; + float g2 = v2->color[0][OutputVertexData::GRN_C] / 255.0f; float b2 = v2->color[0][OutputVertexData::BLU_C] / 255.0f; static const GLfloat verts[3][3] = { @@ -339,17 +339,17 @@ namespace HwRasterizer texImage3.hex = texUnit.texImage3[0].hex; texTlut.hex = texUnit.texTlut[0].hex; - int width = texImage0.width; - int height = texImage0.height; + int image_width = texImage0.width; + int image_height = texImage0.height; - DebugUtil::GetTextureBGRA(temp, 0, 0, width, height); + DebugUtil::GetTextureBGRA(temp, 0, 0, image_width, image_height); glGenTextures(1, (GLuint *)&texture); glBindTexture(TEX2D, texture); #ifdef USE_GLES - glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp); + glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)image_width, (GLsizei)image_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp); #else - glTexImage2D(TEX2D, 0, GL_RGBA8, (GLsizei)width, (GLsizei)height, 0, GL_BGRA, GL_UNSIGNED_BYTE, temp); + glTexImage2D(TEX2D, 0, GL_RGBA8, (GLsizei)image_width, (GLsizei)image_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, temp); #endif GL_REPORT_ERRORD(); } From de27f0bea9ff541fddfea8a875b15372d6420f8d Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Thu, 31 Jan 2013 03:51:29 -0500 Subject: [PATCH 13/14] Toggle full screen when double clicking the render window. --- Source/Core/DolphinWX/Src/Frame.cpp | 2 ++ Source/Core/DolphinWX/Src/FrameTools.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index d390b8afcd..c26b28b1a7 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -1004,6 +1004,8 @@ void CFrame::OnMouse(wxMouseEvent& event) event.GetPosition().x, event.GetPosition().y, event.ButtonDown()); } #endif + if (event.LeftDClick()) + DoFullscreen(!RendererIsFullscreen()); event.Skip(); } diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 4d66d82b18..567c614304 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -913,6 +913,7 @@ void CFrame::StartGame(const std::string& filename) wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this); + m_RenderParent->Bind(wxEVT_LEFT_DCLICK, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this); m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this); } From e199d21513de1555b8e597fa9155a88cd9e2e3ce Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Thu, 31 Jan 2013 03:54:18 -0500 Subject: [PATCH 14/14] Revert "Toggle full screen when double clicking the render window." This reverts commit de27f0bea9ff541fddfea8a875b15372d6420f8d. --- Source/Core/DolphinWX/Src/Frame.cpp | 2 -- Source/Core/DolphinWX/Src/FrameTools.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index c26b28b1a7..d390b8afcd 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -1004,8 +1004,6 @@ void CFrame::OnMouse(wxMouseEvent& event) event.GetPosition().x, event.GetPosition().y, event.ButtonDown()); } #endif - if (event.LeftDClick()) - DoFullscreen(!RendererIsFullscreen()); event.Skip(); } diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 567c614304..4d66d82b18 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -913,7 +913,6 @@ void CFrame::StartGame(const std::string& filename) wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this); - m_RenderParent->Bind(wxEVT_LEFT_DCLICK, &CFrame::OnMouse, this); wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this); m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this); }