From d89043d8ac376fb9f31ae8a129880056a69d89c7 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Thu, 28 Apr 2016 00:09:44 +0100 Subject: [PATCH] pcsx2: Remove wx2.8 code and uses of wxMAJOR_VERSION Technically wxMAJOR_VERSION wasn't the right thing to use, but it was good enough. --- pcsx2/CDVD/CDVD.cpp | 7 ------- pcsx2/DebugTools/Debug.h | 2 -- pcsx2/gui/AppCorePlugins.cpp | 6 +----- pcsx2/gui/AppMain.cpp | 21 ++------------------- pcsx2/gui/ConsoleLogger.cpp | 6 ------ pcsx2/gui/ConsoleLogger.h | 4 ---- pcsx2/gui/RecentIsoList.cpp | 4 ---- pcsx2/gui/i18n.cpp | 4 ---- 8 files changed, 3 insertions(+), 51 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 13d6089e3d..40ed2540ee 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -438,17 +438,10 @@ void cdvdReadKey(u8, u16, u32 arg2, u8* key) // combine the lower 7 bits of each char // to make the 4 letters fit into a single u32 -#if wxMAJOR_VERSION >= 3 letters = (s32)((DiscSerial[3].GetValue()&0x7F)<< 0) | (s32)((DiscSerial[2].GetValue()&0x7F)<< 7) | (s32)((DiscSerial[1].GetValue()&0x7F)<<14) | (s32)((DiscSerial[0].GetValue()&0x7F)<<21); -#else - letters = (s32)((DiscSerial[3]&0x7F)<< 0) | - (s32)((DiscSerial[2]&0x7F)<< 7) | - (s32)((DiscSerial[1]&0x7F)<<14) | - (s32)((DiscSerial[0]&0x7F)<<21); -#endif } // calculate magic numbers diff --git a/pcsx2/DebugTools/Debug.h b/pcsx2/DebugTools/Debug.h index 2706669fba..4580e521a1 100644 --- a/pcsx2/DebugTools/Debug.h +++ b/pcsx2/DebugTools/Debug.h @@ -237,12 +237,10 @@ public: return false; } -#if wxMAJOR_VERSION >= 3 bool Write( const wxString msg ) const { return Write(msg.wc_str()); } -#endif }; diff --git a/pcsx2/gui/AppCorePlugins.cpp b/pcsx2/gui/AppCorePlugins.cpp index 0f10491874..f10b748c02 100644 --- a/pcsx2/gui/AppCorePlugins.cpp +++ b/pcsx2/gui/AppCorePlugins.cpp @@ -437,12 +437,8 @@ int EnumeratePluginsInFolder(const wxDirName& searchpath, wxArrayString* dest) wxString pattern( L"*%s*" ); #endif -#if wxMAJOR_VERSION >= 3 wxDir::GetAllFiles( searchpath.ToString(), realdest, pxsFmt( pattern, WX_STR(wxDynamicLibrary::GetDllExt())), wxDIR_FILES ); -#else - wxDir::GetAllFiles( searchpath.ToString(), realdest, pxsFmt( pattern, wxDynamicLibrary::GetDllExt()), wxDIR_FILES ); -#endif - + // SECURITY ISSUE: (applies primarily to Windows, but is a good idea on any platform) // The search folder order for plugins can vary across operating systems, and in some poorly designed // cases (old versions of windows), the search order is a security hazard because it does not diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index b42717852a..bb8cf748df 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -41,11 +41,6 @@ #endif #ifdef __WXGTK__ - -#if wxMAJOR_VERSION < 3 -#include // GTK_PIZZA interface (internal include removed in 3.0) -#endif - #include #include #endif @@ -463,11 +458,7 @@ public: }; -#if wxMAJOR_VERSION < 3 -wxStandardPathsBase& Pcsx2AppTraits::GetStandardPaths() -#else wxStandardPaths& Pcsx2AppTraits::GetStandardPaths() -#endif { static Pcsx2StandardPaths stdPaths; return stdPaths; @@ -648,10 +639,10 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& // PCSX2. This probably happened in the BIOS error case above as well. // So the idea is to explicitly close the gsFrame before the modal MessageBox appears and // intercepts the close message. Only for wx3.0 though - it sometimes breaks linux wx2.8. -#if wxMAJOR_VERSION >= 3 + if (GSFrame* gsframe = wxGetApp().GetGsFramePtr()) gsframe->Close(); -#endif + Console.Error(ex.FormatDiagnosticMessage()); // Make sure it terminates properly for nogui users. @@ -969,20 +960,12 @@ void Pcsx2App::OpenGsPanel() // unfortunately it creates a gray box in the middle of the window on some // users. -#if wxMAJOR_VERSION < 3 - GtkWidget *child_window = gtk_bin_get_child(GTK_BIN(gsFrame->GetViewport()->GetHandle())); -#else GtkWidget *child_window = GTK_WIDGET(gsFrame->GetViewport()->GetHandle()); -#endif gtk_widget_realize(child_window); // create the widget to allow to use GDK_WINDOW_* macro gtk_widget_set_double_buffered(child_window, false); // Disable the widget double buffer, you will use the opengl one -#if wxMAJOR_VERSION < 3 - GdkWindow* draw_window = GTK_PIZZA(child_window)->bin_window; -#else GdkWindow* draw_window = gtk_widget_get_window(child_window); -#endif #if GTK_MAJOR_VERSION < 3 Window Xwindow = GDK_WINDOW_XWINDOW(draw_window); diff --git a/pcsx2/gui/ConsoleLogger.cpp b/pcsx2/gui/ConsoleLogger.cpp index dab7c25bea..4959af6092 100644 --- a/pcsx2/gui/ConsoleLogger.cpp +++ b/pcsx2/gui/ConsoleLogger.cpp @@ -37,14 +37,8 @@ PipeRedirectionBase::~PipeRedirectionBase() throw() {} // ---------------------------------------------------------------------------- // -#if wxMAJOR_VERSION < 3 -void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t ) -{ - wxString message(szString); -#else void pxLogConsole::DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info) { -#endif switch ( level ) { case wxLOG_Trace: diff --git a/pcsx2/gui/ConsoleLogger.h b/pcsx2/gui/ConsoleLogger.h index 9aadd0db38..834f75b097 100644 --- a/pcsx2/gui/ConsoleLogger.h +++ b/pcsx2/gui/ConsoleLogger.h @@ -55,11 +55,7 @@ public: pxLogConsole() {} protected: -#if wxMAJOR_VERSION >= 3 virtual void DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info); -#else - virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t); -#endif }; diff --git a/pcsx2/gui/RecentIsoList.cpp b/pcsx2/gui/RecentIsoList.cpp index 7198496542..5322231871 100644 --- a/pcsx2/gui/RecentIsoList.cpp +++ b/pcsx2/gui/RecentIsoList.cpp @@ -128,11 +128,7 @@ void RecentIsoManager::Repopulate() // it starts a new group, but it also spews a couple warnings about it in Linux. #ifdef __linux__ // FIXME is it still useful on v3 -#if wxMAJOR_VERSION >= 3 m_Menu->Remove( m_Menu->Append( -1, "dummy" ) ); -#else - m_Menu->Remove( m_Menu->Append( -1 ) ); -#endif #endif //Note: the internal recent iso list (m_Items) has the most recent item last (also at the INI file) // but the menu is composed in reverse order such that the most recent item appears at the top. diff --git a/pcsx2/gui/i18n.cpp b/pcsx2/gui/i18n.cpp index 25a5887da8..8bd1726ad3 100644 --- a/pcsx2/gui/i18n.cpp +++ b/pcsx2/gui/i18n.cpp @@ -79,11 +79,7 @@ static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs, bool& // note: wx preserves the current locale for us, so creating a new locale and deleting // will not affect program status. -#if wxMAJOR_VERSION < 3 - std::unique_ptr locale(new wxLocale(wxLangId, wxLOCALE_CONV_ENCODING)); -#else std::unique_ptr locale(new wxLocale(wxLangId, 0)); -#endif // Force the msgIdLanguage param to wxLANGUAGE_UNKNOWN to disable wx's automatic english // matching logic, which will bypass the catalog loader for all english-based dialects, and