mirror of https://github.com/PCSX2/pcsx2.git
Reworked missing BIOS handling
When booting a game, a missing BIOS (and possibly other BIOS errors) will crash or lockup PCSX2 (except for a Windows wxWidgets 2.8 build, I have no idea why). The messagebox that appears is also badly formatted. Use the event queue to handle the error instead of dealing it with immediately and fix the appearance of the messagebox. This also deletes the BiosSelectorDialog code since it isn't used anymore and fixes a condition where, on plugin load failure, the component selector dialog may open up at the wrong page.
This commit is contained in:
parent
3e69113f48
commit
e0da81a44e
|
@ -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
|
||||
|
|
|
@ -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<Dialogs::ComponentsConfigDialog>() != 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<Pcsx2App*>(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<Dialogs::BiosSelectorDialog>() != wxID_CANCEL )
|
||||
SysExecute();
|
||||
else
|
||||
Console.Warning( "User canceled BIOS configuration." );
|
||||
Console.Error(ex.FormatDiagnosticMessage());
|
||||
|
||||
if (wxGetApp().HasGUI())
|
||||
AddIdleEvent(BIOSLoadErrorEvent(ex));
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
catch( Exception::SaveStateLoadError& ex)
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "System.h"
|
||||
#include "App.h"
|
||||
|
||||
#include "ConfigurationDialog.h"
|
||||
#include "ModalPopups.h"
|
||||
#include "Panels/ConfigurationPanels.h"
|
||||
|
||||
#include <wx/filepicker.h>
|
||||
|
||||
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 );
|
||||
}
|
|
@ -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
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -644,7 +644,6 @@
|
|||
<ClCompile Include="..\..\gui\Dialogs\AboutBoxDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\AssertionDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\CreateMemoryCardDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\FirstTimeWizard.cpp" />
|
||||
|
|
|
@ -659,9 +659,6 @@
|
|||
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -644,7 +644,6 @@
|
|||
<ClCompile Include="..\..\gui\Dialogs\AboutBoxDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\AssertionDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\CreateMemoryCardDialog.cpp" />
|
||||
<ClCompile Include="..\..\gui\Dialogs\FirstTimeWizard.cpp" />
|
||||
|
|
|
@ -659,9 +659,6 @@
|
|||
<ClCompile Include="..\..\gui\Dialogs\BaseConfigurationDialog.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\gui\Dialogs\BiosSelectorDialog.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\gui\Dialogs\ConfirmationDialogs.cpp">
|
||||
<Filter>AppHost\Dialogs</Filter>
|
||||
</ClCompile>
|
||||
|
|
Loading…
Reference in New Issue