diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 58b74f81c1..849f62cbac 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -283,13 +283,10 @@ bool RunCode(const ARCode &arcode) LogInfo("Code Name: %s", arcode.name.c_str()); LogInfo("Number of codes: %i", arcode.ops.size()); - std::vector::const_iterator - iter = arcode.ops.begin(), - ops_end = arcode.ops.end(); - for (; iter != ops_end; ++iter) + for (const AREntry& entry : arcode.ops) { - const ARAddr& addr = *(ARAddr*)&iter->cmd_addr; - const u32 data = iter->value; + const ARAddr& addr = *(ARAddr*)&entry.cmd_addr; + const u32 data = entry.value; // after a conditional code, skip lines if needed if (skip_count) diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp index f93aa1c9e8..6ca0118928 100644 --- a/Source/Core/Core/HW/Wiimote.cpp +++ b/Source/Core/Core/HW/Wiimote.cpp @@ -24,11 +24,10 @@ InputPlugin *GetPlugin() void Shutdown() { - std::vector::const_iterator - i = g_plugin.controllers.begin(), - e = g_plugin.controllers.end(); - for ( ; i!=e; ++i ) - delete *i; + for (const ControllerEmu* i : g_plugin.controllers) + { + delete i; + } g_plugin.controllers.clear(); WiimoteReal::Stop(); diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h index 4df813d5b7..2465db006d 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h @@ -299,13 +299,14 @@ public: static void RunTable59(UGeckoInstruction _instCode); static void RunTable63(UGeckoInstruction _instCode); + static u32 Helper_Carry(u32 _uValue1, u32 _uValue2); + private: // flag helper static void Helper_UpdateCR0(u32 _uValue); static void Helper_UpdateCR1(double _fValue); static void Helper_UpdateCR1(float _fValue); static void Helper_UpdateCRx(int _x, u32 _uValue); - static u32 Helper_Carry(u32 _uValue1, u32 _uValue2); // address helper static u32 Helper_Get_EA (const UGeckoInstruction _inst); diff --git a/Source/Core/DolphinWX/CheatsWindow.cpp b/Source/Core/DolphinWX/CheatsWindow.cpp index 007dcb213a..c89e16ffab 100644 --- a/Source/Core/DolphinWX/CheatsWindow.cpp +++ b/Source/Core/DolphinWX/CheatsWindow.cpp @@ -547,12 +547,9 @@ void CheatSearchTab::UpdateCheatSearchResultsList() } else { - std::vector::const_iterator - i = search_results.begin(), - e = search_results.end(); - for (; i!=e; ++i) + for (const CheatSearchResult& result : search_results) { - u32 display_value = i->old_value; + u32 display_value = result.old_value; // #ifdef LIL_ENDIAN :p switch (search_type_size) @@ -574,7 +571,7 @@ void CheatSearchTab::UpdateCheatSearchResultsList() rowfmt[14] = (wxChar)(wxT('0') + search_type_size*2); lbox_search_results->Append( - wxString::Format(rowfmt, i->address, display_value, display_value, display_value)); + wxString::Format(rowfmt, result.address, display_value, display_value, display_value)); } } diff --git a/Source/Core/DolphinWX/GeckoCodeDiag.cpp b/Source/Core/DolphinWX/GeckoCodeDiag.cpp index 345fa9143d..97bf0c8acc 100644 --- a/Source/Core/DolphinWX/GeckoCodeDiag.cpp +++ b/Source/Core/DolphinWX/GeckoCodeDiag.cpp @@ -88,14 +88,13 @@ void CodeConfigPanel::UpdateCodeList(bool checkRunning) m_listbox_gcodes->Clear(); // add the codes to the listbox - std::vector::const_iterator - gcodes_iter = m_gcodes.begin(), - gcodes_end = m_gcodes.end(); - for (; gcodes_iter!=gcodes_end; ++gcodes_iter) + for (const GeckoCode& code : m_gcodes) { - m_listbox_gcodes->Append(StrToWxStr(gcodes_iter->name)); - if (gcodes_iter->enabled) + m_listbox_gcodes->Append(StrToWxStr(code.name)); + if (code.enabled) + { m_listbox_gcodes->Check(m_listbox_gcodes->GetCount()-1, true); + } } wxCommandEvent evt; @@ -131,21 +130,19 @@ void CodeConfigPanel::UpdateInfoBox(wxCommandEvent&) // notes textctrl m_infobox.textctrl_notes->Clear(); - std::vector::const_iterator - notes_iter = m_gcodes[sel].notes.begin(), - notes_end = m_gcodes[sel].notes.end(); - for (; notes_iter!=notes_end; ++notes_iter) - m_infobox.textctrl_notes->AppendText(StrToWxStr(*notes_iter)); + for (const std::string& note : m_gcodes[sel].notes) + { + m_infobox.textctrl_notes->AppendText(StrToWxStr(note)); + } m_infobox.textctrl_notes->ScrollLines(-99); // silly m_infobox.label_creator->SetLabel(wxGetTranslation(wxstr_creator) + StrToWxStr(m_gcodes[sel].creator)); // add codes to info listbox - std::vector::const_iterator - codes_iter = m_gcodes[sel].codes.begin(), - codes_end = m_gcodes[sel].codes.end(); - for (; codes_iter!=codes_end; ++codes_iter) - m_infobox.listbox_codes->Append(wxString::Format(wxT("%08X %08X"), codes_iter->address, codes_iter->data)); + for (const GeckoCode::Code& code : m_gcodes[sel].codes) + { + m_infobox.listbox_codes->Append(wxString::Format(wxT("%08X %08X"), code.address, code.data)); + } } else { @@ -281,10 +278,7 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&) unsigned long added_count = 0; // append the codes to the code list - std::vector::const_iterator - gcodes_iter = gcodes.begin(), - gcodes_end = gcodes.end(); - for (; gcodes_iter!= gcodes_end; ++gcodes_iter) + for (const GeckoCode& code : gcodes) { // only add codes which do not already exist std::vector::const_iterator @@ -294,13 +288,13 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&) { if (existing_gcodes_end == existing_gcodes_iter) { - m_gcodes.push_back(*gcodes_iter); + m_gcodes.push_back(code); ++added_count; break; } // code exists - if (existing_gcodes_iter->Compare(*gcodes_iter)) + if (existing_gcodes_iter->Compare(code)) break; } } diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index a77e8afe20..7c69752fa6 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -235,11 +235,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con choice_backend = new wxChoice(page_general, wxID_ANY); RegisterControl(choice_backend, wxGetTranslation(backend_desc)); - std::vector::const_iterator - it = g_available_video_backends.begin(), - itend = g_available_video_backends.end(); - for (; it != itend; ++it) - choice_backend->AppendString(wxGetTranslation(StrToWxStr((*it)->GetDisplayName()))); + for (const VideoBackend* backend : g_available_video_backends) + { + choice_backend->AppendString(wxGetTranslation(StrToWxStr(backend->GetDisplayName()))); + } choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetDisplayName()))); choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_Backend, this); @@ -259,11 +258,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con { wxChoice* const choice_adapter = CreateChoice(page_general, vconfig.iAdapter, wxGetTranslation(adapter_desc)); - std::vector::const_iterator - it = vconfig.backend_info.Adapters.begin(), - itend = vconfig.backend_info.Adapters.end(); - for (; it != itend; ++it) - choice_adapter->AppendString(StrToWxStr(*it)); + for (const std::string& adapter : vconfig.backend_info.Adapters) + { + choice_adapter->AppendString(StrToWxStr(adapter)); + } choice_adapter->Select(vconfig.iAdapter); @@ -381,11 +379,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con text_aamode = new wxStaticText(page_enh, -1, _("Anti-Aliasing:")); choice_aamode = CreateChoice(page_enh, vconfig.iMultisampleMode, wxGetTranslation(aa_desc)); - std::vector::const_iterator - it = vconfig.backend_info.AAModes.begin(), - itend = vconfig.backend_info.AAModes.end(); - for (; it != itend; ++it) - choice_aamode->AppendString(wxGetTranslation(StrToWxStr(*it))); + for (const std::string& mode : vconfig.backend_info.AAModes) + { + choice_aamode->AppendString(wxGetTranslation(StrToWxStr(mode))); + } choice_aamode->Select(vconfig.iMultisampleMode); szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0); @@ -406,11 +403,10 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con RegisterControl(choice_ppshader, wxGetTranslation(ppshader_desc)); choice_ppshader->AppendString(_("(off)")); - std::vector::const_iterator - it = vconfig.backend_info.PPShaders.begin(), - itend = vconfig.backend_info.PPShaders.end(); - for (; it != itend; ++it) - choice_ppshader->AppendString(StrToWxStr(*it)); + for (const std::string& shader : vconfig.backend_info.PPShaders) + { + choice_ppshader->AppendString(StrToWxStr(shader)); + } if (vconfig.sPostProcessingShader.empty()) choice_ppshader->Select(0); diff --git a/Source/Core/VideoBackends/D3D/FramebufferManager.h b/Source/Core/VideoBackends/D3D/FramebufferManager.h index 28153b5622..45f43f7357 100644 --- a/Source/Core/VideoBackends/D3D/FramebufferManager.h +++ b/Source/Core/VideoBackends/D3D/FramebufferManager.h @@ -49,9 +49,9 @@ struct XFBSource : public XFBSourceBase ~XFBSource() { tex->Release(); } void Draw(const MathUtil::Rectangle &sourcerc, - const MathUtil::Rectangle &drawrc) const; - void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight); - void CopyEFB(float Gamma); + const MathUtil::Rectangle &drawrc) const override; + void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) override; + void CopyEFB(float Gamma) override; D3DTexture2D* const tex; }; @@ -81,10 +81,10 @@ public: } private: - XFBSourceBase* CreateXFBSource(unsigned int target_width, unsigned int target_height); - void GetTargetSize(unsigned int *width, unsigned int *height, const EFBRectangle& sourceRc); + XFBSourceBase* CreateXFBSource(unsigned int target_width, unsigned int target_height) override; + void GetTargetSize(unsigned int *width, unsigned int *height, const EFBRectangle& sourceRc) override; - void CopyToRealXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma); + void CopyToRealXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma) override; static struct Efb { diff --git a/Source/Core/VideoBackends/D3D/PerfQuery.h b/Source/Core/VideoBackends/D3D/PerfQuery.h index c8f9d08008..98cdbc7d68 100644 --- a/Source/Core/VideoBackends/D3D/PerfQuery.h +++ b/Source/Core/VideoBackends/D3D/PerfQuery.h @@ -12,12 +12,12 @@ public: PerfQuery(); ~PerfQuery(); - void EnableQuery(PerfQueryGroup type); - void DisableQuery(PerfQueryGroup type); - void ResetQuery(); - u32 GetQueryResult(PerfQueryType type); - void FlushResults(); - bool IsFlushed() const; + void EnableQuery(PerfQueryGroup type) override; + void DisableQuery(PerfQueryGroup type) override; + void ResetQuery() override; + u32 GetQueryResult(PerfQueryType type) override; + void FlushResults() override; + bool IsFlushed() const override; private: struct ActiveQuery diff --git a/Source/Core/VideoBackends/D3D/Render.h b/Source/Core/VideoBackends/D3D/Render.h index 69ce9f3e78..0b71ad4801 100644 --- a/Source/Core/VideoBackends/D3D/Render.h +++ b/Source/Core/VideoBackends/D3D/Render.h @@ -12,41 +12,41 @@ public: Renderer(); ~Renderer(); - void SetColorMask(); - void SetBlendMode(bool forceUpdate); - void SetScissorRect(const EFBRectangle& rc); - void SetGenerationMode(); - void SetDepthMode(); - void SetLogicOpMode(); - void SetDitherMode(); - void SetLineWidth(); - void SetSamplerState(int stage,int texindex); - void SetInterlacingMode(); - void SetViewport(); + void SetColorMask() override; + void SetBlendMode(bool forceUpdate) override; + void SetScissorRect(const EFBRectangle& rc) override; + void SetGenerationMode() override; + void SetDepthMode() override; + void SetLogicOpMode() override; + void SetDitherMode() override; + void SetLineWidth() override; + void SetSamplerState(int stage,int texindex) override; + void SetInterlacingMode() override; + void SetViewport() override; // TODO: Fix confusing names (see ResetAPIState and RestoreAPIState) - void ApplyState(bool bUseDstAlpha); - void RestoreState(); + void ApplyState(bool bUseDstAlpha) override; + void RestoreState() override; void ApplyCullDisable(); void RestoreCull(); - void RenderText(const std::string& text, int left, int top, u32 color); + void RenderText(const std::string& text, int left, int top, u32 color) override; - u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data); + u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) override; - void ResetAPIState(); - void RestoreAPIState(); + void ResetAPIState() override; + void RestoreAPIState() override; - TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc); + TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) override; - void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma); + void SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& rc,float Gamma) override; - void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z); + void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override; - void ReinterpretPixelData(unsigned int convtype); + void ReinterpretPixelData(unsigned int convtype) override; - bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc); + bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) override; static bool CheckForResize(); }; diff --git a/Source/Core/VideoBackends/D3D/TextureCache.h b/Source/Core/VideoBackends/D3D/TextureCache.h index 9367bd94a2..569f2d024f 100644 --- a/Source/Core/VideoBackends/D3D/TextureCache.h +++ b/Source/Core/VideoBackends/D3D/TextureCache.h @@ -27,21 +27,21 @@ private: ~TCacheEntry(); void Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int levels); + unsigned int expanded_width, unsigned int levels) override; void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, unsigned int cbufid, - const float *colmat); + const float *colmat) override; - void Bind(unsigned int stage); - bool Save(const std::string& filename, unsigned int level); + void Bind(unsigned int stage) override; + bool Save(const std::string& filename, unsigned int level) override; }; TCacheEntryBase* CreateTexture(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt); + unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt) override; - TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h); + TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) override; u64 EncodeToRamFromTexture(u32 address, void* source_texture, u32 SourceW, u32 SourceH, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle& source) {return 0;}; }; diff --git a/Source/Core/VideoBackends/D3D/VertexManager.h b/Source/Core/VideoBackends/D3D/VertexManager.h index e74514d85c..183f65575f 100644 --- a/Source/Core/VideoBackends/D3D/VertexManager.h +++ b/Source/Core/VideoBackends/D3D/VertexManager.h @@ -17,12 +17,12 @@ public: VertexManager(); ~VertexManager(); - NativeVertexFormat* CreateNativeVertexFormat(); - void CreateDeviceObjects(); - void DestroyDeviceObjects(); + NativeVertexFormat* CreateNativeVertexFormat() override; + void CreateDeviceObjects() override; + void DestroyDeviceObjects() override; protected: - virtual void ResetBuffer(u32 stride); + virtual void ResetBuffer(u32 stride) override; u16* GetIndexBuffer() { return &LocalIBuffer[0]; } private: @@ -30,7 +30,7 @@ private: void PrepareDrawBuffers(); void Draw(u32 stride); // temp - void vFlush(bool useDstAlpha); + void vFlush(bool useDstAlpha) override; u32 m_vertex_buffer_cursor; u32 m_vertex_draw_offset; diff --git a/Source/Core/VideoBackends/D3D/VideoBackend.h b/Source/Core/VideoBackends/D3D/VideoBackend.h index 696913cdc4..6de3ceb743 100644 --- a/Source/Core/VideoBackends/D3D/VideoBackend.h +++ b/Source/Core/VideoBackends/D3D/VideoBackend.h @@ -8,19 +8,19 @@ namespace DX11 class VideoBackend : public VideoBackendHardware { - bool Initialize(void *&); - void Shutdown(); + bool Initialize(void *&) override; + void Shutdown() override; - std::string GetName(); - std::string GetDisplayName(); + std::string GetName() const override; + std::string GetDisplayName() const override; - void Video_Prepare(); - void Video_Cleanup(); + void Video_Prepare() override; + void Video_Cleanup() override; - void ShowConfig(void* parent); + void ShowConfig(void* parent) override; - void UpdateFPSDisplay(const std::string&); - unsigned int PeekMessages(); + void UpdateFPSDisplay(const std::string&) override; + unsigned int PeekMessages() override; }; } diff --git a/Source/Core/VideoBackends/OGL/VideoBackend.h b/Source/Core/VideoBackends/OGL/VideoBackend.h index c356feb734..3a8aed0dd4 100644 --- a/Source/Core/VideoBackends/OGL/VideoBackend.h +++ b/Source/Core/VideoBackends/OGL/VideoBackend.h @@ -11,8 +11,8 @@ class VideoBackend : public VideoBackendHardware bool Initialize(void *&) override; void Shutdown() override; - std::string GetName() override; - std::string GetDisplayName() override; + std::string GetName() const override; + std::string GetDisplayName() const override; void Video_Prepare() override; void Video_Cleanup() override; diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 3821225031..b63f3ae2ff 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -92,12 +92,12 @@ Make AA apply instantly during gameplay if possible namespace OGL { -std::string VideoBackend::GetName() +std::string VideoBackend::GetName() const { return "OGL"; } -std::string VideoBackend::GetDisplayName() +std::string VideoBackend::GetDisplayName() const { if (GLInterface != nullptr && GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3) return "OpenGLES"; diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index c0736c883a..e88d8d1441 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -56,7 +56,7 @@ static volatile bool fifoStateRun = false; static volatile bool emuRunningState = false; static std::mutex m_csSWVidOccupied; -std::string VideoSoftware::GetName() +std::string VideoSoftware::GetName() const { return _trans("Software Renderer"); } diff --git a/Source/Core/VideoBackends/Software/VideoBackend.h b/Source/Core/VideoBackends/Software/VideoBackend.h index a9de97d816..50fa855f4d 100644 --- a/Source/Core/VideoBackends/Software/VideoBackend.h +++ b/Source/Core/VideoBackends/Software/VideoBackend.h @@ -13,7 +13,7 @@ class VideoSoftware : public VideoBackend bool Initialize(void *&) override; void Shutdown() override; - std::string GetName() override; + std::string GetName() const override; void EmuStateChange(EMUSTATE_CHANGE newState) override; diff --git a/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp b/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp index d730efd6fe..fc205a3965 100644 --- a/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp +++ b/Source/Core/VideoBackends/Software/VideoConfigDialog.cpp @@ -47,11 +47,10 @@ VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, wxStaticText* const label_backend = new wxStaticText(page_general, wxID_ANY, _("Backend:")); wxChoice* const choice_backend = new wxChoice(page_general, wxID_ANY, wxDefaultPosition); - std::vector::const_iterator - it = g_available_video_backends.begin(), - itend = g_available_video_backends.end(); - for (; it != itend; ++it) - choice_backend->AppendString(StrToWxStr((*it)->GetDisplayName())); + for (const VideoBackend* backend : g_available_video_backends) + { + choice_backend->AppendString(StrToWxStr(backend->GetDisplayName())); + } // TODO: How to get the translated plugin name? choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName())); diff --git a/Source/Core/VideoCommon/VideoBackendBase.h b/Source/Core/VideoCommon/VideoBackendBase.h index fcbe66bcce..2dcf6c43a0 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.h +++ b/Source/Core/VideoCommon/VideoBackendBase.h @@ -80,8 +80,8 @@ public: virtual void Shutdown() = 0; virtual void RunLoop(bool enable) = 0; - virtual std::string GetName() = 0; - virtual std::string GetDisplayName() { return GetName(); } + virtual std::string GetName() const = 0; + virtual std::string GetDisplayName() const { return GetName(); } virtual void ShowConfig(void*) {}