* Disable Ok/Apply/Cancel buttons on dialogs while settings are being applied, prevents potential deadlock when accidentally double-clicking the buttons.

* Add preliminary code for selectively disabling spam-heavy hardware registers


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3853 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-09-28 20:00:17 +00:00
parent c48ae28247
commit 7ad0ef4fb4
9 changed files with 95 additions and 41 deletions

View File

@ -36,6 +36,9 @@ __ri void cpuUpdateOperationMode() {
} }
void __fastcall WriteCP0Status(u32 value) { void __fastcall WriteCP0Status(u32 value) {
DMA_LOG("COP0 Status write = 0x%08x", value);
cpuRegs.CP0.n.Status.val = value; cpuRegs.CP0.n.Status.val = value;
cpuUpdateOperationMode(); cpuUpdateOperationMode();
cpuSetNextEventDelta(4); cpuSetNextEventDelta(4);

View File

@ -108,8 +108,11 @@ __fi uint dmacInterrupt()
//DevCon.Warning("DMAC Suspended or Disabled on interrupt"); //DevCon.Warning("DMAC Suspended or Disabled on interrupt");
return 0; return 0;
} }
HW_LOG("dmacInterrupt %x", (psHu16(DMAC_STAT + 2) & psHu16(DMAC_STAT) |
psHu16(DMAC_STAT) & 0x8000)); DMA_LOG("dmacInterrupt %x",
((psHu16(DMAC_STAT + 2) & psHu16(DMAC_STAT)) |
(psHu16(DMAC_STAT) & 0x8000))
);
//cpuException(0x800, cpuRegs.branch); //cpuException(0x800, cpuRegs.branch);
return 0x800; return 0x800;

View File

@ -189,7 +189,7 @@ void cpuTlbMiss(u32 addr, u32 bd, u32 excode)
cpuRegs.CP0.n.EPC = cpuRegs.pc - 4; cpuRegs.CP0.n.EPC = cpuRegs.pc - 4;
} }
if ((cpuRegs.CP0.n.Status.val & 0x1) == 0) { if (!cpuRegs.CP0.n.Status.b.IE) {
cpuRegs.pc = 0x80000000; cpuRegs.pc = 0x80000000;
} else { } else {
cpuRegs.pc = 0x80000180; cpuRegs.pc = 0x80000180;

View File

@ -109,6 +109,9 @@ public:
virtual ApplyStateStruct& GetApplyState() { return m_ApplyState; } virtual ApplyStateStruct& GetApplyState() { return m_ApplyState; }
}; };
// --------------------------------------------------------------------------------------
// BaseApplicableDialog
// --------------------------------------------------------------------------------------
class BaseApplicableDialog class BaseApplicableDialog
: public wxDialogWithHelpers : public wxDialogWithHelpers
, public IApplyState , public IApplyState

View File

@ -180,33 +180,75 @@ void Dialogs::BaseConfigurationDialog::OnCloseWindow( wxCloseEvent& evt )
evt.Skip(); evt.Skip();
} }
class ScopedOkButtonDisabler
{
protected:
wxWindow* m_apply;
wxWindow* m_ok;
wxWindow* m_cancel;
public:
ScopedOkButtonDisabler( wxWindow* parent )
{
m_apply = parent->FindWindow( wxID_APPLY );
m_ok = parent->FindWindow( wxID_OK );
m_cancel = parent->FindWindow( wxID_CANCEL );
if (m_apply) m_apply ->Disable();
if (m_ok) m_ok ->Disable();
if (m_cancel) m_cancel->Disable();
}
// Use this to prevent the Apply buton from being re-enabled.
void DetachApply()
{
m_apply = NULL;
}
void DetachAll()
{
m_apply = m_ok = m_cancel = NULL;
}
virtual ~ScopedOkButtonDisabler() throw()
{
if (m_apply) m_apply ->Enable();
if (m_ok) m_ok ->Enable();
if (m_cancel) m_cancel->Enable();
}
};
void Dialogs::BaseConfigurationDialog::OnOk_Click( wxCommandEvent& evt ) void Dialogs::BaseConfigurationDialog::OnOk_Click( wxCommandEvent& evt )
{ {
ScopedOkButtonDisabler disabler(this);
if( m_ApplyState.ApplyAll() ) if( m_ApplyState.ApplyAll() )
{ {
if( wxWindow* apply = FindWindow( wxID_APPLY ) ) apply->Disable(); if( wxWindow* apply = FindWindow( wxID_APPLY ) ) apply->Disable();
if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()]; if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()];
AppSaveSettings(); AppSaveSettings();
disabler.DetachAll();
evt.Skip(); evt.Skip();
} }
} }
void Dialogs::BaseConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
{
ScopedOkButtonDisabler disabler(this);
if( m_ApplyState.ApplyAll() )
disabler.DetachApply();
if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()];
AppSaveSettings();
}
void Dialogs::BaseConfigurationDialog::OnCancel_Click( wxCommandEvent& evt ) void Dialogs::BaseConfigurationDialog::OnCancel_Click( wxCommandEvent& evt )
{ {
evt.Skip(); evt.Skip();
if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()]; if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()];
} }
void Dialogs::BaseConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
{
if( m_ApplyState.ApplyAll() )
FindWindow( wxID_APPLY )->Disable();
if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()];
AppSaveSettings();
}
void Dialogs::BaseConfigurationDialog::OnScreenshot_Click( wxCommandEvent& evt ) void Dialogs::BaseConfigurationDialog::OnScreenshot_Click( wxCommandEvent& evt )
{ {
wxBitmap memBmp; wxBitmap memBmp;

View File

@ -57,6 +57,7 @@ int Dialogs::BiosSelectorDialog::ShowModal()
void Dialogs::BiosSelectorDialog::OnOk_Click( wxCommandEvent& evt ) void Dialogs::BiosSelectorDialog::OnOk_Click( wxCommandEvent& evt )
{ {
wxWindowDisabler disableOk( FindWindow( wxID_OK ) );
if( m_ApplyState.ApplyAll() ) if( m_ApplyState.ApplyAll() )
{ {
Close(); Close();

View File

@ -24,33 +24,8 @@ using namespace pxSizerFlags;
Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent ) Dialogs::LogOptionsDialog::LogOptionsDialog( wxWindow* parent )
: BaseApplicableDialog( parent, _("Trace Logging"), pxDialogFlags().Resize() ) : BaseConfigurationDialog( parent, _("Trace Logging"), 720 )
{ {
*this += new LogOptionsPanel( this ) | StdExpand(); *this += new LogOptionsPanel( this ) | StdExpand();
AddOkCancel();
AddOkCancel( *GetSizer(), true );
FindWindow( wxID_APPLY )->Disable();
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogOptionsDialog::OnOk_Click ) );
Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LogOptionsDialog::OnApply_Click ) );
}
void Dialogs::LogOptionsDialog::OnOk_Click( wxCommandEvent& evt )
{
if( m_ApplyState.ApplyAll() )
{
FindWindow( wxID_APPLY )->Disable();
AppSaveSettings();
Close();
evt.Skip();
}
}
void Dialogs::LogOptionsDialog::OnApply_Click( wxCommandEvent& evt )
{
if( m_ApplyState.ApplyAll() )
FindWindow( wxID_APPLY )->Disable();
AppSaveSettings();
} }

View File

@ -23,7 +23,7 @@
namespace Dialogs { namespace Dialogs {
class LogOptionsDialog : public BaseApplicableDialog class LogOptionsDialog : public BaseConfigurationDialog
{ {
public: public:
LogOptionsDialog( wxWindow* parent=NULL ); LogOptionsDialog( wxWindow* parent=NULL );
@ -35,6 +35,13 @@ public:
protected: protected:
void OnOk_Click( wxCommandEvent& evt ); void OnOk_Click( wxCommandEvent& evt );
void OnApply_Click( wxCommandEvent& evt ); void OnApply_Click( wxCommandEvent& evt );
wxString& GetConfSettingsTabName() const
{
static wxString bleh = L"TraceLogs";
pxFailDev("No tabs yet!");
return bleh;
}
}; };
} // end namespace Dialogs } // end namespace Dialogs

View File

@ -15,6 +15,25 @@
#pragma once #pragma once
#define eeAddrInRange(name, addr) \
(addr >= EEMemoryMap::name##_Start && addr < EEMemoryMap::name##_End)
static __ri bool _eelog_enabled( u32 addr )
{
// Selective enable/disable ability for specific register maps
if (eeAddrInRange(RCNT0, addr)) return false;
if (eeAddrInRange(RCNT1, addr)) return true;
if (eeAddrInRange(RCNT2, addr)) return true;
if (eeAddrInRange(RCNT3, addr)) return true;
if (eeAddrInRange(SBUS, addr)) return false;
// INTC!
if (addr == INTC_STAT || addr == INTC_MASK) return true;
return true;
}
template< typename T> template< typename T>
static __ri const char* _eelog_GetHwName( u32 addr, T val ) static __ri const char* _eelog_GetHwName( u32 addr, T val )
{ {
@ -244,6 +263,7 @@ static __ri void eeHwTraceLog( u32 addr, T val, bool mode )
{ {
if (!IsDevBuild) return; if (!IsDevBuild) return;
if (!EmuConfig.Trace.Enabled || !EmuConfig.Trace.EE.m_EnableAll || !EmuConfig.Trace.EE.m_EnableRegisters) return; if (!EmuConfig.Trace.Enabled || !EmuConfig.Trace.EE.m_EnableAll || !EmuConfig.Trace.EE.m_EnableRegisters) return;
if (!_eelog_enabled(addr)) return;
FastFormatAscii valStr; FastFormatAscii valStr;
FastFormatAscii labelStr; FastFormatAscii labelStr;