From a9a15690a206c08644ed2301ffadac4b2c86def6 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 10 Mar 2014 06:17:41 +0100 Subject: [PATCH 1/7] UCode_AX: don't always call NotifyAXThread() StartWorking() already does this if needed --- Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp index 2141b9c383..f7eea84f22 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -669,7 +669,6 @@ void CUCode_AX::HandleMail(u32 mail) { CopyCmdList(mail, cmdlist_size); StartWorking(); - NotifyAXThread(); } else if (m_UploadSetupInProgress) { From 3c46c0ede9801348ef3e1c24ee420871f633ce4a Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 10 Mar 2014 08:30:54 +0100 Subject: [PATCH 2/7] Interpreter: make some class members private --- .../Core/PowerPC/Interpreter/Interpreter.h | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h index b1321df18d..4df813d5b7 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter.h @@ -206,7 +206,6 @@ public: static void stwcxd(UGeckoInstruction _inst); static void stwux(UGeckoInstruction _inst); static void stwx(UGeckoInstruction _inst); - static void sync(UGeckoInstruction _inst); static void tlbia(UGeckoInstruction _inst); static void tlbie(UGeckoInstruction _inst); static void tlbsync(UGeckoInstruction _inst); @@ -281,15 +280,26 @@ public: static void mcrf(UGeckoInstruction _inst); static void rfi(UGeckoInstruction _inst); static void rfid(UGeckoInstruction _inst); -// static void sync(UGeckoInstruction _inst); + static void sync(UGeckoInstruction _inst); static void isync(UGeckoInstruction _inst); + static _interpreterInstruction m_opTable[64]; + static _interpreterInstruction m_opTable4[1024]; + static _interpreterInstruction m_opTable19[1024]; + static _interpreterInstruction m_opTable31[1024]; + static _interpreterInstruction m_opTable59[32]; + static _interpreterInstruction m_opTable63[1024]; + + // singleton + static Interpreter* getInstance(); + static void RunTable4(UGeckoInstruction _instCode); static void RunTable19(UGeckoInstruction _instCode); static void RunTable31(UGeckoInstruction _instCode); static void RunTable59(UGeckoInstruction _instCode); static void RunTable63(UGeckoInstruction _instCode); +private: // flag helper static void Helper_UpdateCR0(u32 _uValue); static void Helper_UpdateCR1(double _fValue); @@ -310,22 +320,6 @@ public: // other helper static u32 Helper_Mask(int mb, int me); - static _interpreterInstruction m_opTable[64]; - static _interpreterInstruction m_opTable4[1024]; - static _interpreterInstruction m_opTable19[1024]; - static _interpreterInstruction m_opTable31[1024]; - static _interpreterInstruction m_opTable59[32]; - static _interpreterInstruction m_opTable63[1024]; - - // singleton - static Interpreter *getInstance(); - -private: - Interpreter() { } - ~Interpreter() { } - Interpreter(const Interpreter &); - Interpreter & operator=(const Interpreter &); - static void Helper_FloatCompareOrdered(UGeckoInstruction _inst, double a, double b); static void Helper_FloatCompareUnordered(UGeckoInstruction _inst, double a, double b); From 3fc9ca07892e123a8be5ee3d1f22693e896eb619 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 10 Mar 2014 08:32:12 +0100 Subject: [PATCH 3/7] UCodes: nits --- Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp | 13 +++++-------- Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp | 6 +++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp index 1a905978a6..6048fd4c75 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_ROM.cpp @@ -57,10 +57,6 @@ void CUCode_Rom::HandleMail(u32 _uMail) m_CurrentUCode.m_Length = _uMail & 0xffff; break; - case 0x80F3C002: - m_CurrentUCode.m_IMEMAddress = _uMail & 0xffff; - break; - case 0x80F3B002: m_CurrentUCode.m_DMEMLength = _uMail & 0xffff; if (m_CurrentUCode.m_DMEMLength) { @@ -68,16 +64,17 @@ void CUCode_Rom::HandleMail(u32 _uMail) } break; + case 0x80F3C002: + m_CurrentUCode.m_IMEMAddress = _uMail & 0xffff; + break; + case 0x80F3D001: - { m_CurrentUCode.m_StartPC = _uMail & 0xffff; BootUCode(); return; // Important! BootUCode indirectly does "delete this;". Must exit immediately. - } - break; default: - break; + break; } // THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ... diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp index 7c8536ccc0..62c67d7927 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCode_Zelda.cpp @@ -58,7 +58,7 @@ CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC) if (IsLightVersion()) { - NOTICE_LOG(DSPHLE, "Luigi Stylee!"); + DEBUG_LOG(DSPHLE, "Luigi Stylee!"); m_rMailHandler.PushMail(0x88881111); } else @@ -92,9 +92,9 @@ CUCode_Zelda::~CUCode_Zelda() u8 *CUCode_Zelda::GetARAMPointer(u32 address) { if (IsDMAVersion()) - return (u8 *)(Memory::GetPointer(m_DMABaseAddr)) + address; + return Memory::GetPointer(m_DMABaseAddr) + address; else - return (u8 *)(DSP::GetARAMPtr()) + address; + return DSP::GetARAMPtr() + address; } void CUCode_Zelda::Update(int cycles) From 2fcaca0603f750bb68349e8bbd506b53dd30915b Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Tue, 11 Mar 2014 06:55:00 +0100 Subject: [PATCH 4/7] More range-based loops and overrides --- Source/Core/Core/ActionReplay.cpp | 9 ++-- Source/Core/Core/HW/Wiimote.cpp | 9 ++-- .../Core/PowerPC/Interpreter/Interpreter.h | 3 +- Source/Core/DolphinWX/CheatsWindow.cpp | 9 ++-- Source/Core/DolphinWX/GeckoCodeDiag.cpp | 38 +++++++--------- Source/Core/DolphinWX/VideoConfigDiag.cpp | 36 +++++++-------- .../VideoBackends/D3D/FramebufferManager.h | 12 ++--- Source/Core/VideoBackends/D3D/PerfQuery.h | 12 ++--- Source/Core/VideoBackends/D3D/Render.h | 44 +++++++++---------- Source/Core/VideoBackends/D3D/TextureCache.h | 12 ++--- Source/Core/VideoBackends/D3D/VertexManager.h | 10 ++--- Source/Core/VideoBackends/D3D/VideoBackend.h | 18 ++++---- Source/Core/VideoBackends/OGL/VideoBackend.h | 4 +- Source/Core/VideoBackends/OGL/main.cpp | 4 +- Source/Core/VideoBackends/Software/SWmain.cpp | 2 +- .../VideoBackends/Software/VideoBackend.h | 2 +- .../Software/VideoConfigDialog.cpp | 9 ++-- Source/Core/VideoCommon/VideoBackendBase.h | 4 +- 18 files changed, 110 insertions(+), 127 deletions(-) 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*) {} From 7e39cf3b0d1bd41f830c8afe792bd0f2d9c8f2a6 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 13 Mar 2014 00:39:55 +0100 Subject: [PATCH 5/7] .gitignore: fix the build directory pattern --- .gitignore | 2 +- Source/Core/VideoBackends/D3D/main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ffc4a256aa..750bd009e9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ Thumbs.db # Ignore autogenerated source files Source/Core/Common/scmrev.h # Ignore files output by build -/[Bb]uild[-_]*/ +/[Bb]uild*/ /[Bb]inary/ /obj/ # Ignore various files created by visual studio/msbuild diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 99def4998e..37a18f95f0 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -61,12 +61,12 @@ void VideoBackend::UpdateFPSDisplay(const std::string& text) EmuWindow::SetWindowText(StringFromFormat("%s | D3D | %s", scm_rev_str, text.c_str())); } -std::string VideoBackend::GetName() +std::string VideoBackend::GetName() const { return "D3D"; } -std::string VideoBackend::GetDisplayName() +std::string VideoBackend::GetDisplayName() const { return "Direct3D"; } From fa3cc057530570ba4113e022b3f44c2483a87684 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 15 Mar 2014 03:29:53 +0100 Subject: [PATCH 6/7] Turn some non-const refs into pointers --- Source/Core/Common/IniFile.cpp | 18 ++++---- Source/Core/Common/IniFile.h | 10 ++-- Source/Core/Core/ActionReplay.cpp | 10 ++-- Source/Core/Core/GeckoCodeConfig.cpp | 14 ++++-- .../Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp | 4 +- Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h | 4 +- Source/Core/Core/PatchEngine.cpp | 33 +++++++++---- .../DolphinWX/Debugger/BreakpointWindow.cpp | 13 ++++-- Source/Core/DolphinWX/FrameAui.cpp | 2 + Source/Core/InputCommon/UDPWiimote.cpp | 46 +++++++++---------- Source/Core/InputCommon/UDPWiimote.h | 23 ++++++---- 11 files changed, 106 insertions(+), 71 deletions(-) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 5fb5ce1e38..f830fd6b45 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -114,7 +114,7 @@ bool IniFile::Section::Get(const std::string& key, std::string* value, const std return false; } -bool IniFile::Section::Get(const std::string& key, std::vector& out) +bool IniFile::Section::Get(const std::string& key, std::vector* out) { std::string temp; bool retval = Get(key, &temp); @@ -132,7 +132,7 @@ bool IniFile::Section::Get(const std::string& key, std::vector& out size_t subEnd = temp.find_first_of(",", subStart); if (subStart != subEnd) // take from first char until next , - out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart))); + out->push_back(StripSpaces(temp.substr(subStart, subEnd - subStart))); // Find the next non , char subStart = temp.find_first_not_of(",", subEnd); } @@ -273,23 +273,25 @@ bool IniFile::DeleteKey(const std::string& sectionName, const std::string& key) } // Return a list of all keys in a section -bool IniFile::GetKeys(const std::string& sectionName, std::vector& keys) const +bool IniFile::GetKeys(const std::string& sectionName, std::vector* keys) const { const Section* section = GetSection(sectionName); if (!section) + { return false; - keys = section->keys_order; + } + *keys = section->keys_order; return true; } // Return a list of all lines in a section -bool IniFile::GetLines(const std::string& sectionName, std::vector& lines, const bool remove_comments) const +bool IniFile::GetLines(const std::string& sectionName, std::vector* lines, const bool remove_comments) const { const Section* section = GetSection(sectionName); if (!section) return false; - lines.clear(); + lines->clear(); for (std::string line : section->lines) { line = StripSpaces(line); @@ -308,7 +310,7 @@ bool IniFile::GetLines(const std::string& sectionName, std::vector& } } - lines.push_back(line); + lines->push_back(line); } return true; @@ -426,7 +428,7 @@ bool IniFile::Save(const std::string& filename) return File::RenameSync(temp, filename); } -bool IniFile::Get(const std::string& sectionName, const std::string& key, std::vector& values) +bool IniFile::Get(const std::string& sectionName, const std::string& key, std::vector* values) { Section *section = GetSection(sectionName); if (!section) diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index 7db66e45cb..36fe292373 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -66,7 +66,7 @@ public: bool Get(const std::string& key, bool* value, bool defaultValue = false); bool Get(const std::string& key, float* value, float defaultValue = false); bool Get(const std::string& key, double* value, double defaultValue = false); - bool Get(const std::string& key, std::vector& values); + bool Get(const std::string& key, std::vector* values); bool operator < (const Section& other) const { return name < other.name; @@ -116,7 +116,7 @@ public: bool Get(const std::string& sectionName, const std::string& key, int* value, int defaultValue = 0); bool Get(const std::string& sectionName, const std::string& key, u32* value, u32 defaultValue = 0); bool Get(const std::string& sectionName, const std::string& key, bool* value, bool defaultValue = false); - bool Get(const std::string& sectionName, const std::string& key, std::vector& values); + bool Get(const std::string& sectionName, const std::string& key, std::vector* values); bool Get(const std::string& sectionName, const std::string& key, std::string* value, const std::string& defaultValue = NULL_STRING); template bool GetIfExists(const std::string& sectionName, const std::string& key, T value) @@ -126,10 +126,10 @@ public: return false; } - bool GetKeys(const std::string& sectionName, std::vector& keys) const; + bool GetKeys(const std::string& sectionName, std::vector* keys) const; - void SetLines(const std::string& sectionName, const std::vector &lines); - bool GetLines(const std::string& sectionName, std::vector& lines, const bool remove_comments = true) const; + void SetLines(const std::string& sectionName, const std::vector& lines); + bool GetLines(const std::string& sectionName, std::vector* lines, const bool remove_comments = true) const; bool DeleteKey(const std::string& sectionName, const std::string& key); bool DeleteSection(const std::string& sectionName); diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 849f62cbac..f5ddafc81a 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -123,8 +123,8 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad std::vector enabledLines; std::set enabledNames; - localIni.GetLines("ActionReplay_Enabled", enabledLines); - for (auto& line : enabledLines) + localIni.GetLines("ActionReplay_Enabled", &enabledLines); + for (const std::string& line : enabledLines) { if (line.size() != 0 && line[0] == '$') { @@ -140,12 +140,14 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, bool forceLoad std::vector encryptedLines; ARCode currentCode; - ini->GetLines("ActionReplay", lines); + ini->GetLines("ActionReplay", &lines); - for (std::string line : lines) + for (const std::string& line : lines) { if (line.empty()) + { continue; + } std::vector pieces; diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index 6d41d2b3fa..c2a3f11393 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -20,7 +20,7 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector lines; - ini->GetLines("Gecko", lines, false); + ini->GetLines("Gecko", &lines, false); GeckoCode gcode; @@ -72,19 +72,25 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vectorGetLines("Gecko_Enabled", lines, false); + ini->GetLines("Gecko_Enabled", &lines, false); - for (auto line : lines) + for (const std::string& line : lines) { if (line.size() == 0 || line[0] != '$') + { continue; + } std::string name = line.substr(1); - for (auto& ogcode : gcodes) + for (GeckoCode& ogcode : gcodes) { if (ogcode.name == name) + { ogcode.enabled = true; + } } } } diff --git a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp index d306c111c3..0bd5b65f83 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Attachment/Nunchuk.cpp @@ -130,7 +130,7 @@ void Nunchuk::GetState(u8* const data, const bool focus) { u8 mask; float x, y; - m_udpWrap->inst->getNunchuck(x, y, mask); + m_udpWrap->inst->getNunchuck(&x, &y, &mask); // buttons if (mask & UDPWM_NC) ncdata->bt &= ~WiimoteEmu::Nunchuk::BUTTON_C; @@ -146,7 +146,7 @@ void Nunchuk::GetState(u8* const data, const bool focus) if (m_udpWrap->updNunAccel) { float x, y, z; - m_udpWrap->inst->getNunchuckAccel(x, y, z); + m_udpWrap->inst->getNunchuckAccel(&x, &y, &z); accel.x = x; accel.y = y; accel.z = z; diff --git a/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h b/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h index 7a827d48a5..003cc90395 100644 --- a/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h +++ b/Source/Core/Core/HW/WiimoteEmu/UDPTLayer.h @@ -34,7 +34,7 @@ namespace UDPTLayer if (!(m->inst)) return; if (!(m->updAccel)) return; float x, y, z; - m->inst->getAccel(x, y, z); + m->inst->getAccel(&x, &y, &z); data->x = x; data->y = y; data->z = z; @@ -46,7 +46,7 @@ namespace UDPTLayer if (!(m->updIR)) return; if ((*x >= -0.999) && (*x <= 0.999) && (*y >= -0.999) && (*y <= 0.999)) return; //the received values are used ONLY when the normal pointer is offscreen float _x, _y; - m->inst->getIR(_x, _y); + m->inst->getIR(&_x, &_y); *x = _x * 2 - 1; *y = -(_y * 2 - 1); *z = 0; diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index bc00053963..dd9fe7de8e 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -53,7 +53,7 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I std::string enabledSectionName = section + "_Enabled"; std::vector enabledLines; std::set enabledNames; - localIni.GetLines(enabledSectionName, enabledLines); + localIni.GetLines(enabledSectionName, &enabledLines); for (const std::string& line : enabledLines) { if (line.size() != 0 && line[0] == '$') @@ -69,7 +69,7 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I { std::vector lines; Patch currentPatch; - ini->GetLines(section, lines); + ini->GetLines(section, &lines); for (std::string& line : lines) { @@ -80,7 +80,9 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I { // Take care of the previous code if (currentPatch.name.size()) + { patches.push_back(currentPatch); + } currentPatch.entries.clear(); // Set active and name @@ -93,7 +95,9 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I std::string::size_type loc = line.find_first_of('=', 0); if (loc != std::string::npos) + { line[loc] = ':'; + } std::vector items; SplitString(line, ':', items); @@ -108,33 +112,41 @@ void LoadPatchSection(const std::string& section, std::vector& patches, I pE.type = PatchType(std::find(PatchTypeStrings, PatchTypeStrings + 3, items[1]) - PatchTypeStrings); success &= (pE.type != (PatchType)3); if (success) + { currentPatch.entries.push_back(pE); + } } } } if (currentPatch.name.size() && currentPatch.entries.size()) + { patches.push_back(currentPatch); + } } } -static void LoadDiscList(const char *section, std::vector &_discList, IniFile &ini) +static void LoadDiscList(const std::string& section, IniFile& ini) { std::vector lines; - if (!ini.GetLines(section, lines)) + if (!ini.GetLines(section, &lines)) + { return; + } for (const std::string& line : lines) { if (!line.empty()) - _discList.push_back(line); + { + discList.push_back(line); + } } } -static void LoadSpeedhacks(const char *section, std::map &hacks, IniFile &ini) +static void LoadSpeedhacks(const std::string& section, IniFile& ini) { std::vector keys; - ini.GetKeys(section, keys); + ini.GetKeys(section, &keys); for (const std::string& key : keys) { std::string value; @@ -146,7 +158,8 @@ static void LoadSpeedhacks(const char *section, std::map &hacks, IniFi bool success = true; success &= TryParse(key, &address); success &= TryParse(value, &cycles); - if (success) { + if (success) + { speedHacks[address] = (int)cycles; } } @@ -176,8 +189,8 @@ void LoadPatches() Gecko::LoadCodes(globalIni, localIni, gcodes); Gecko::SetActiveCodes(gcodes); - LoadSpeedhacks("Speedhacks", speedHacks, merged); - LoadDiscList("DiscList", discList, merged); + LoadSpeedhacks("Speedhacks", merged); + LoadDiscList("DiscList", merged); } void ApplyPatches(const std::vector &patches) diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp index b650ac2655..1fa0183cdb 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp @@ -112,7 +112,7 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent m_BreakPointListView = new CBreakPointView(this, wxID_ANY); m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo().ToolbarPane().Top(). - LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false)); + LeftDockable(false).RightDockable(false).BottomDockable(false).Floatable(false)); m_mgr.AddPane(m_BreakPointListView, wxAuiPaneInfo().CenterPane()); m_mgr.Update(); } @@ -195,12 +195,19 @@ void CBreakPointWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) MemChecks::TMemChecksStr newmcs; if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) + { return; + } - if (ini.GetLines("BreakPoints", newbps, false)) + if (ini.GetLines("BreakPoints", &newbps, false)) + { PowerPC::breakpoints.AddFromStrings(newbps); - if (ini.GetLines("MemoryChecks", newmcs, false)) + } + + if (ini.GetLines("MemoryChecks", &newmcs, false)) + { PowerPC::memchecks.AddFromStrings(newmcs); + } NotifyUpdate(); } diff --git a/Source/Core/DolphinWX/FrameAui.cpp b/Source/Core/DolphinWX/FrameAui.cpp index 10aa258fe6..22356dcf73 100644 --- a/Source/Core/DolphinWX/FrameAui.cpp +++ b/Source/Core/DolphinWX/FrameAui.cpp @@ -851,7 +851,9 @@ void CFrame::LoadIniPerspectives() // Don't save a blank perspective if (Tmp.Name.empty()) + { continue; + } _Section = StringFromFormat("P - %s", Tmp.Name.c_str()); ini.Get(_Section, "Perspective", &_Perspective, diff --git a/Source/Core/InputCommon/UDPWiimote.cpp b/Source/Core/InputCommon/UDPWiimote.cpp index b4bccdb9f4..00023d66c3 100644 --- a/Source/Core/InputCommon/UDPWiimote.cpp +++ b/Source/Core/InputCommon/UDPWiimote.cpp @@ -65,9 +65,9 @@ struct UDPWiimote::_d int UDPWiimote::noinst = 0; UDPWiimote::UDPWiimote(const std::string& _port, const std::string& name, int _index) : - port(_port), displayName(name), - d(new _d) ,x(0), y(0), z(1.0f), naX(0), naY(0), naZ(-1.0f), nunX(0), nunY(0), - pointerX(1001.0f / 2), pointerY(0), nunMask(0), mask(0), index(_index), int_port(atoi(_port.c_str())) + port(_port), displayName(name), d(new _d), + waX(0), waY(0), waZ(1), naX(0), naY(0), naZ(-1), nunX(0), nunY(0), + pointerX(1001.0f / 2), pointerY(0), nunMask(0), wiimoteMask(0), index(_index), int_port(atoi(_port.c_str())) { static bool sranded=false; @@ -275,9 +275,9 @@ int UDPWiimote::pharsePacket(u8 * bf, size_t size) ux=(double)((s32)ntohl(*p)); p++; uy=(double)((s32)ntohl(*p)); p++; uz=(double)((s32)ntohl(*p)); p++; - x=ux/1048576; //packet accel data - y=uy/1048576; - z=uz/1048576; + waX=ux/1048576; //packet accel data + waY=uy/1048576; + waZ=uz/1048576; } if (bf[2] & BUTT_FLAG) @@ -285,7 +285,7 @@ int UDPWiimote::pharsePacket(u8 * bf, size_t size) if ((size-(((u8*)p)-bf)) < 4) return -1; - mask=ntohl(*p); p++; + wiimoteMask = ntohl(*p); p++; } if (bf[2] & IR_FLAG) @@ -388,43 +388,43 @@ void UDPWiimote::broadcastPresence() broadcastIPv6(bf,7+slen); } -void UDPWiimote::getAccel(float &_x, float &_y, float &_z) +void UDPWiimote::getAccel(float* x, float* y, float* z) { std::lock_guard lk(d->mutex); - _x=(float)x; - _y=(float)y; - _z=(float)z; + *x = (float)waX; + *y = (float)waY; + *z = (float)waZ; } u32 UDPWiimote::getButtons() { u32 msk; std::lock_guard lk(d->mutex); - msk=mask; + msk = wiimoteMask; return msk; } -void UDPWiimote::getIR(float& _x, float& _y) +void UDPWiimote::getIR(float* x, float* y) { std::lock_guard lk(d->mutex); - _x=(float)pointerX; - _y=(float)pointerY; + *x = (float)pointerX; + *y = (float)pointerY; } -void UDPWiimote::getNunchuck(float &_x, float &_y, u8 &_mask) +void UDPWiimote::getNunchuck(float* x, float* y, u8* mask) { std::lock_guard lk(d->mutex); - _x=(float)nunX; - _y=(float)nunY; - _mask=nunMask; + *x = (float)nunX; + *y = (float)nunY; + *mask = nunMask; } -void UDPWiimote::getNunchuckAccel(float& _x, float& _y, float& _z) +void UDPWiimote::getNunchuckAccel(float* x, float* y, float* z) { std::lock_guard lk(d->mutex); - _x = (float)naX; - _y = (float)naY; - _z = (float)naZ; + *x = (float)naX; + *y = (float)naY; + *z = (float)naZ; } const std::string& UDPWiimote::getPort() diff --git a/Source/Core/InputCommon/UDPWiimote.h b/Source/Core/InputCommon/UDPWiimote.h index 806aa610e2..5dd2c500ca 100644 --- a/Source/Core/InputCommon/UDPWiimote.h +++ b/Source/Core/InputCommon/UDPWiimote.h @@ -27,12 +27,15 @@ class UDPWiimote public: UDPWiimote(const std::string& port, const std::string& name, int index); virtual ~UDPWiimote(); - void getAccel(float& x, float& y, float& z); + void getAccel(float* x, float* y, float* z); u32 getButtons(); - void getNunchuck(float& x, float& y, u8& mask); - void getIR(float& x, float& y); - void getNunchuckAccel(float& x, float& y, float& z); - int getErrNo() { return err; } + void getNunchuck(float* x, float* y, u8* mask); + void getIR(float* x, float* y); + void getNunchuckAccel(float* x, float* y, float* z); + int getErrNo() + { + return err; + } const std::string& getPort(); void changeName(const std::string& name); @@ -42,12 +45,12 @@ private: int pharsePacket(u8* data, size_t size); struct _d; //using pimpl because Winsock2.h doesn't have include guards -_- _d* d; - double x,y,z; - double naX,naY,naZ; - double nunX,nunY; - double pointerX,pointerY; + double waX, waY, waZ; + double naX, naY, naZ; + double nunX, nunY; + double pointerX, pointerY; u8 nunMask; - u32 mask; + u32 wiimoteMask; u16 bcastMagic; int err; int index; From 46becfc06b3a8b91d0500a8ee226c85b4450dddf Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 15 Mar 2014 03:30:59 +0100 Subject: [PATCH 7/7] Tests: fix signed/unsigned comparison warning --- Source/UnitTests/Common/CommonFuncsTest.cpp | 6 +++--- Source/UnitTests/Common/FifoQueueTest.cpp | 10 +++++----- Source/UnitTests/Common/FixedSizeQueueTest.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/UnitTests/Common/CommonFuncsTest.cpp b/Source/UnitTests/Common/CommonFuncsTest.cpp index 81eb089e92..285b5f253e 100644 --- a/Source/UnitTests/Common/CommonFuncsTest.cpp +++ b/Source/UnitTests/Common/CommonFuncsTest.cpp @@ -11,8 +11,8 @@ TEST(CommonFuncs, ArraySizeMacro) char test[4]; u32 test2[42]; - EXPECT_EQ(4, ArraySize(test)); - EXPECT_EQ(42, ArraySize(test2)); + EXPECT_EQ(4u, ArraySize(test)); + EXPECT_EQ(42u, ArraySize(test2)); } TEST(CommonFuncs, RoundUpPow2Macro) @@ -41,6 +41,6 @@ TEST(CommonFuncs, Swap) { EXPECT_EQ(0xf0, Common::swap8(0xf0)); EXPECT_EQ(0x1234, Common::swap16(0x3412)); - EXPECT_EQ(0x12345678, Common::swap32(0x78563412)); + EXPECT_EQ(0x12345678u, Common::swap32(0x78563412)); EXPECT_EQ(0x123456789abcdef0ull, Common::swap64(0xf0debc9a78563412ull)); } diff --git a/Source/UnitTests/Common/FifoQueueTest.cpp b/Source/UnitTests/Common/FifoQueueTest.cpp index 60135e699c..6530e15ddd 100644 --- a/Source/UnitTests/Common/FifoQueueTest.cpp +++ b/Source/UnitTests/Common/FifoQueueTest.cpp @@ -11,22 +11,22 @@ TEST(FifoQueue, Simple) { Common::FifoQueue q; - EXPECT_EQ(0, q.Size()); + EXPECT_EQ(0u, q.Size()); EXPECT_TRUE(q.Empty()); q.Push(1); - EXPECT_EQ(1, q.Size()); + EXPECT_EQ(1u, q.Size()); EXPECT_FALSE(q.Empty()); u32 v; q.Pop(v); - EXPECT_EQ(1, v); - EXPECT_EQ(0, q.Size()); + EXPECT_EQ(1u, v); + EXPECT_EQ(0u, q.Size()); EXPECT_TRUE(q.Empty()); // Test the FIFO order. for (u32 i = 0; i < 1000; ++i) q.Push(i); - EXPECT_EQ(1000, q.Size()); + EXPECT_EQ(1000u, q.Size()); for (u32 i = 0; i < 1000; ++i) { u32 v2; q.Pop(v2); diff --git a/Source/UnitTests/Common/FixedSizeQueueTest.cpp b/Source/UnitTests/Common/FixedSizeQueueTest.cpp index 484dc64419..d77f3645f0 100644 --- a/Source/UnitTests/Common/FixedSizeQueueTest.cpp +++ b/Source/UnitTests/Common/FixedSizeQueueTest.cpp @@ -10,7 +10,7 @@ TEST(FixedSizeQueue, Simple) { FixedSizeQueue q; - EXPECT_EQ(0, q.size()); + EXPECT_EQ(0u, q.size()); q.push(0); q.push(1); @@ -29,5 +29,5 @@ TEST(FixedSizeQueue, Simple) EXPECT_EQ(1003, q.pop_front()); EXPECT_EQ(1004, q.pop_front()); - EXPECT_EQ(0, q.size()); + EXPECT_EQ(0u, q.size()); }