diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 587face19e..351fd016ef 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -271,7 +271,6 @@ set(pcsx2GuiSources gui/Panels/MemoryCardListView.cpp gui/Panels/ThemeSelectorPanel.cpp gui/Dialogs/BaseConfigurationDialog.cpp - gui/Dialogs/BiosSelectorDialog.cpp gui/Dialogs/ConfirmationDialogs.cpp gui/Dialogs/CreateMemoryCardDialog.cpp gui/Dialogs/FirstTimeWizard.cpp diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 7af55b349f..e4e48b6dca 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -95,7 +95,7 @@ static bool HandlePluginError( BaseException& ex ) return false; } - g_Conf->SysSettingsTabName = L"Plugins"; + g_Conf->ComponentsTabName = L"Plugins"; // TODO: Send a message to the panel to select the failed plugin. @@ -161,6 +161,59 @@ void PluginInitErrorEvent::InvokeEvent() } } +// Returns a string message telling the user to consult guides for obtaining a legal BIOS. +// This message is in a function because it's used as part of several dialogs in PCSX2 (there +// are multiple variations on the BIOS and BIOS folder checks). +wxString BIOS_GetMsg_Required() +{ + return pxE(L"PCSX2 requires a PS2 BIOS in order to run. For legal reasons, you *must* obtain a BIOS from an actual PS2 unit that you own (borrowing doesn't count). Please consult the FAQs and Guides for further instructions." + ); +} + +class BIOSLoadErrorEvent : public pxExceptionEvent +{ + typedef pxExceptionEvent _parent; + +public: + BIOSLoadErrorEvent(BaseException* ex = NULL) : _parent(ex) {} + BIOSLoadErrorEvent(const BaseException& ex) : _parent(ex) {} + + virtual ~BIOSLoadErrorEvent() throw() { } + virtual BIOSLoadErrorEvent *Clone() const { return new BIOSLoadErrorEvent(*this); } + +protected: + void InvokeEvent(); + +}; + +static bool HandleBIOSError(BaseException& ex) +{ + if (!pxDialogExists(L"CoreSettings")) + { + if (!Msgbox::OkCancel(ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required() + + L"\n\n" + _("Press Ok to go to the BIOS Configuration Panel."), _("PS2 BIOS Error"))) + return false; + } + + g_Conf->ComponentsTabName = L"BIOS"; + + return AppOpenModalDialog() != wxID_CANCEL; +} + +void BIOSLoadErrorEvent::InvokeEvent() +{ + if (!m_except) return; + + ScopedExcept deleteMe(m_except); + m_except = NULL; + + if (!HandleBIOSError(*deleteMe)) + { + Console.Warning("User canceled BIOS configuration."); + Msgbox::Alert(_("Warning! Valid BIOS has not been selected. PCSX2 may be inoperable.")); + } +} + // Allows for activating menu actions from anywhere in PCSX2. // And it's Thread Safe! void Pcsx2App::PostMenuAction( MenuIdentifiers menu_id ) const @@ -555,16 +608,6 @@ void Pcsx2App::OnEmuKeyDown( wxKeyEvent& evt ) cmd->Invoke(); } -// Returns a string message telling the user to consult guides for obtaining a legal BIOS. -// This message is in a function because it's used as part of several dialogs in PCSX2 (there -// are multiple variations on the BIOS and BIOS folder checks). -wxString BIOS_GetMsg_Required() -{ - return pxE( L"PCSX2 requires a PS2 BIOS in order to run. For legal reasons, you *must* obtain a BIOS from an actual PS2 unit that you own (borrowing doesn't count). Please consult the FAQs and Guides for further instructions." - ); -} - - void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event) const { const_cast(this)->HandleEvent( handler, func, event ); @@ -584,17 +627,15 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& // ---------------------------------------------------------------------------- catch( Exception::BiosLoadFailed& ex ) { - wxDialogWithHelpers dialog( NULL, _("PS2 BIOS Error") ); - dialog += dialog.Heading( ex.FormatDisplayMessage() + L"\n\n" + BIOS_GetMsg_Required() + L"\n\n" + _("Press Ok to go to the BIOS Configuration Panel.") ); - dialog += new ModalButtonPanel( &dialog, MsgButtons().OKCancel() ); - - if( dialog.ShowModal() == wxID_CANCEL ) - Console.Warning( "User denied option to re-configure BIOS." ); + // Commandline 'nogui' users will not receive an error message, but at least PCSX2 will + // terminate properly. + GSFrame* gsframe = wxGetApp().GetGsFramePtr(); + gsframe->Close(); - if( AppOpenModalDialog() != wxID_CANCEL ) - SysExecute(); - else - Console.Warning( "User canceled BIOS configuration." ); + Console.Error(ex.FormatDiagnosticMessage()); + + if (wxGetApp().HasGUI()) + AddIdleEvent(BIOSLoadErrorEvent(ex)); } // ---------------------------------------------------------------------------- catch( Exception::SaveStateLoadError& ex) diff --git a/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp b/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp deleted file mode 100644 index 41ce071b35..0000000000 --- a/pcsx2/gui/Dialogs/BiosSelectorDialog.cpp +++ /dev/null @@ -1,76 +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 "PrecompiledHeader.h" -#include "System.h" -#include "App.h" - -#include "ConfigurationDialog.h" -#include "ModalPopups.h" -#include "Panels/ConfigurationPanels.h" - -#include - -using namespace Panels; -using namespace pxSizerFlags; - -// ---------------------------------------------------------------------------- -Dialogs::BiosSelectorDialog::BiosSelectorDialog( wxWindow* parent ) - : BaseApplicableDialog( parent, _("BIOS Selector") ) -{ - m_selpan = new Panels::BiosSelectorPanel( this ); - - *this += m_selpan | StdExpand(); - AddOkCancel(); - - Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BiosSelectorDialog::OnOk_Click) ); - Connect( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(BiosSelectorDialog::OnDoubleClicked) ); -} - -bool Dialogs::BiosSelectorDialog::Show( bool show ) -{ - if( show && m_selpan ) - m_selpan->OnShown(); - - return _parent::Show( show ); -} - -int Dialogs::BiosSelectorDialog::ShowModal() -{ - if( m_selpan ) - m_selpan->OnShown(); - - return _parent::ShowModal(); -} - -void Dialogs::BiosSelectorDialog::OnOk_Click( wxCommandEvent& evt ) -{ - wxWindowDisabler disableOk( FindWindow( wxID_OK ) ); - if( m_ApplyState.ApplyAll() ) - { - Close(); - evt.Skip(); - } -} - -void Dialogs::BiosSelectorDialog::OnDoubleClicked( wxCommandEvent& evt ) -{ - wxWindow* forwardButton = FindWindow( wxID_OK ); - if( forwardButton == NULL ) return; - - wxCommandEvent nextpg( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ); - nextpg.SetEventObject( forwardButton ); - forwardButton->GetEventHandler()->ProcessEvent( nextpg ); -} diff --git a/pcsx2/gui/Dialogs/ConfigurationDialog.h b/pcsx2/gui/Dialogs/ConfigurationDialog.h index f8a34ae669..aa7e17697a 100644 --- a/pcsx2/gui/Dialogs/ConfigurationDialog.h +++ b/pcsx2/gui/Dialogs/ConfigurationDialog.h @@ -207,31 +207,6 @@ namespace Dialogs virtual wxString& GetConfSettingsTabName() const { return g_Conf->ComponentsTabName; } }; - // -------------------------------------------------------------------------------------- - // BiosSelectorDialog - // -------------------------------------------------------------------------------------- - class BiosSelectorDialog : public BaseApplicableDialog - { - typedef BaseApplicableDialog _parent; - - protected: - Panels::BaseSelectorPanel* m_selpan; - - public: - virtual ~BiosSelectorDialog() throw() {} - BiosSelectorDialog( wxWindow* parent=NULL ); - - static wxString GetNameStatic() { return L"BiosSelector"; } - wxString GetDialogName() const { return GetNameStatic(); } - - virtual bool Show( bool show=true ); - virtual int ShowModal(); - - protected: - void OnOk_Click( wxCommandEvent& evt ); - void OnDoubleClicked( wxCommandEvent& evt ); - }; - // -------------------------------------------------------------------------------------- // CreateMemoryCardDialog // -------------------------------------------------------------------------------------- diff --git a/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj b/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj index a87cbb0508..af0c8edad9 100644 --- a/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj +++ b/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj @@ -644,7 +644,6 @@ - diff --git a/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj.filters b/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj.filters index 6290e69c30..f8a6210b0b 100644 --- a/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj.filters +++ b/pcsx2/windows/VCprojects/pcsx2_vs2012.vcxproj.filters @@ -659,9 +659,6 @@ AppHost\Dialogs - - AppHost\Dialogs - AppHost\Dialogs diff --git a/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj b/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj index 02d1b53a8a..b9b4b04323 100644 --- a/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj +++ b/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj @@ -644,7 +644,6 @@ - diff --git a/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj.filters b/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj.filters index 0456491f2f..6c97171bb8 100644 --- a/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj.filters +++ b/pcsx2/windows/VCprojects/pcsx2_vs2013.vcxproj.filters @@ -659,9 +659,6 @@ AppHost\Dialogs - - AppHost\Dialogs - AppHost\Dialogs