From 876ea3db5284cdefdd4454bc29a1a038dc5bf3fa Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 12 Apr 2022 00:21:03 +1000 Subject: [PATCH] Common: Purge pxStreams and some other wx string routines --- common/CMakeLists.txt | 3 - common/Darwin/DarwinSemaphore.cpp | 1 - common/Mutex.cpp | 1 - common/Semaphore.cpp | 1 - common/StringHelpers.cpp | 17 -- common/StringHelpers.h | 64 -------- common/ThreadTools.cpp | 1 - common/common.vcxproj | 2 - common/common.vcxproj.filters | 6 - common/pxStreams.cpp | 257 ------------------------------ common/pxStreams.h | 119 -------------- common/wxBaseTools.h | 65 -------- pcsx2/GS/GS.cpp | 2 - pcsx2/PAD/Linux/Global.h | 1 - pcsx2/PAD/Windows/Global.h | 1 - pcsx2/PrecompiledHeader.h | 1 - pcsx2/SPU2/spu2.cpp | 1 - pcsx2/USB/USB.cpp | 1 - pcsx2/gui/Dialogs/ModalPopups.h | 1 - pcsx2/gui/i18n.cpp | 1 + pcsx2/gui/wxGuiTools.h | 29 ++++ 21 files changed, 30 insertions(+), 545 deletions(-) delete mode 100644 common/pxStreams.cpp delete mode 100644 common/pxStreams.h delete mode 100644 common/wxBaseTools.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d784155a0f..1a5f5cb42b 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -27,7 +27,6 @@ target_sources(common PRIVATE PrecompiledHeader.cpp Perf.cpp ProgressCallback.cpp - pxStreams.cpp pxTranslate.cpp RwMutex.cpp Semaphore.cpp @@ -84,7 +83,6 @@ target_sources(common PRIVATE PrecompiledHeader.h ProgressCallback.h pxForwardDefs.h - pxStreams.h RedtapeWindows.h RwMutex.h SafeArray.h @@ -98,7 +96,6 @@ target_sources(common PRIVATE Threading.h TraceLog.h WindowInfo.h - wxBaseTools.h emitter/cpudetect_internal.h emitter/implement/dwshift.h emitter/implement/group1.h diff --git a/common/Darwin/DarwinSemaphore.cpp b/common/Darwin/DarwinSemaphore.cpp index 092debd229..78101fe4b7 100644 --- a/common/Darwin/DarwinSemaphore.cpp +++ b/common/Darwin/DarwinSemaphore.cpp @@ -27,7 +27,6 @@ #include "common/Threading.h" #include "common/ThreadingInternal.h" -#include "common/wxBaseTools.h" // -------------------------------------------------------------------------------------- // Semaphore Implementation for Darwin/OSX diff --git a/common/Mutex.cpp b/common/Mutex.cpp index 76af8e3fd4..b9dce24f1b 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -14,7 +14,6 @@ */ #include "common/Threading.h" -#include "common/wxBaseTools.h" #include "common/ThreadingInternal.h" namespace Threading diff --git a/common/Semaphore.cpp b/common/Semaphore.cpp index 929204076e..130536cfb5 100644 --- a/common/Semaphore.cpp +++ b/common/Semaphore.cpp @@ -16,7 +16,6 @@ #if !defined(__APPLE__) #include "common/Threading.h" -#include "common/wxBaseTools.h" #include "common/ThreadingInternal.h" // -------------------------------------------------------------------------------------- diff --git a/common/StringHelpers.cpp b/common/StringHelpers.cpp index 4b256f272a..11952f408a 100644 --- a/common/StringHelpers.cpp +++ b/common/StringHelpers.cpp @@ -231,23 +231,6 @@ bool TryParse(wxRect& dest, const wxString& src, const wxRect& defval, const wxS return true; } -// returns TRUE if the parse is valid, or FALSE if it's a comment. -bool pxParseAssignmentString(const wxString& src, wxString& ldest, wxString& rdest) -{ - if (src.StartsWith(L"--") || src.StartsWith(L"//") || src.StartsWith(L";")) - return false; - - ldest = src.BeforeFirst(L'=').Trim(true).Trim(false); - rdest = src.AfterFirst(L'=').Trim(true).Trim(false); - - return true; -} - -ParsedAssignmentString::ParsedAssignmentString(const wxString& src) -{ - IsComment = pxParseAssignmentString(src, lvalue, rvalue); -} - // Performs a cross-platform puts operation, which adds CRs to naked LFs on Win32 platforms, // so that Notepad won't throw a fit and Rama can read the logs again! On Unix and Mac platforms, // the input string is written unmodified. diff --git a/common/StringHelpers.h b/common/StringHelpers.h index 5844d8ae02..15c0ca1375 100644 --- a/common/StringHelpers.h +++ b/common/StringHelpers.h @@ -28,46 +28,6 @@ #define WX_STR(str) (static_cast(str.c_str())) #endif -// -------------------------------------------------------------------------------------- -// pxToUTF8 -// -------------------------------------------------------------------------------------- -// Converts a string to UTF8 and provides an interface for getting its length. -class pxToUTF8 -{ - DeclareNoncopyableObject(pxToUTF8); - -protected: - wxCharBuffer m_result; - int m_length; - -public: - explicit pxToUTF8(const wxString& src) - : m_result(src.ToUTF8()) - { - m_length = -1; - } - - size_t Length() - { - if (-1 == m_length) - m_length = strlen(m_result); - return m_length; - } - - void Convert(const wxString& src) - { - m_result = src.ToUTF8(); - m_length = -1; - } - - const char* data() const { return m_result; } - - operator const char*() const - { - return m_result.data(); - } -}; - extern void px_fputs(FILE* fp, const char* src); // wxWidgets lacks one of its own... @@ -88,28 +48,6 @@ extern bool TryParse(wxPoint& dest, const wxString& src, const wxPoint& defval = extern bool TryParse(wxSize& dest, const wxString& src, const wxSize& defval = wxDefaultSize, const wxString& separators = L","); extern bool TryParse(wxRect& dest, const wxString& src, const wxRect& defval = wxDefaultRect, const wxString& separators = L","); -// -------------------------------------------------------------------------------------- -// ParsedAssignmentString -// -------------------------------------------------------------------------------------- -// This class is a simple helper for parsing INI-style assignments, in the typical form of: -// variable = value -// filename = SomeString.txt -// integer = 15 -// -// This parser supports both '//' and ';' at the head of a line as indicators of a commented -// line, and such a line will return empty strings for l- and r-value. -// -// No type handling is performed -- the user must manually parse strings into integers, etc. -// For advanced "fully functional" ini file parsing, consider using wxFileConfig instead. -// -struct ParsedAssignmentString -{ - wxString lvalue; - wxString rvalue; - bool IsComment; - - ParsedAssignmentString(const wxString& src); -}; // ====================================================================================== // FastFormatAscii / FastFormatUnicode (overview!) @@ -221,8 +159,6 @@ public: FastFormatUnicode& operator+=(const char* psz); }; -extern bool pxParseAssignmentString(const wxString& src, wxString& ldest, wxString& rdest); - #define pxsFmt FastFormatUnicode().Write #define pxsFmtV FastFormatUnicode().WriteV #define pxsPtr(ptr) pxsFmt("0x%016" PRIXPTR, (ptr)).c_str() diff --git a/common/ThreadTools.cpp b/common/ThreadTools.cpp index daf09b0f07..cda6215750 100644 --- a/common/ThreadTools.cpp +++ b/common/ThreadTools.cpp @@ -18,7 +18,6 @@ #endif #include "common/PersistentThread.h" -#include "common/wxBaseTools.h" #include "common/ThreadingInternal.h" #include "common/EventSource.inl" #include "common/General.h" diff --git a/common/common.vcxproj b/common/common.vcxproj index a91bc74ec6..3bb8544384 100644 --- a/common/common.vcxproj +++ b/common/common.vcxproj @@ -61,7 +61,6 @@ - @@ -161,7 +160,6 @@ - diff --git a/common/common.vcxproj.filters b/common/common.vcxproj.filters index 522a61c21a..205252f179 100644 --- a/common/common.vcxproj.filters +++ b/common/common.vcxproj.filters @@ -67,9 +67,6 @@ Source Files - - Source Files - Source Files @@ -309,9 +306,6 @@ Header Files - - Header Files - Header Files diff --git a/common/pxStreams.cpp b/common/pxStreams.cpp deleted file mode 100644 index 3b8a058d53..0000000000 --- a/common/pxStreams.cpp +++ /dev/null @@ -1,257 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2010 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#include -#include - -#include "common/wxBaseTools.h" -#include "common/pxStreams.h" -#include "common/StringHelpers.h" - -// -------------------------------------------------------------------------------------- -// pxStreamBase (implementations) -// -------------------------------------------------------------------------------------- -pxStreamBase::pxStreamBase(const wxString& filename) - : m_filename(filename) -{ -} - -bool pxStreamBase::IsOk() const -{ - wxStreamBase* woot = GetWxStreamBase(); - return woot && woot->IsOk(); -} - -wxFileOffset pxStreamBase::Length() const -{ - if (!GetWxStreamBase()) - return 0; - return GetWxStreamBase()->GetLength(); -} - -// -------------------------------------------------------------------------------------- -// pxInputStream (implementations) -// -------------------------------------------------------------------------------------- -// Interface for reading data from a gzip stream. -// - -pxInputStream::pxInputStream(const wxString& filename, std::unique_ptr& input) - : pxStreamBase(filename) - , m_stream_in(std::move(input)) -{ -} - -pxInputStream::pxInputStream(const wxString& filename, wxInputStream* input) - : pxStreamBase(filename) - , m_stream_in(input) -{ -} - -wxStreamBase* pxInputStream::GetWxStreamBase() const { return m_stream_in.get(); } - -wxFileOffset pxInputStream::Tell() const -{ - return m_stream_in->TellI(); -} - -wxFileOffset pxInputStream::Seek(wxFileOffset ofs, wxSeekMode mode) -{ - return m_stream_in->SeekI(ofs, mode); -} - -void pxInputStream::SetStream(const wxString& filename, std::unique_ptr& stream) -{ - m_filename = filename; - m_stream_in = std::move(stream); -} - -void pxInputStream::SetStream(const wxString& filename, wxInputStream* stream) -{ - m_filename = filename; - m_stream_in = std::unique_ptr(stream); -} - -void pxInputStream::Read(void* dest, size_t size) -{ - m_stream_in->Read(dest, size); - if (m_stream_in->GetLastError() == wxSTREAM_READ_ERROR) - { - int err = errno; - if (!err) - throw Exception::BadStream(m_filename).SetDiagMsg(L"Cannot read from file (bad file handle?)"); - - ScopedExcept ex(Exception::FromErrno(m_filename, err)); - ex->SetDiagMsg(L"cannot read from file: " + ex->DiagMsg()); - ex->Rethrow(); - } - - // IMPORTANT! The underlying file/source Eof() stuff is not really reliable, so we - // must always use the explicit check against the number of bytes read to determine - // end-of-stream conditions. - - if ((size_t)m_stream_in->LastRead() < size) - throw Exception::EndOfStream(m_filename); -} - -// -------------------------------------------------------------------------------------- -// pxOutputStream -// -------------------------------------------------------------------------------------- -pxOutputStream::pxOutputStream(const wxString& filename, std::unique_ptr& output) - : pxStreamBase(filename) - , m_stream_out(std::move(output)) -{ -} - -pxOutputStream::pxOutputStream(const wxString& filename, wxOutputStream* output) - : pxStreamBase(filename) - , m_stream_out(output) -{ -} - -wxStreamBase* pxOutputStream::GetWxStreamBase() const { return m_stream_out.get(); } - -wxFileOffset pxOutputStream::Tell() const -{ - return m_stream_out->TellO(); -} - -wxFileOffset pxOutputStream::Seek(wxFileOffset ofs, wxSeekMode mode) -{ - return m_stream_out->SeekO(ofs, mode); -} - -void pxOutputStream::SetStream(const wxString& filename, std::unique_ptr& stream) -{ - m_filename = filename; - m_stream_out = std::move(stream); -} - -void pxOutputStream::SetStream(const wxString& filename, wxOutputStream* stream) -{ - m_filename = filename; - m_stream_out = std::unique_ptr(stream); -} - - -void pxOutputStream::Write(const void* src, size_t size) -{ - m_stream_out->Write(src, size); - if (m_stream_out->GetLastError() == wxSTREAM_WRITE_ERROR) - { - int err = errno; - if (!err) - throw Exception::BadStream(m_filename).SetDiagMsg(L"Cannot write to file/stream."); - - ScopedExcept ex(Exception::FromErrno(m_filename, err)); - ex->SetDiagMsg(L"Cannot write to file: " + ex->DiagMsg()); - ex->Rethrow(); - } -} - -// -------------------------------------------------------------------------------------- -// pxTextStream -// -------------------------------------------------------------------------------------- - -// Returns TRUE if the source is UTF8, or FALSE if it's just ASCII crap. -bool pxReadLine(wxInputStream& input, std::string& dest) -{ - dest.clear(); - bool isUTF8 = false; - while (true) - { - char c; - input.Read(&c, sizeof(c)); - if (c == 0) - break; - if (input.Eof()) - break; - if (c == '\n') - break; // eat on UNIX - if (c == '\r') - { - input.Read(&c, sizeof(c)); - if (c == 0) - break; - if (input.Eof()) - break; - if (c == '\n') - break; - - input.Ungetch(c); - break; - } - dest += c; - if (c & 0x80) - isUTF8 = true; - } - - return isUTF8; -} - -void pxReadLine(wxInputStream& input, wxString& dest, std::string& intermed) -{ - dest.clear(); - if (pxReadLine(input, intermed)) - dest = fromUTF8(intermed.c_str()); - else - { - // Optimized ToAscii conversion. - // wx3.0 : NOT COMPATIBLE!! (on linux anyway) - const char* ascii = intermed.c_str(); - while (*ascii != 0) - dest += (wchar_t)(unsigned char)*ascii++; - } -} - -void pxReadLine(wxInputStream& input, wxString& dest) -{ - std::string line; - pxReadLine(input, dest, line); -} - -wxString pxReadLine(wxInputStream& input) -{ - wxString result; - pxReadLine(input, result); - return result; -} - -void pxWriteLine(wxOutputStream& output) -{ - output.Write("\n", 1); -} - -void pxWriteLine(wxOutputStream& output, const wxString& text) -{ - if (!text.IsEmpty()) - { - pxToUTF8 utf8(text); - output.Write(utf8, utf8.Length()); - } - pxWriteLine(output); -} - -void pxWriteMultiline(wxOutputStream& output, const wxString& src) -{ - if (src.IsEmpty()) - return; - - wxString result(src); - result.Replace(L"\r\n", L"\n"); - result.Replace(L"\r", L"\n"); - - pxToUTF8 utf8(result); - output.Write(utf8, utf8.Length()); -} diff --git a/common/pxStreams.h b/common/pxStreams.h deleted file mode 100644 index e94f5d82c5..0000000000 --- a/common/pxStreams.h +++ /dev/null @@ -1,119 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2010 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#pragma once - -#include -#include -#include -#include "Dependencies.h" - -// -------------------------------------------------------------------------------------- -// pxStreamBase -// -------------------------------------------------------------------------------------- -class pxStreamBase -{ - DeclareNoncopyableObject(pxStreamBase); - -protected: - // Filename of the stream, provided by the creator/caller. This is typically used *only* - // for generating comprehensive error messages when an error occurs (the stream name is - // passed to the exception handlers). - wxString m_filename; - -public: - pxStreamBase(const wxString& filename); - virtual ~pxStreamBase() = default; - - // Implementing classes should return the base wxStream object (usually either a wxInputStream - // or wxOputStream derivative). - virtual wxStreamBase* GetWxStreamBase() const = 0; - virtual void Close() = 0; - virtual wxFileOffset Tell() const = 0; - virtual wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart) = 0; - - virtual wxFileOffset Length() const; - bool IsOk() const; - wxString GetStreamName() const { return m_filename; } -}; - - -// -------------------------------------------------------------------------------------- -// pxOutputStream -// -------------------------------------------------------------------------------------- -class pxOutputStream : public pxStreamBase -{ - DeclareNoncopyableObject(pxOutputStream); - -protected: - std::unique_ptr m_stream_out; - -public: - pxOutputStream(const wxString& filename, std::unique_ptr& output); - pxOutputStream(const wxString& filename, wxOutputStream* output); - - virtual ~pxOutputStream() = default; - virtual void Write(const void* data, size_t size); - - void SetStream(const wxString& filename, std::unique_ptr& stream); - void SetStream(const wxString& filename, wxOutputStream* stream); - - void Close() { m_stream_out = nullptr; } - - virtual wxStreamBase* GetWxStreamBase() const; - - template - void Write(const T& data) - { - Write(&data, sizeof(data)); - } - - wxFileOffset Tell() const; - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); -}; - -// -------------------------------------------------------------------------------------- -// pxInputStream -// -------------------------------------------------------------------------------------- -class pxInputStream : public pxStreamBase -{ - DeclareNoncopyableObject(pxInputStream); - -protected: - std::unique_ptr m_stream_in; - -public: - pxInputStream(const wxString& filename, std::unique_ptr& input); - pxInputStream(const wxString& filename, wxInputStream* input); - - virtual ~pxInputStream() = default; - virtual void Read(void* dest, size_t size); - - void SetStream(const wxString& filename, std::unique_ptr& stream); - void SetStream(const wxString& filename, wxInputStream* stream); - - void Close() { m_stream_in = nullptr; } - - virtual wxStreamBase* GetWxStreamBase() const; - - template - void Read(T& dest) - { - Read(&dest, sizeof(dest)); - } - - wxFileOffset Tell() const; - wxFileOffset Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart); -}; diff --git a/common/wxBaseTools.h b/common/wxBaseTools.h deleted file mode 100644 index ff6a04e139..0000000000 --- a/common/wxBaseTools.h +++ /dev/null @@ -1,65 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2010 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#pragma once - -#include "common/Dependencies.h" - -// -------------------------------------------------------------------------------------- -// wxBaseTools.h -// -// This file is meant to contain utility classes for users of the wxWidgets library. -// All classes in this file are strictly dependent on wxBase libraries only, meaning -// you don't need to include or link against wxCore (GUI) to build them. For tools -// which require wxCore, see wxGuiTools.h -// -------------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------------- -// wxDoNotLogInThisScope -// -------------------------------------------------------------------------------------- -// This class is used to disable wx's sometimes inappropriate amount of forced error logging -// during specific activities. For example, when using wxDynamicLibrary to detect the -// validity of DLLs, wx will log errors for missing symbols. (sigh) -// -// Usage: Basic auto-cleanup destructor class. Create an instance inside a scope, and -// logging will be re-enabled when scope is terminated. :) -// -class wxDoNotLogInThisScope -{ - DeclareNoncopyableObject(wxDoNotLogInThisScope); - -protected: - bool m_prev; - -public: - wxDoNotLogInThisScope() - { - m_prev = wxLog::EnableLogging(false); - } - - virtual ~wxDoNotLogInThisScope() - { - wxLog::EnableLogging(m_prev); - } -}; - - -extern wxString pxReadLine(wxInputStream& input); -extern void pxReadLine(wxInputStream& input, wxString& dest); -extern void pxReadLine(wxInputStream& input, wxString& dest, std::string& intermed); -extern bool pxReadLine(wxInputStream& input, std::string& dest); -extern void pxWriteLine(wxOutputStream& output); -extern void pxWriteLine(wxOutputStream& output, const wxString& text); -extern void pxWriteMultiline(wxOutputStream& output, const wxString& src); diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index 2b197b6c04..52988abc00 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -29,8 +29,6 @@ #include "Renderers/HW/GSTextureReplacements.h" #include "GSLzma.h" -#include "common/pxStreams.h" -#include "common/pxStreams.h" #include "common/Console.h" #include "common/StringUtil.h" #include "pcsx2/Config.h" diff --git a/pcsx2/PAD/Linux/Global.h b/pcsx2/PAD/Linux/Global.h index 0cbb9676d0..c2ba2a9aac 100644 --- a/pcsx2/PAD/Linux/Global.h +++ b/pcsx2/PAD/Linux/Global.h @@ -28,7 +28,6 @@ #include "common/Pcsx2Defs.h" #include "bitwise.h" -#include "common/pxStreams.h" #include "common/Console.h" #include "common/mt_queue.h" #include "DebugTools/Debug.h" diff --git a/pcsx2/PAD/Windows/Global.h b/pcsx2/PAD/Windows/Global.h index 9d135108e9..0a8b747be0 100644 --- a/pcsx2/PAD/Windows/Global.h +++ b/pcsx2/PAD/Windows/Global.h @@ -20,7 +20,6 @@ #include #include #include -#include "common/pxStreams.h" #include "common/Console.h" #include #include diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index 7d2bccb19b..095164f879 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -70,7 +70,6 @@ #include "PCSX2Base.h" #include "gui/i18n.h" -#include "common/wxBaseTools.h" #include "common/Path.h" #include "common/Console.h" #include "common/MemcpyFast.h" diff --git a/pcsx2/SPU2/spu2.cpp b/pcsx2/SPU2/spu2.cpp index c927d8b1f2..f00b888ddd 100644 --- a/pcsx2/SPU2/spu2.cpp +++ b/pcsx2/SPU2/spu2.cpp @@ -28,7 +28,6 @@ #include "Host/Dialogs.h" #endif #include "R3000A.h" -#include "common/pxStreams.h" using namespace Threading; diff --git a/pcsx2/USB/USB.cpp b/pcsx2/USB/USB.cpp index 4199175ca6..4888ff5a15 100644 --- a/pcsx2/USB/USB.cpp +++ b/pcsx2/USB/USB.cpp @@ -20,7 +20,6 @@ #include #include "PrecompiledHeader.h" -#include "common/pxStreams.h" #include "common/WindowInfo.h" #include "USB.h" #include "qemu-usb/USBinternal.h" diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index 0d0a9a0db4..8d9b40f397 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -18,7 +18,6 @@ #include "gui/App.h" #include "ConfigurationDialog.h" #include "gui/Panels/ConfigurationPanels.h" -#include "common/pxStreams.h" #include "GS/GSLzma.h" #include diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index 28966513e0..ce3609adb0 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "i18n.h" #include "AppConfig.h" +#include "wxGuiTools.h" #include "common/SafeArray.h" #include diff --git a/pcsx2/gui/wxGuiTools.h b/pcsx2/gui/wxGuiTools.h index 2688ef9b74..79ab0ad2df 100644 --- a/pcsx2/gui/wxGuiTools.h +++ b/pcsx2/gui/wxGuiTools.h @@ -776,6 +776,35 @@ public: static void SetManualBusyCursor(BusyCursorType busytype); }; +// -------------------------------------------------------------------------------------- +// wxDoNotLogInThisScope +// -------------------------------------------------------------------------------------- +// This class is used to disable wx's sometimes inappropriate amount of forced error logging +// during specific activities. For example, when using wxDynamicLibrary to detect the +// validity of DLLs, wx will log errors for missing symbols. (sigh) +// +// Usage: Basic auto-cleanup destructor class. Create an instance inside a scope, and +// logging will be re-enabled when scope is terminated. :) +// +class wxDoNotLogInThisScope +{ + DeclareNoncopyableObject(wxDoNotLogInThisScope); + +protected: + bool m_prev; + +public: + wxDoNotLogInThisScope() + { + m_prev = wxLog::EnableLogging(false); + } + + virtual ~wxDoNotLogInThisScope() + { + wxLog::EnableLogging(m_prev); + } +}; + // -------------------------------------------------------------------------------------- // pxFitToDigits // --------------------------------------------------------------------------------------