* Fix for random crashes when recording movies (F12).  It still doesn't seem 100% stable, but it's a heckuva lot better than before.
 * Log options dialog behavior bugfixes.
 * Cleaned out some old hacks for handling hotkeys from the GS window, and implemented proper use of GSwindow-local hotkey mappings vs. global hotket mappings.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3292 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-06-24 20:30:36 +00:00
parent 4ad1e48950
commit 976cb072a0
10 changed files with 71 additions and 58 deletions

View File

@ -19,18 +19,19 @@
class CheckedStaticBox : public wxPanelWithHelpers
{
typedef wxPanelWithHelpers _parent;
public:
wxBoxSizer& ThisSizer; // Boxsizer which holds all child items.
wxCheckBox& ThisToggle; // toggle which can enable/disable all child controls
public:
CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title=wxEmptyString, int id=wxID_ANY );
CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title=wxEmptyString );
void SetValue( bool val );
bool GetValue() const;
bool Enable( bool enable = true );
public:
// Event handler for click events for the main checkbox (default behavior: enables/disables all child controls)
// This function can be overridden to implement custom handling of check enable/disable behavior.
virtual void MainToggle_Click( wxCommandEvent& evt );
};

View File

@ -591,11 +591,15 @@ public:
/// parameter. This is a more favorable alternative to the indexer operator since the
/// indexer implementation can and will create new entries for every request that
/// </remarks>
void TryGetValue( const Key& key, T& outval ) const
bool TryGetValue( const Key& key, T& outval ) const
{
const_iterator iter( find(key) );
if( iter != end() )
{
outval = iter->second;
return true;
}
return false;
}
const T& GetValue( Key key ) const

View File

@ -16,20 +16,22 @@
#include "PrecompiledHeader.h"
#include "CheckedStaticBox.h"
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id )
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title )
: wxPanelWithHelpers( parent, wxVERTICAL )
, ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) )
, ThisToggle( *new wxCheckBox( this, wxID_ANY, title, wxPoint( 8, 0 ) ) )
, ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
{
GetSizer()->Add( &ThisToggle );
GetSizer()->Add( &ThisSizer, wxSizerFlags().Expand() );
this += ThisToggle;
this += ThisSizer;
// Ensure that the right-side of the static group box isn't too cozy:
GetSizer()->SetMinSize( ThisToggle.GetSize() + wxSize( 32, 0 ) );
SetMinWidth( ThisToggle.GetSize().GetWidth() + 32 );
Connect( ThisToggle.GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::MainToggle_Click ) );
}
// Event handler for click events for the main checkbox (default behavior: enables/disables all child controls)
// This function can be overridden to implement custom handling of check enable/disable behavior.
void CheckedStaticBox::MainToggle_Click( wxCommandEvent& evt )
{
SetValue( evt.IsChecked() );
@ -54,3 +56,22 @@ bool CheckedStaticBox::GetValue() const
{
return ThisToggle.GetValue();
}
// This override is here so to only enable the children if both the main toggle and
// the enable request are true. If not, disable them!
bool CheckedStaticBox::Enable( bool enable )
{
if (!_parent::Enable(enable)) return false;
bool val = enable && ThisToggle.GetValue();
wxWindowList& list = GetChildren();
for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter)
{
wxWindow *current = *iter;
if( current != &ThisToggle )
current->Enable( val );
}
return true;
}

View File

@ -185,7 +185,6 @@ enum MTGS_RingCommand
, GS_RINGTYPE_VSYNC
, GS_RINGTYPE_FRAMESKIP
, GS_RINGTYPE_FREEZE
, GS_RINGTYPE_RECORD
, GS_RINGTYPE_RESET // issues a GSreset() command.
, GS_RINGTYPE_SOFTRESET // issues a soft reset for the GIF
, GS_RINGTYPE_WRITECSR

View File

@ -403,14 +403,6 @@ void SysMtgsThread::ExecuteTaskInThread()
}
break;
case GS_RINGTYPE_RECORD:
{
int record = tag.data[0];
if( GSsetupRecording != NULL ) GSsetupRecording(record, NULL);
if( SPU2setupRecording != NULL ) SPU2setupRecording(record, NULL);
}
break;
case GS_RINGTYPE_RESET:
MTGS_LOG( "(MTGS Packet Read) ringtype=Reset" );
if( GSreset != NULL ) GSreset();

View File

@ -245,31 +245,28 @@ void Pcsx2App::PadKeyDispatch( const keyEvent& ev )
m_kevt.m_keyCode = vkey;
// HACK: Legacy PAD plugins expect PCSX2 to ignore keyboard messages on the
// GS window while the PAD plugin is open, so send messages to the APP handler
// only if *either* the GS or PAD plugins are in legacy mode.
GSFrame* gsFrame = wxGetApp().GetGsFramePtr();
if( gsFrame == NULL || (PADopen != NULL) )
{
if( m_kevt.GetEventType() == wxEVT_KEY_DOWN )
{
if( GSFrame* gsFrame = wxGetApp().GetGsFramePtr() )
{
gsFrame->GetViewport()->DirectKeyCommand( m_kevt );
}
else
{
m_kevt.SetId( pxID_PadHandler_Keydown );
wxGetApp().ProcessEvent( m_kevt );
}
}
else
{
m_kevt.SetId( gsFrame->GetViewport()->GetId() );
gsFrame->ProcessEvent( m_kevt );
}
}
// --------------------------------------------------------------------------------------
// Pcsx2AppTraits (implementations)
// Pcsx2AppTraits (implementations) [includes pxMessageOutputMessageBox]
// --------------------------------------------------------------------------------------
// This is here to override pxMessageOutputMessageBox behavior, which itself is ONLY used
// by wxWidgets' command line processor. The default edition is totally inadequate for
// displaying a readable --help command line list, so I replace it here with a custom one
// that formats things nicer.
//
class pxMessageOutputMessageBox : public wxMessageOutput
{
public:

View File

@ -37,12 +37,16 @@ void GSPanel::InitDefaultAccelerators()
m_Accels->Map( AAC( WXK_F2 ), "States_CycleSlotForward" );
m_Accels->Map( AAC( WXK_F2 ).Shift(), "States_CycleSlotBackward" );
m_Accels->Map( AAC( WXK_F4 ), "Frameskip_Toggle" );
m_Accels->Map( AAC( WXK_F4 ), "Framelimiter_MasterToggle");
m_Accels->Map( AAC( WXK_F4 ).Shift(), "Frameskip_Toggle");
m_Accels->Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
m_Accels->Map( AAC( WXK_TAB ).Shift(), "Framelimiter_MasterToggle" );
m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend" );
m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" );
m_Accels->Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
m_Accels->Map( AAC( WXK_F8 ).Shift().Cmd(), "Sys_TakeSnapshot");
m_Accels->Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle");
m_Accels->Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle" );
//m_Accels->Map( AAC( WXK_F10 ), "Sys_LoggingToggle" );
@ -185,20 +189,17 @@ void GSPanel::OnKeyDown( wxKeyEvent& evt )
// silly, but oh well).
if( (PADopen != NULL) && CoreThread.IsOpen() ) return;
DirectKeyCommand( evt );
}
void GSPanel::DirectKeyCommand( wxKeyEvent& evt )
{
const GlobalCommandDescriptor* cmd = NULL;
m_Accels->TryGetValue( KeyAcceleratorCode( evt ).val32, cmd );
if( cmd == NULL )
{
evt.Skip(); // Let the global APP handle it if it wants
return;
}
if( cmd == NULL ) return;
if( cmd != NULL )
{
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
cmd->Invoke();
}
}
void GSPanel::OnFocus( wxFocusEvent& evt )

View File

@ -50,6 +50,7 @@ public:
void DoResize();
void DoShowMouse();
void DirectKeyCommand( wxKeyEvent& evt );
protected:
void AppStatusEvent_OnSettingsApplied();

View File

@ -203,10 +203,13 @@ namespace Implementations
void Sys_RecordingToggle()
{
ScopedCoreThreadPause paused_core;
paused_core.AllowResume();
g_Pcsx2Recording ^= 1;
GetMTGS().WaitGS(); // make sure GS is in sync with the audio stream when we start.
GetMTGS().SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL);
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
}
@ -394,14 +397,8 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
GlobalAccels->Map( AAC( WXK_F4 ), "Framelimiter_MasterToggle");
GlobalAccels->Map( AAC( WXK_F4 ).Shift(), "Frameskip_Toggle");
GlobalAccels->Map( AAC( WXK_TAB ), "Framelimiter_TurboToggle" );
GlobalAccels->Map( AAC( WXK_TAB ).Shift(), "Framelimiter_SlomoToggle" );
// Hack! The following bindings are temporary hacks which are needed because of issues
// with PAD plugin interfacing (the local window-based accelerators in GSPanel are
// currently ignored).
GlobalAccels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend");
/*GlobalAccels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend");
GlobalAccels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot");
GlobalAccels->Map( AAC( WXK_F8 ).Shift(), "Sys_TakeSnapshot");
GlobalAccels->Map( AAC( WXK_F8 ).Shift().Cmd(),"Sys_TakeSnapshot");
@ -411,5 +408,5 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
GlobalAccels->Map( AAC( WXK_F11 ), "Sys_FreezeGS");
GlobalAccels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle");
GlobalAccels->Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );
GlobalAccels->Map( AAC( WXK_RETURN ).Alt(), "FullscreenToggle" );*/
}

View File

@ -142,8 +142,8 @@ void Panels::eeLogOptionsPanel::OnSettingsChanged()
m_evtPanel->SetValue( conf.EE.m_EnableEvents );
m_hwPanel->SetValue( conf.EE.m_EnableHardware );
SetCheckValue( EE, Memory );
SetCheckValue( EE, Bios );
SetCheckValue( EE, Memory );
SetCheckValue( EE, Cache );
SetCheckValue( EE, SysCtrl );
@ -151,7 +151,6 @@ void Panels::eeLogOptionsPanel::OnSettingsChanged()
SetCheckValue( EE, COP0 );
SetCheckValue( EE, COP1 );
SetCheckValue( EE, COP2 );
SetCheckValue(EE, VU0micro);
SetCheckValue(EE, VU1micro);
@ -162,8 +161,8 @@ void Panels::eeLogOptionsPanel::OnSettingsChanged()
SetCheckValue(EE, Counters);
SetCheckValue(EE, VIF);
SetCheckValue(EE, GIF);
SetCheckValue(EE, SPR);
SetCheckValue(EE, IPU);
SetCheckValue(EE, SPR);
}
void Panels::iopLogOptionsPanel::OnSettingsChanged()
@ -178,6 +177,7 @@ void Panels::iopLogOptionsPanel::OnSettingsChanged()
SetCheckValue(IOP, Bios);
SetCheckValue(IOP, Memory);
SetCheckValue(IOP, GPU);
SetCheckValue(IOP, R3000A);
SetCheckValue(IOP, COP2);
@ -190,9 +190,9 @@ void Panels::iopLogOptionsPanel::OnSettingsChanged()
SetCheckValue(IOP, Memcards);
SetCheckValue(IOP, PAD);
SetCheckValue(IOP, SPU2);
SetCheckValue(IOP, CDVD);
SetCheckValue(IOP, USB);
SetCheckValue(IOP, FW);
SetCheckValue(IOP, CDVD);
}
// --------------------------------------------------------------------------------------