* Vsync setting is retained more reliably across suspend/resume/plugin config.

* fps/cpu% readout is a bit more stable.
* Plugin config menus update plugin names after on-the-fly changes.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2528 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-01-27 13:31:55 +00:00
parent 18fbbb613b
commit c109fbeaae
10 changed files with 87 additions and 35 deletions

View File

@ -200,7 +200,6 @@ static bool FindLayer1Start()
uint midsector = (iso->blocks / 2) & ~0xf;
uint deviation = 0;
//for( uint sector=searchstart; (layer1start==-1) && (sector<=searchend); sector += 16)
while( (layer1start == -1) && (deviation < midsector-16) )
{
u8 tempbuffer[CD_FRAMESIZE_RAW];

View File

@ -51,6 +51,11 @@ DefaultCpuUsageProvider::DefaultCpuUsageProvider()
m_pct_ui = 0;
m_writepos = 0;
Reset();
}
void DefaultCpuUsageProvider::Reset()
{
for( int i=0; i<QueueDepth; ++i )
m_queue[i].LoadWithCurrentTimes();
}
@ -66,7 +71,7 @@ void DefaultCpuUsageProvider::UpdateStats()
AllThreeThreads& newone( m_queue[m_writepos] );
newone.LoadWithCurrentTimes();
m_writepos = (m_writepos+1) & (QueueDepth-1);
m_writepos = (m_writepos+1) % QueueDepth;
const AllThreeThreads deltas( newone - m_queue[m_writepos] );
// get the real time passed, scaled to the Thread's tick frequency.

View File

@ -15,6 +15,8 @@
#pragma once
#include "AppEventListeners.h"
class BaseCpuUsageProvider
{
public:
@ -54,7 +56,9 @@ struct AllThreeThreads
AllThreeThreads operator-( const AllThreeThreads& right ) const;
};
class DefaultCpuUsageProvider : public BaseCpuUsageProvider
class DefaultCpuUsageProvider :
public BaseCpuUsageProvider,
public EventListener_CoreThread
{
public:
static const uint QueueDepth = 4;
@ -72,8 +76,12 @@ public:
virtual ~DefaultCpuUsageProvider() throw() {}
bool IsImplemented() const;
void Reset();
void UpdateStats();
int GetEEcorePct() const;
int GetGsPct() const;
int GetGuiPct() const;
protected:
void CoreThread_OnResumed() { Reset(); }
};

View File

@ -225,6 +225,8 @@ void GSPanel::AppStatusEvent_OnSettingsApplied()
// GSFrame Implementation
// --------------------------------------------------------------------------------------
static const uint TitleBarUpdateMs = 333;
GSFrame::GSFrame(wxWindow* parent, const wxString& title)
: wxFrame(parent, wxID_ANY, title,
g_Conf->GSWindow.WindowPos, wxSize( 640, 480 ),
@ -271,14 +273,14 @@ wxStaticText* GSFrame::GetLabel_OutputDisabled() const
void GSFrame::CoreThread_OnResumed()
{
m_timer_UpdateTitle.Start( 275 );
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
}
void GSFrame::CoreThread_OnSuspended()
{
// Could stop the timer outright here, tho no harm in having an occasional
// update here or there, just in case some state info changes while emu is suspended.
m_timer_UpdateTitle.Start( 333 );
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
}
// overrides base Show behavior.
@ -301,7 +303,7 @@ bool GSFrame::Show( bool shown )
if( wxStaticText* label = GetLabel_OutputDisabled() )
label->Show( EmuConfig.GS.DisableOutput );
m_timer_UpdateTitle.Start( 275 );
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
}
else
{

View File

@ -213,7 +213,23 @@ void MainEmuFrame::DispatchEvent( const PluginEventType& plugin_evt )
if( !pxAssertMsg( GetMenuBar()!=NULL, "Mainframe menu bar is NULL!" ) ) return;
//ApplyCoreStatus();
ApplyPluginStatus();
if( plugin_evt == CorePlugins_Unloaded )
{
for( int i=0; i<PluginId_Count; ++i )
m_PluginMenuPacks[i].OnUnloaded();
}
else if( plugin_evt == CorePlugins_Loaded )
{
if( !pxAssertDev( g_plugins!=NULL, wxNullChar ) ) return;
for( int i=0; i<PluginId_Count; ++i )
m_PluginMenuPacks[i].OnLoaded();
// bleh this makes the menu too cluttered. --air
//m_menuCDVD.SetLabel( MenuId_Src_Plugin, wxsFormat( L"%s (%s)", _("Plugin"),
// g_plugins->GetName( PluginId_CDVD ).c_str() ) );
}
}
void MainEmuFrame::DispatchEvent( const CoreThreadStatus& status )
@ -259,8 +275,8 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
, m_menuBoot ( *new wxMenu() )
, m_menuCDVD ( *new wxMenu() )
, m_menuSys ( *new wxMenu() )
, m_menuConfig( *new wxMenu() )
, m_menuSys ( *new wxMenu() )
, m_menuConfig ( *new wxMenu() )
, m_menuMisc ( *new wxMenu() )
, m_menuDebug ( *new wxMenu() )
@ -524,24 +540,6 @@ void MainEmuFrame::ApplyCoreStatus()
menubar.Enable( MenuId_Sys_Shutdown, SysHasValidState() || (g_plugins!=NULL) );
}
void MainEmuFrame::ApplyPluginStatus()
{
if( g_plugins == NULL )
{
for( int i=0; i<PluginId_Count; ++i )
m_PluginMenuPacks[i].OnUnloaded();
}
else
{
for( int i=0; i<PluginId_Count; ++i )
m_PluginMenuPacks[i].OnLoaded();
// bleh this makes the menu too cluttered. --air
//m_menuCDVD.SetLabel( MenuId_Src_Plugin, wxsFormat( L"%s (%s)", _("Plugin"),
// g_plugins->GetName( PluginId_CDVD ).c_str() ) );
}
}
void MainEmuFrame::ApplySettings()
{
wxMenuBar& menubar( *GetMenuBar() );

View File

@ -230,7 +230,6 @@ public:
protected:
void ApplySettings();
void ApplyCoreStatus();
void ApplyPluginStatus();
void SaveEmuOptions();

View File

@ -405,7 +405,7 @@ void MainEmuFrame::Menu_ShowConsole_Stdio(wxCommandEvent &event)
void MainEmuFrame::Menu_PrintCDVD_Info(wxCommandEvent &event)
{
g_Conf->EmuOptions.CdvdVerboseReads = GetMenuBar()->IsChecked( MenuId_CDVD_Info );
const_cast<Pcsx2Config&>(EmuConfig).CdvdVerboseReads = true; // read-only in core thread, so it's safe to modify.
const_cast<Pcsx2Config&>(EmuConfig).CdvdVerboseReads = g_Conf->EmuOptions.CdvdVerboseReads; // read-only in core thread, so it's safe to modify.
SaveEmuOptions();
}

View File

@ -318,8 +318,24 @@ namespace Panels
// --------------------------------------------------------------------------------------
class MemoryCardsPanel : public BaseApplicableConfigPanel
{
class SingleCardPanel : public BaseApplicableConfigPanel
{
protected:
public:
SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx );
virtual ~SingleCardPanel() throw() { }
void Apply();
void AppStatusEvent_OnSettingsApplied();
};
protected:
wxCheckBox* m_checkbox_NtfsCompress;
wxCheckBox* m_checkbox_Ejection;
wxCheckBox* m_checkbox_Multitap1;
wxCheckBox* m_checkbox_Multitap2;
public:
MemoryCardsPanel( wxWindow* parent );
virtual ~MemoryCardsPanel() throw() { }

View File

@ -16,9 +16,30 @@
#include "PrecompiledHeader.h"
#include "ConfigurationPanels.h"
// --------------------------------------------------------------------------------------
// SingleCardPanel Implementations
// --------------------------------------------------------------------------------------
Panels::MemoryCardsPanel::SingleCardPanel::SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx )
: BaseApplicableConfigPanel( parent, wxVERTICAL, wxsFormat( L"Port %u / Slot %u", portidx, slotidx ) )
{
}
void Panels::MemoryCardsPanel::SingleCardPanel::Apply()
{
}
void Panels::MemoryCardsPanel::SingleCardPanel::AppStatusEvent_OnSettingsApplied()
{
}
// --------------------------------------------------------------------------------------
// MemoryCardsPanel Implementations
// --------------------------------------------------------------------------------------
Panels::MemoryCardsPanel::MemoryCardsPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent )
{
AppStatusEvent_OnSettingsApplied();
}

View File

@ -47,9 +47,11 @@ class AppPluginManager : public PluginManager
typedef PluginManager _parent;
public:
AppPluginManager( const wxString (&folders)[PluginId_Count] ) : PluginManager( folders )
AppPluginManager( const wxString (&folders)[PluginId_Count] )
: PluginManager( folders )
{
SetSettingsFolder( GetSettingsFolder().ToString() );
wxGetApp().PostPluginStatus( CorePlugins_Loaded );
}
virtual ~AppPluginManager() throw()
@ -98,7 +100,12 @@ public:
sApp.OpenGsPanel();
}
return _parent::OpenPlugin_GS();
bool retval = _parent::OpenPlugin_GS();
if( g_LimiterMode == Limit_Turbo )
GSsetVsync( false );
return retval;
}
// Yay, this plugin is guaranteed to always be opened first and closed last.
@ -318,8 +325,6 @@ void Pcsx2App::OnLoadPluginsComplete( wxCommandEvent& evt )
}
if( fn_tmp != NULL ) fn_tmp( evt );
PostPluginStatus( CorePlugins_Loaded );
}
void Pcsx2App::CancelLoadingPlugins()
@ -382,7 +387,6 @@ void LoadPluginsImmediate()
wxString passins[PluginId_Count];
ConvertPluginFilenames( passins );
wxGetApp().m_CorePlugins = new AppPluginManager( passins );
}
void UnloadPlugins()