mirror of https://github.com/PCSX2/pcsx2.git
Minor fixes to the GS Window regarding suspend/resume and a certain nvidia bug; and fix a bunch of compiler warnings.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2478 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6d9fb042cd
commit
4e225ba113
|
@ -74,57 +74,6 @@ protected:
|
|||
virtual void _DispatchRaw( ListenerIterator iter, const ListenerIterator& iend, const EvtParams& params );
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// EventListenerBinding< typename EvtType >
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Encapsulated event listener binding, provides the "benefits" of object unwinding.
|
||||
//
|
||||
template< typename ListenerType >
|
||||
class EventListenerBinding
|
||||
{
|
||||
public:
|
||||
typedef typename EventSource<ListenerType>::EventSourceType EventSourceType;
|
||||
typedef typename EventSource<ListenerType>::ListenerIterator ListenerIterator;
|
||||
|
||||
protected:
|
||||
EventSourceType& m_source;
|
||||
const ListenerType m_listener;
|
||||
ListenerIterator m_iter;
|
||||
bool m_attached;
|
||||
|
||||
public:
|
||||
EventListenerBinding( EventSourceType& source, ListenerType& listener, bool autoAttach=true )
|
||||
: m_source( source )
|
||||
, m_listener( listener )
|
||||
{
|
||||
m_attached = false;
|
||||
|
||||
// If you want to assert on null pointers, you'll need to do the check yourself. There's
|
||||
// too many cases where silently ignoring null pointers is the desired behavior.
|
||||
//if( !pxAssertDev( listener.OnEvent != NULL, "NULL listener callback function." ) ) return;
|
||||
if( autoAttach ) Attach();
|
||||
}
|
||||
|
||||
virtual ~EventListenerBinding() throw()
|
||||
{
|
||||
Detach();
|
||||
}
|
||||
|
||||
void Detach()
|
||||
{
|
||||
if( !m_attached ) return;
|
||||
m_source.Remove( m_iter );
|
||||
m_attached = false;
|
||||
}
|
||||
|
||||
void Attach()
|
||||
{
|
||||
if( m_attached || (m_listener.OnEvent == NULL) ) return;
|
||||
m_iter = m_source.Add( m_listener );
|
||||
m_attached = true;
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// IEventDispatcher
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -162,6 +162,78 @@ protected:
|
|||
virtual void AppStatusEvent_OnExit() {}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// EventListenerHelper_AppStatus
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Welcome to the awkward world of C++ multi-inheritence. wxWidgets' Connect() system is
|
||||
// incompatible because of limitations in C++ class member function pointers, so we need
|
||||
// this second layer class to act as a bridge between the event system and the class's
|
||||
// handler implementations.
|
||||
//
|
||||
template< typename TypeToDispatchTo >
|
||||
class EventListenerHelper_CoreThread : public IEventListener_CoreThread
|
||||
{
|
||||
public:
|
||||
TypeToDispatchTo& Owner;
|
||||
|
||||
public:
|
||||
EventListenerHelper_CoreThread( TypeToDispatchTo& dispatchTo )
|
||||
: Owner( dispatchTo ) { }
|
||||
|
||||
EventListenerHelper_CoreThread( TypeToDispatchTo* dispatchTo )
|
||||
: Owner( *dispatchTo )
|
||||
{
|
||||
pxAssume(dispatchTo != NULL);
|
||||
}
|
||||
|
||||
virtual ~EventListenerHelper_CoreThread() throw() {}
|
||||
|
||||
protected:
|
||||
void OnCoreStatus_Indeterminate() { Owner.OnCoreStatus_Indeterminate(); }
|
||||
void OnCoreStatus_Started() { Owner.OnCoreStatus_Started(); }
|
||||
void OnCoreStatus_Resumed() { Owner.OnCoreStatus_Resumed(); }
|
||||
void OnCoreStatus_Suspended() { Owner.OnCoreStatus_Suspended(); }
|
||||
void OnCoreStatus_Reset() { Owner.OnCoreStatus_Reset(); }
|
||||
void OnCoreStatus_Stopped() { Owner.OnCoreStatus_Stopped(); }
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// EventListenerHelper_AppStatus
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Welcome to the awkward world of C++ multi-inheritence. wxWidgets' Connect() system is
|
||||
// incompatible because of limitations in C++ class member function pointers, so we need
|
||||
// this second layer class to act as a bridge between the event system and the class's
|
||||
// handler implementations.
|
||||
//
|
||||
template< typename TypeToDispatchTo >
|
||||
class EventListenerHelper_Plugins : public IEventListener_Plugins
|
||||
{
|
||||
public:
|
||||
TypeToDispatchTo& Owner;
|
||||
|
||||
public:
|
||||
EventListenerHelper_Plugins( TypeToDispatchTo& dispatchTo )
|
||||
: Owner( dispatchTo ) { }
|
||||
|
||||
EventListenerHelper_Plugins( TypeToDispatchTo* dispatchTo )
|
||||
: Owner( *dispatchTo )
|
||||
{
|
||||
pxAssume(dispatchTo != NULL);
|
||||
}
|
||||
|
||||
virtual ~EventListenerHelper_Plugins() throw() {}
|
||||
|
||||
protected:
|
||||
void OnPluginsEvt_Loaded() { Owner.OnPluginsEvt_Loaded(); }
|
||||
void OnPluginsEvt_Init() { Owner.OnPluginsEvt_Init(); }
|
||||
void OnPluginsEvt_Opening() { Owner.OnPluginsEvt_Opening(); }
|
||||
void OnPluginsEvt_Opened() { Owner.OnPluginsEvt_Opened(); }
|
||||
void OnPluginsEvt_Closing() { Owner.OnPluginsEvt_Closing(); }
|
||||
void OnPluginsEvt_Closed() { Owner.OnPluginsEvt_Closed(); }
|
||||
void OnPluginsEvt_Shutdown() { Owner.OnPluginsEvt_Shutdown(); }
|
||||
void OnPluginsEvt_Unloaded() { Owner.OnPluginsEvt_Unloaded(); }
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// EventListenerHelper_AppStatus
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -178,9 +250,7 @@ public:
|
|||
|
||||
public:
|
||||
EventListenerHelper_AppStatus( TypeToDispatchTo& dispatchTo )
|
||||
: Owner( dispatchTo )
|
||||
{
|
||||
}
|
||||
: Owner( dispatchTo ) { }
|
||||
|
||||
EventListenerHelper_AppStatus( TypeToDispatchTo* dispatchTo )
|
||||
: Owner( *dispatchTo )
|
||||
|
|
|
@ -811,6 +811,18 @@ void Pcsx2App::OpenGsPanel()
|
|||
gsFrame->SetFocus();
|
||||
m_id_GsFrame = gsFrame->GetId();
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is an attempt to hackfix a bug in nvidia's 195.xx drivers: When using
|
||||
// Aero and DX10, the driver fails to update the window after the device has changed,
|
||||
// until some event like a hide/show or resize event is posted to the window.
|
||||
// Presumably this forces the driver to re-cache the visibility info. I'm not sure
|
||||
// if an immediate hide/show will work, or if I need to post these through the event
|
||||
// loop for it to take effect. Trying this first... -- air.
|
||||
|
||||
gsFrame->GetViewport()->Hide();
|
||||
gsFrame->GetViewport()->Show();
|
||||
}
|
||||
|
||||
pxAssumeDev( !GetPluginManager().IsOpen( PluginId_GS ), "GS Plugin must be closed prior to opening a new Gs Panel!" );
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ bool GSFrame::Show( bool shown )
|
|||
gsPanel->SetFocus();
|
||||
|
||||
if( wxStaticText* label = GetLabel_OutputDisabled() )
|
||||
label->Show( !EmuConfig.GS.DisableOutput );
|
||||
label->Show( EmuConfig.GS.DisableOutput );
|
||||
|
||||
m_timer_UpdateTitle.Start( 333 );
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ void GSFrame::OnResize( wxSizeEvent& evt )
|
|||
g_Conf->GSWindow.WindowSize = GetClientSize();
|
||||
}
|
||||
|
||||
if( wxStaticText* label = (wxStaticText*)FindWindowByName(L"OutputDisabledLabel") )
|
||||
if( wxStaticText* label = GetLabel_OutputDisabled() )
|
||||
label->CentreOnParent();
|
||||
|
||||
if( GSPanel* gsPanel = GetViewport() )
|
||||
|
|
|
@ -233,6 +233,10 @@ static int GetPluginMenuId_Name( PluginsEnum_t pid )
|
|||
MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
|
||||
: wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) )
|
||||
|
||||
// , m_listener_plugins ( this )
|
||||
// , m_listener_corethread ( this )
|
||||
// , m_listener_appstatus ( this )
|
||||
|
||||
, m_statusbar( *CreateStatusBar(2, 0) )
|
||||
, m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() )
|
||||
|
||||
|
|
|
@ -157,11 +157,15 @@ public:
|
|||
// MainEmuFrame
|
||||
// --------------------------------------------------------------------------------------
|
||||
class MainEmuFrame : public wxFrame,
|
||||
public virtual IEventListener_Plugins,
|
||||
public virtual IEventListener_CoreThread,
|
||||
public virtual IEventListener_AppStatus
|
||||
public IEventListener_Plugins,
|
||||
public IEventListener_CoreThread,
|
||||
public IEventListener_AppStatus
|
||||
{
|
||||
protected:
|
||||
// EventListenerHelper_Plugins<MainEmuFrame> m_listener_plugins;
|
||||
// EventListenerHelper_CoreThread<MainEmuFrame> m_listener_corethread;
|
||||
// EventListenerHelper_AppStatus<MainEmuFrame> m_listener_appstatus;
|
||||
|
||||
bool m_RestartEmuOnDelete;
|
||||
|
||||
wxStatusBar& m_statusbar;
|
||||
|
|
|
@ -216,6 +216,7 @@ SaveSinglePluginHelper::SaveSinglePluginHelper( PluginsEnum_t pid )
|
|||
|
||||
SaveSinglePluginHelper::~SaveSinglePluginHelper() throw()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if( m_validstate )
|
||||
|
@ -226,15 +227,13 @@ SaveSinglePluginHelper::~SaveSinglePluginHelper() throw()
|
|||
g_plugins->Freeze( m_pid, load );
|
||||
g_plugins->Close( m_pid );
|
||||
}
|
||||
}
|
||||
catch( Exception::BaseException& ex )
|
||||
{
|
||||
|
||||
s_DisableGsWindow = false;
|
||||
throw;
|
||||
if( m_resume ) CoreThread.Resume();
|
||||
}
|
||||
DESTRUCTOR_CATCHALL;
|
||||
|
||||
s_DisableGsWindow = false;
|
||||
if( m_resume ) CoreThread.Resume();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue