From a27f5fe301ed4b122caff5f87132e0b346211a23 Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 9 Oct 2014 01:53:59 -0400 Subject: [PATCH 1/4] Remove another auto .. -> declaration. --- Source/Core/VideoBackends/OGL/SamplerCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/OGL/SamplerCache.cpp b/Source/Core/VideoBackends/OGL/SamplerCache.cpp index 2b422e1f55..a20b42d29f 100644 --- a/Source/Core/VideoBackends/OGL/SamplerCache.cpp +++ b/Source/Core/VideoBackends/OGL/SamplerCache.cpp @@ -50,7 +50,7 @@ void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode } } -auto SamplerCache::GetEntry(const Params& params) -> Value& +SamplerCache::Value& SamplerCache::GetEntry(const Params& params) { auto& val = m_cache[params]; if (!val.sampler_id) From d4e8e3a6a32b82d24392c8280f1570920362483c Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 9 Oct 2014 01:59:00 -0400 Subject: [PATCH 2/4] Properly handle the Wiimote speaker data format being unknown. --- Source/Core/Core/HW/WiimoteEmu/Speaker.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp index 533f1f7085..725fa25adb 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp @@ -69,7 +69,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd) return; // TODO consider using static max size instead of new - s16 *samples = new s16[sd->length * 2]; + std::unique_ptr samples(new s16[sd->length * 2]); unsigned int sample_rate_dividend; u8 volume_divisor; @@ -99,6 +99,11 @@ void Wiimote::SpeakerData(wm_speaker_data* sd) sample_rate_dividend = 6000000; volume_divisor = 0x40; } + else + { + ERROR_LOG(WII_IPC_WIIMOTE, "Unknown speaker format %x\n", m_reg_speaker.format); + return; + } // Speaker Pan unsigned int vol = (unsigned int)(m_options->settings[4]->GetValue() * 100); @@ -115,7 +120,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd) right_volume = 255; g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume); - g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples, sd->length, sample_rate); + g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate); #ifdef WIIMOTE_SPEAKER_DUMP @@ -129,7 +134,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd) OpenFStream(ofile, "rmtdump.bin", ofile.binary | ofile.out); wav.Start("rmtdump.wav", 6000/*Common::swap16(m_reg_speaker.sample_rate)*/); } - wav.AddMonoSamples(samples, sd->length*2); + wav.AddMonoSamples(samples.get(), sd->length*2); if (ofile.good()) { for (int i = 0; i < sd->length; i++) @@ -139,8 +144,6 @@ void Wiimote::SpeakerData(wm_speaker_data* sd) } num++; #endif - - delete[] samples; } } From 5b8722b6f2b198d43c5b681695161e79df49dd93 Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 9 Oct 2014 02:00:34 -0400 Subject: [PATCH 3/4] Don't pass u64 (which may be long long) to %lu. A type-safe StringFromFormat sure would be nice... --- Source/Core/VideoBackends/OGL/Render.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index 99dd6548be..e669490e60 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -719,9 +719,9 @@ void Renderer::DrawDebugInfo() debug_info += " - "; if (SConfig::GetInstance().m_ShowFrameCount) { - debug_info += StringFromFormat("Frame: %lu", Movie::g_currentFrame); + debug_info += StringFromFormat("Frame: %llu", (unsigned long long) Movie::g_currentFrame); if (Movie::IsPlayingInput()) - debug_info += StringFromFormat(" / %lu", Movie::g_totalFrames); + debug_info += StringFromFormat(" / %llu", (unsigned long long) Movie::g_totalFrames); } debug_info += "\n"; From b93953250a3245a504742622c5cb27d4d33ec325 Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 9 Oct 2014 02:05:45 -0400 Subject: [PATCH 4/4] TAS warning fixes: unused vars, shadowing, incorrect (unsigned) --- Source/Core/DolphinWX/TASInputDlg.cpp | 39 ++++++++++++--------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp index a3c9df36f1..ceb7dc51ad 100644 --- a/Source/Core/DolphinWX/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/TASInputDlg.cpp @@ -409,7 +409,6 @@ void TASInputDlg::GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf) { u8* const coreData = rptf.core ? (data + rptf.core) : nullptr; u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr; - u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr; if (coreData) { @@ -451,7 +450,6 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf) u8* const coreData = rptf.core ? (data + rptf.core) : nullptr; u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr; u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr; - u8 size = rptf.size; if (coreData) SetWiiButtons((wm_core*)coreData); @@ -484,42 +482,42 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf) if (mode == 1) { memset(irData, 0xFF, sizeof(wm_ir_basic) * 2); - wm_ir_basic* data = (wm_ir_basic*)irData; + wm_ir_basic* irBasic = (wm_ir_basic*)irData; for (unsigned int i = 0; i < 2; ++i) { if (x[i*2] < 1024 && y < 768) { - data[i].x1 = static_cast(x[i*2]); - data[i].x1hi = x[i*2] >> 8; + irBasic[i].x1 = static_cast(x[i*2]); + irBasic[i].x1hi = x[i*2] >> 8; - data[i].y1 = static_cast(y); - data[i].y1hi = y >> 8; + irBasic[i].y1 = static_cast(y); + irBasic[i].y1hi = y >> 8; } if (x[i*2+1] < 1024 && y < 768) { - data[i].x2 = static_cast(x[i*2+1]); - data[i].x2hi = x[i*2+1] >> 8; + irBasic[i].x2 = static_cast(x[i*2+1]); + irBasic[i].x2hi = x[i*2+1] >> 8; - data[i].y2 = static_cast(y); - data[i].y2hi = y >> 8; + irBasic[i].y2 = static_cast(y); + irBasic[i].y2hi = y >> 8; } } } else { memset(data, 0xFF, sizeof(wm_ir_extended) * 4); - wm_ir_extended* const data = (wm_ir_extended*)irData; + wm_ir_extended* const irExtended = (wm_ir_extended*)irData; for (unsigned int i = 0; i < 4; ++i) { if (x[i] < 1024 && y < 768) { - data[i].x = static_cast(x[i]); - data[i].xhi = x[i] >> 8; + irExtended[i].x = static_cast(x[i]); + irExtended[i].xhi = x[i] >> 8; - data[i].y = static_cast(y); - data[i].yhi = y >> 8; + irExtended[i].y = static_cast(y); + irExtended[i].yhi = y >> 8; - data[i].size = 10; + irExtended[i].size = 10; } } } @@ -705,11 +703,8 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event) stick->xCont.value = (unsigned)stick->xCont.value > stick->xCont.range ? stick->xCont.range : stick->xCont.value; stick->yCont.value = (unsigned)stick->yCont.value > stick->yCont.range ? stick->yCont.range : stick->yCont.value; - stick->xCont.value = (unsigned)stick->xCont.value < 0 ? 0 : stick->xCont.value; - stick->yCont.value = (unsigned)stick->yCont.value < 0 ? 0 : stick->yCont.value; - - int x = (u8)((double)stick->xCont.value / (double)stick->xCont.range * 255.0); - int y = (u8)((double)stick->yCont.value / (double)stick->yCont.range * 255.0); + stick->xCont.value = stick->xCont.value < 0 ? 0 : stick->xCont.value; + stick->yCont.value = stick->yCont.value < 0 ? 0 : stick->yCont.value; stick->bitmap->SetBitmap(CreateStickBitmap(ptM.x*2, ptM.y*2));