Committing some messed up partial memorycard options panel implementation... planning to redo it but I want this on record as a backup, just in case. (all disabled, so not much to look at and nothing changed in the emu itself yet)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2543 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-01-31 02:21:58 +00:00
parent 07927f00d6
commit 42064218ec
20 changed files with 435 additions and 51 deletions

View File

@ -191,10 +191,18 @@ struct FixedInt
static bool TryFromString( FixedInt<Precision>& dest, const wxString& parseFrom ) static bool TryFromString( FixedInt<Precision>& dest, const wxString& parseFrom )
{ {
long whole, frac; long whole=0, frac=0;
wxString afterFirst( parseFrom.AfterFirst( L'.' ).Mid(0, 5) ); const wxString beforeFirst( parseFrom.BeforeFirst( L'.' ) );
if( !parseFrom.BeforeFirst( L'.' ).ToLong( &whole ) || !afterFirst.ToLong( &frac ) ) const wxString afterFirst( parseFrom.AfterFirst( L'.' ).Mid(0, 5) );
return false; bool success = true;
if( !beforeFirst.IsEmpty() )
success = success && beforeFirst.ToLong( &whole );
if( !afterFirst.IsEmpty() )
success = success && afterFirst.ToLong( &frac );
if( !success ) return false;
dest.SetWhole( whole ); dest.SetWhole( whole );

View File

@ -112,6 +112,7 @@ struct pxStretchType
class pxProportion class pxProportion
{ {
public:
int intval; int intval;
pxProportion( int prop ) pxProportion( int prop )
@ -132,6 +133,31 @@ class pxProportion
} }
}; };
class pxBorder
{
public:
int direction;
int padding;
pxBorder( int dir, int pad )
{
direction = dir;
padding = pad;
}
wxSizerFlags Apply( wxSizerFlags flags=wxSizerFlags() ) const;
wxSizerFlags operator& ( const wxSizerFlags& _flgs ) const
{
return Apply( _flgs );
}
operator wxSizerFlags() const
{
return Apply();
}
};
extern const pxAlignmentType extern const pxAlignmentType
pxCentre, // Horizontal centered alignment pxCentre, // Horizontal centered alignment
pxCenter, pxCenter,

View File

@ -43,7 +43,7 @@ void pxCheckBox::Init(const wxString& label, const wxString& subtext)
wxBoxSizer& spaced( *new wxBoxSizer( wxHORIZONTAL ) ); wxBoxSizer& spaced( *new wxBoxSizer( wxHORIZONTAL ) );
spaced += Indentation; spaced += Indentation;
spaced += m_subtext | wxSF.Border( wxBOTTOM, 9 ); spaced += m_subtext | pxBorder( wxBOTTOM, 9 );
spaced += pxSizerFlags::StdPadding; spaced += pxSizerFlags::StdPadding;
*this += &spaced; *this += &spaced;
@ -74,15 +74,15 @@ bool pxCheckBox::GetValue() const
void operator+=( wxSizer& target, pxCheckBox* src ) void operator+=( wxSizer& target, pxCheckBox* src )
{ {
if( !pxAssert( src != NULL ) ) return; if( !pxAssert( src != NULL ) ) return;
target.Add( src, wxSF.Expand() ); target.Add( src, pxExpand );
} }
void operator+=( wxSizer& target, pxCheckBox& src ) void operator+=( wxSizer& target, pxCheckBox& src )
{ {
target.Add( &src, wxSF.Expand() ); target.Add( &src, pxExpand );
} }
void operator+=( wxSizer* target, pxCheckBox& src ) void operator+=( wxSizer* target, pxCheckBox& src )
{ {
target->Add( &src, wxSF.Expand() ); target->Add( &src, pxExpand );
} }

View File

@ -104,6 +104,11 @@ wxSizerFlags pxProportion::Apply( wxSizerFlags flags ) const
return flags.Proportion( intval ); return flags.Proportion( intval );
} }
wxSizerFlags pxBorder::Apply( wxSizerFlags flags ) const
{
return flags.Border( direction, padding );
}
wxSizerFlags operator& ( const wxSizerFlags& _flgs, const wxSizerFlags& _flgs2 ) wxSizerFlags operator& ( const wxSizerFlags& _flgs, const wxSizerFlags& _flgs2 )
{ {
//return align.Apply( _flgs ); //return align.Apply( _flgs );

View File

@ -296,12 +296,14 @@ void wxPanelWithHelpers::Init()
if( guess != NULL ) if( guess != NULL )
{ {
int top=0, others=0;
if( wxIsKindOf( guess, wxStaticBoxSizer ) ) if( wxIsKindOf( guess, wxStaticBoxSizer ) )
{
int top=0, others=0;
((wxStaticBoxSizer*)guess)->GetStaticBox()->GetBordersForSizer( &top, &others ); ((wxStaticBoxSizer*)guess)->GetStaticBox()->GetBordersForSizer( &top, &others );
m_idealWidth -= others*2;
m_idealWidth -= (others*2); }
m_idealWidth -= 2; // generic padding compensation (no exact sciences to be found here) else
m_idealWidth -= 2; // generic padding compensation (no exact sciences to be found here)
} }
} }

View File

@ -38,6 +38,7 @@ class IniInterface;
class wxConfigBase; class wxConfigBase;
class wxFileConfig; class wxFileConfig;
class wxDirPickerCtrl; class wxDirPickerCtrl;
class wxFilePickerCtrl;
class wxFileDirPickerEvent; class wxFileDirPickerEvent;
class wxListBox; class wxListBox;
class wxListbook; class wxListbook;

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "App.h" #include "App.h"
#include "Dialogs/ModalPopups.h" #include "ModalPopups.h"
using namespace pxSizerFlags; using namespace pxSizerFlags;

View File

@ -86,6 +86,9 @@ Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, con
#define ConnectSomethingChanged( command ) \ #define ConnectSomethingChanged( command ) \
Connect( wxEVT_COMMAND_##command, wxCommandEventHandler( BaseConfigurationDialog::OnSomethingChanged ) ); Connect( wxEVT_COMMAND_##command, wxCommandEventHandler( BaseConfigurationDialog::OnSomethingChanged ) );
ConnectSomethingChanged( TEXT_UPDATED );
ConnectSomethingChanged( TEXT_ENTER );
ConnectSomethingChanged( RADIOBUTTON_SELECTED ); ConnectSomethingChanged( RADIOBUTTON_SELECTED );
ConnectSomethingChanged( COMBOBOX_SELECTED ); ConnectSomethingChanged( COMBOBOX_SELECTED );
ConnectSomethingChanged( CHECKBOX_CLICKED ); ConnectSomethingChanged( CHECKBOX_CLICKED );

View File

@ -67,6 +67,9 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const=0; virtual wxString& GetConfSettingsTabName() const=0;
}; };
// --------------------------------------------------------------------------------------
// SysConfigDialog
// --------------------------------------------------------------------------------------
class SysConfigDialog : public BaseConfigurationDialog class SysConfigDialog : public BaseConfigurationDialog
{ {
protected: protected:
@ -80,6 +83,9 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const { return g_Conf->SysSettingsTabName; } virtual wxString& GetConfSettingsTabName() const { return g_Conf->SysSettingsTabName; }
}; };
// --------------------------------------------------------------------------------------
// AppConfigDialog
// --------------------------------------------------------------------------------------
class AppConfigDialog : public BaseConfigurationDialog class AppConfigDialog : public BaseConfigurationDialog
{ {
protected: protected:
@ -93,6 +99,9 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const { return g_Conf->AppSettingsTabName; } virtual wxString& GetConfSettingsTabName() const { return g_Conf->AppSettingsTabName; }
}; };
// --------------------------------------------------------------------------------------
// BiosSelectorDialog
// --------------------------------------------------------------------------------------
class BiosSelectorDialog : public BaseApplicableDialog class BiosSelectorDialog : public BaseApplicableDialog
{ {
protected: protected:
@ -107,4 +116,28 @@ namespace Dialogs
void OnOk_Click( wxCommandEvent& evt ); void OnOk_Click( wxCommandEvent& evt );
void OnDoubleClicked( wxCommandEvent& evt ); void OnDoubleClicked( wxCommandEvent& evt );
}; };
// --------------------------------------------------------------------------------------
// CreateMemoryCardDialog
// --------------------------------------------------------------------------------------
class CreateMemoryCardDialog : public BaseApplicableDialog
{
protected:
wxFilePickerCtrl* m_filepicker;
pxRadioPanel* m_radio_CardSize;
#ifdef __WXMSW__
pxCheckBox* m_check_CompressNTFS;
#endif
public:
virtual ~CreateMemoryCardDialog() throw() {}
CreateMemoryCardDialog( wxWindow* parent, uint port, uint slot, const wxString& filepath=wxEmptyString );
static const wxChar* GetNameStatic() { return L"Dialog:CreateMemoryCard"; }
protected:
void OnOk_Click( wxCommandEvent& evt );
void OnDoubleClicked( wxCommandEvent& evt );
};
} }

View File

@ -0,0 +1,80 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 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 "ConfigurationDialog.h"
#include <wx/filepicker.h>
#include <wx/ffile.h>
using namespace pxSizerFlags;
// defined in MemoryCardsPanel.cpp
extern wxFilePickerCtrl* CreateMemoryCardFilePicker( wxWindow* parent, uint portidx, uint slotidx, const wxString& filename=wxEmptyString );
Dialogs::CreateMemoryCardDialog::CreateMemoryCardDialog( wxWindow* parent, uint port, uint slot, const wxString& filepath )
: BaseApplicableDialog( parent, _("Create a new MemoryCard..."), wxVERTICAL )
{
m_idealWidth = 620;
wxBoxSizer& s_padding( *new wxBoxSizer(wxVERTICAL) );
*this += s_padding | StdExpand();
#ifdef __WXMSW__
m_check_CompressNTFS = new pxCheckBox( this,
_("Use NTFS compression on this card"),
pxE( ".Dialog:Memorycards:NtfsCompress",
L"NTFS compression is built-in, fast, and completely reliable. Memorycards typically compress "
L"very well, and run faster as a result, so this option is highly recommended."
)
);
#endif
pxE( ".Dialog:Memorycards:NeedsFormatting",
L"Your new MemoryCard needs to be formatted. Some games can format the card for you, while "
L"others may require you do so using the BIOS. To boot into the BIOS, select the NoDisc option "
L"as your CDVD Source."
);
const RadioPanelItem tbl_CardSizes[] =
{
RadioPanelItem(_("8 MB [most compatible]"))
. SetToolTip(_("8 meg carts are 'small' but are pretty well sure to work for any and all games.")),
RadioPanelItem(_("16 MB"))
. SetToolTip(_("16 and 32 MB cards have roughly the same compatibility factor. Most games see them fine, others may not.")),
RadioPanelItem(_("32 MB"))
. SetToolTip(_("16 and 32 MB cards have roughly the same compatibility factor. Most games see them fine, others may not.")),
RadioPanelItem(_("64 MB"), _("Low compatibility! Use at your own risk."))
. SetToolTip(_("Yes it's very big. Unfortunately a lot of games don't really work with them properly."))
};
m_radio_CardSize = &(new pxRadioPanel( this, tbl_CardSizes ))->SetDefaultItem(0);
m_filepicker = CreateMemoryCardFilePicker( this, port, slot, filepath );
// ----------------------------
// Sizers and Layout
// ----------------------------
s_padding += m_filepicker | StdExpand();
s_padding += m_radio_CardSize | StdExpand();
#ifdef __WXMSW__
s_padding += m_check_CompressNTFS;
#endif
}

View File

@ -408,7 +408,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
m_menuConfig.Append(MenuId_Config_SysSettings, _("System &Settings") ); m_menuConfig.Append(MenuId_Config_SysSettings, _("Emulation &Settings") );
m_menuConfig.Append(MenuId_Config_AppSettings, _("App Settings") ); m_menuConfig.Append(MenuId_Config_AppSettings, _("App Settings") );
m_menuConfig.AppendSeparator(); m_menuConfig.AppendSeparator();

View File

@ -264,26 +264,29 @@ void MainEmuFrame::Menu_IsoBrowse_Click( wxCommandEvent &event )
core.Resume(); core.Resume();
} }
void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_MultitapToggle_Click( wxCommandEvent& )
{ {
g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle ); g_Conf->EmuOptions.MultitapPort0_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap0Toggle );
g_Conf->EmuOptions.MultitapPort1_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap1Toggle ); g_Conf->EmuOptions.MultitapPort1_Enabled = GetMenuBar()->IsChecked( MenuId_Config_Multitap1Toggle );
AppSaveSettings(); AppApplySettings();
SaveEmuOptions();
//evt.Skip();
} }
void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_SkipBiosToggle_Click( wxCommandEvent& )
{ {
g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle ); g_Conf->EmuOptions.SkipBiosSplash = GetMenuBar()->IsChecked( MenuId_SkipBiosToggle );
SaveEmuOptions(); SaveEmuOptions();
} }
void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent &event ) void MainEmuFrame::Menu_EnablePatches_Click( wxCommandEvent& )
{ {
g_Conf->EmuOptions.EnablePatches = GetMenuBar()->IsChecked( MenuId_EnablePatches ); g_Conf->EmuOptions.EnablePatches = GetMenuBar()->IsChecked( MenuId_EnablePatches );
SaveEmuOptions(); SaveEmuOptions();
} }
void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event) void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent&)
{ {
bool resume = CoreThread.Suspend(); bool resume = CoreThread.Suspend();
if( _DoSelectELFBrowser() ) if( _DoSelectELFBrowser() )

View File

@ -32,8 +32,8 @@ struct Component_FileMcd;
#include <wx/ffile.h> #include <wx/ffile.h>
static const int MCD_SIZE = 1024 * 8 * 16; static const int MCD_SIZE = 1024 * 8 * 16; // Legacy PSX card default size
static const int MC2_SIZE = 1024 * 528 * 16; static const int MC2_SIZE = 1024 * 528 * 16; // PS2 card default size.
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// FileMemoryCard // FileMemoryCard
@ -123,8 +123,8 @@ bool FileMemoryCard::Seek( wxFFile& f, u32 adr )
const u32 size = f.Length(); const u32 size = f.Length();
// If anyone knows why this filesize logic is here (it appears to be related to legacy PSX // If anyone knows why this filesize logic is here (it appears to be related to legacy PSX
// cards, perhaps hacked support for some special memcard formats that had header info?), // cards, perhaps hacked support for some special emulator-specific memcard formats that
// then please replace this comment with something useful. Thanks! -- air // had header info?), then please replace this comment with something useful. Thanks! -- air
u32 offset = 0; u32 offset = 0;

View File

@ -93,8 +93,9 @@ namespace Panels
void AppStatusEvent_OnSettingsApplied(); void AppStatusEvent_OnSettingsApplied();
}; };
////////////////////////////////////////////////////////////////////////////////////////// // --------------------------------------------------------------------------------------
// // CpuPanelEE / CpuPanelVU
// --------------------------------------------------------------------------------------
class CpuPanelEE : public BaseApplicableConfigPanel class CpuPanelEE : public BaseApplicableConfigPanel
{ {
protected: protected:
@ -125,12 +126,12 @@ namespace Panels
void OnRestoreDefaults( wxCommandEvent& evt ); void OnRestoreDefaults( wxCommandEvent& evt );
}; };
// --------------------------------------------------------------------------------------
// BaseAdvancedCpuOptions
// --------------------------------------------------------------------------------------
class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel class BaseAdvancedCpuOptions : public BaseApplicableConfigPanel
{ {
protected: protected:
//wxStaticBoxSizer& s_round;
//wxStaticBoxSizer& s_clamp;
pxRadioPanel* m_RoundModePanel; pxRadioPanel* m_RoundModePanel;
pxRadioPanel* m_ClampModePanel; pxRadioPanel* m_ClampModePanel;
@ -148,6 +149,9 @@ namespace Panels
void ApplyRoundmode( SSE_MXCSR& mxcsr ); void ApplyRoundmode( SSE_MXCSR& mxcsr );
}; };
// --------------------------------------------------------------------------------------
// AdvancedOptionsFPU / AdvancedOptionsVU
// --------------------------------------------------------------------------------------
class AdvancedOptionsFPU : public BaseAdvancedCpuOptions class AdvancedOptionsFPU : public BaseAdvancedCpuOptions
{ {
public: public:
@ -321,30 +325,47 @@ namespace Panels
class SingleCardPanel : public BaseApplicableConfigPanel class SingleCardPanel : public BaseApplicableConfigPanel
{ {
protected: protected:
uint m_port, m_slot;
wxFilePickerCtrl* m_filepicker;
wxCheckBox* m_check_Disable;
wxButton* m_button_Recreate;
// Displays card status: Size, Formatted, etc.
wxStaticText* m_label_Status;
public: public:
SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx ); SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx );
virtual ~SingleCardPanel() throw() { } virtual ~SingleCardPanel() throw() { }
void Apply(); void Apply();
bool UpdateStatusLine( const wxFileName& mcdfilename );
protected:
void AppStatusEvent_OnSettingsApplied(); void AppStatusEvent_OnSettingsApplied();
void OnFileChanged( wxCommandEvent& evt );
void OnRecreate_Clicked( wxCommandEvent& evt );
}; };
protected: protected:
wxCheckBox* m_checkbox_NtfsCompress; pxCheckBox* m_check_Ejection;
wxCheckBox* m_checkbox_Ejection; pxCheckBox* m_check_Multitap[2];
wxCheckBox* m_checkbox_Multitap1;
wxCheckBox* m_checkbox_Multitap2; SingleCardPanel* m_CardPanel[2][4];
public: public:
MemoryCardsPanel( wxWindow* parent ); MemoryCardsPanel( wxWindow* parent );
virtual ~MemoryCardsPanel() throw() { } virtual ~MemoryCardsPanel() throw() { }
void Apply(); void Apply();
protected:
void OnMultitapChecked( wxCommandEvent& evt );
void AppStatusEvent_OnSettingsApplied(); void AppStatusEvent_OnSettingsApplied();
}; };
////////////////////////////////////////////////////////////////////////////////////////// // --------------------------------------------------------------------------------------
// DirPickerPanel // DirPickerPanel
// --------------------------------------------------------------------------------------
// A simple panel which provides a specialized configurable directory picker with a // A simple panel which provides a specialized configurable directory picker with a
// "[x] Use Default setting" option, which enables or disables the panel. // "[x] Use Default setting" option, which enables or disables the panel.
// //

View File

@ -174,7 +174,7 @@ Panels::CpuPanelEE::CpuPanelEE( wxWindow* parent )
s_recs += s_iop | SubGroup(); s_recs += s_iop | SubGroup();
*this += &s_recs | StdExpand(); *this += &s_recs | StdExpand();
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand(); *this += new wxStaticLine( this ) | pxExpand.Border(wxALL, 18);
*this += new AdvancedOptionsFPU( this ) | StdExpand(); *this += new AdvancedOptionsFPU( this ) | StdExpand();
*this += 12; *this += 12;
@ -225,7 +225,7 @@ Panels::CpuPanelVU::CpuPanelVU( wxWindow* parent )
s_recs += s_vu1 | SubGroup(); s_recs += s_vu1 | SubGroup();
*this += &s_recs | StdExpand(); *this += &s_recs | StdExpand();
*this += new wxStaticLine( this ) | wxSF.Border(wxALL, 18).Expand(); *this += new wxStaticLine( this ) | pxExpand.Border(wxALL, 18);
*this += new AdvancedOptionsVU( this ) | StdExpand(); *this += new AdvancedOptionsVU( this ) | StdExpand();
*this += 12; *this += 12;

View File

@ -15,21 +15,135 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "ConfigurationPanels.h" #include "ConfigurationPanels.h"
#include "Dialogs/ConfigurationDialog.h"
#include <wx/filepicker.h>
#include <wx/ffile.h>
using namespace pxSizerFlags;
wxFilePickerCtrl* CreateMemoryCardFilePicker( wxWindow* parent, uint portidx, uint slotidx, const wxString& filename=wxEmptyString )
{
return new wxFilePickerCtrl( parent, wxID_ANY, filename,
wxsFormat(_("Select memorycard for Port %u / Slot %u"), portidx+1, slotidx+1), // picker window title
L"*.ps2", // default wildcard
wxDefaultPosition, wxDefaultSize,
wxFLP_DEFAULT_STYLE & ~wxFLP_FILE_MUST_EXIST
);
}
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// SingleCardPanel Implementations // SingleCardPanel Implementations
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
Panels::MemoryCardsPanel::SingleCardPanel::SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx ) Panels::MemoryCardsPanel::SingleCardPanel::SingleCardPanel( wxWindow* parent, uint portidx, uint slotidx )
: BaseApplicableConfigPanel( parent, wxVERTICAL, wxsFormat( L"Port %u / Slot %u", portidx, slotidx ) ) : BaseApplicableConfigPanel( parent, wxVERTICAL /*, wxsFormat(_("Port %u / Slot %u"), portidx+1, slotidx+1)*/ )
{ {
m_port = portidx;
m_slot = slotidx;
m_filepicker = CreateMemoryCardFilePicker( this, portidx, slotidx );
m_check_Disable = new wxCheckBox ( this, wxID_ANY, _("Disable this card") );
m_button_Recreate = new wxButton ( this, wxID_ANY, _("Re-create") );
m_label_Status = new wxStaticText ( this, wxID_ANY, _("Status: ") );
pxSetToolTip( m_check_Disable, pxE( ".Tooltip:MemoryCard:Enable",
L"When disabled, the card slot is reported as being empty to the emulator."
) );
pxSetToolTip( m_button_Recreate, pxE( ".Tooltip:MemoryCard:Recreate",
L"Deletes the existing memory card and creates a new one. All existing card contents will be lost."
) );
wxFlexGridSizer& s_status( *new wxFlexGridSizer( 4 ) );
s_status.AddGrowableCol( 1 );
s_status += StdPadding;
s_status += m_label_Status | pxMiddle;
s_status += m_button_Recreate;
s_status += StdPadding;
*this += m_check_Disable | pxBorder( wxLEFT, StdPadding );
*this += m_filepicker | StdExpand();
*this += s_status | pxExpand;
Connect( m_filepicker->GetId(), wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler(SingleCardPanel::OnFileChanged) );
Connect( m_button_Recreate->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SingleCardPanel::OnRecreate_Clicked) );
AppStatusEvent_OnSettingsApplied();
}
void Panels::MemoryCardsPanel::SingleCardPanel::OnFileChanged( wxCommandEvent& evt )
{
if( UpdateStatusLine(m_filepicker->GetPath()) ) evt.Skip();
}
void Panels::MemoryCardsPanel::SingleCardPanel::OnRecreate_Clicked( wxCommandEvent& evt )
{
if( !wxFileName( m_filepicker->GetPath() ).IsOk() ) return;
Dialogs::CreateMemoryCardDialog( this, m_port, m_slot, m_filepicker->GetPath() ).ShowModal();
} }
void Panels::MemoryCardsPanel::SingleCardPanel::Apply() void Panels::MemoryCardsPanel::SingleCardPanel::Apply()
{ {
AppConfig::McdOptions& mcd( g_Conf->Mcd[m_port][m_slot] );
mcd.Enabled = m_check_Disable->GetValue();
mcd.Filename = m_filepicker->GetPath();
} }
void Panels::MemoryCardsPanel::SingleCardPanel::AppStatusEvent_OnSettingsApplied() void Panels::MemoryCardsPanel::SingleCardPanel::AppStatusEvent_OnSettingsApplied()
{ {
const AppConfig::McdOptions& mcd( g_Conf->Mcd[m_port][m_slot] );
const wxString mcdFilename( g_Conf->FullpathToMcd( m_port, m_slot ) );
m_filepicker->SetPath( mcdFilename );
UpdateStatusLine( mcdFilename );
m_check_Disable->SetValue( !mcd.Enabled );
}
bool Panels::MemoryCardsPanel::SingleCardPanel::UpdateStatusLine( const wxFileName& mcdfilename )
{
if( !mcdfilename.IsOk() )
{
m_label_Status->SetLabel(_("Invalid filename or path."));
m_button_Recreate->SetLabel(_("Create"));
m_button_Recreate->Disable();
return false;
}
m_button_Recreate->Enable();
if( !mcdfilename.FileExists() )
{
m_label_Status->SetLabel(_("Status: File does not exist."));
m_button_Recreate->SetLabel(_("Create"));
return false;
}
else
{
m_button_Recreate->SetLabel(_("Re-create"));
// TODO: Add formatted/unformatted check here.
wxFFile mcdFile( mcdfilename.GetFullPath() );
if( !mcdFile.IsOpened() )
{
m_label_Status->SetLabel(_("Status: Permission denied."));
}
else
{
const uint size = (uint)(mcdFile.Length() / (1024 * 528 * 2));
m_label_Status->SetLabel( wxsFormat(_("Status: %u MB"), size) );
}
return true;
}
} }
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
@ -38,9 +152,87 @@ void Panels::MemoryCardsPanel::SingleCardPanel::AppStatusEvent_OnSettingsApplied
Panels::MemoryCardsPanel::MemoryCardsPanel( wxWindow* parent ) Panels::MemoryCardsPanel::MemoryCardsPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent ) : BaseApplicableConfigPanel( parent )
{ {
wxPanelWithHelpers* columns[2];
m_idealWidth -= 48;
m_check_Ejection = new pxCheckBox( this,
_("Auto-eject memorycards when loading savestates"),
pxE( ".Dialog:Memorycards:EnableEjection",
L"Avoids memorycard corruption by forcing games to re-index card contents after "
L"loading from savestates. May not be compatible with all games (Guitar Hero)."
)
);
m_idealWidth += 48;
for( uint port=0; port<2; ++port )
{
columns[port] = new wxPanelWithHelpers( this, wxVERTICAL );
columns[port]->SetIdealWidth( (columns[port]->GetIdealWidth()-12) / 2 );
m_check_Multitap[port] = new pxCheckBox( columns[port], wxsFormat(_("Enable Multitap on Port %u"), port+1) );
m_check_Multitap[port]->SetClientData( (void*) port );
for( uint slot=0; slot<4; ++slot )
{
m_CardPanel[port][slot] = new SingleCardPanel( columns[port], port, slot );
}
Connect( m_check_Multitap[port]->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(MemoryCardsPanel::OnMultitapChecked));
}
// ------------------------------------
// Sizer / Layout Section
// ------------------------------------
wxFlexGridSizer* s_table = new wxFlexGridSizer( 2 );
s_table->AddGrowableCol( 0 );
s_table->AddGrowableCol( 1 );
for( uint port=0; port<2; ++port )
{
wxStaticBoxSizer& portSizer( *new wxStaticBoxSizer( wxVERTICAL, columns[port], wxsFormat(_("Port %u"), port+1) ) );
*columns[port] += portSizer | SubGroup();
for( uint slot=0; slot<4; ++slot )
{
portSizer += m_CardPanel[port][slot] | pxExpand;
if( slot == 0 )
{
portSizer += new wxStaticLine( columns[port] ) | pxExpand.Border( wxTOP, StdPadding );
portSizer += m_check_Multitap[port] | pxCenter.Border( wxBOTTOM, StdPadding );
}
}
*s_table += columns[port] | StdExpand();
}
*this += s_table | pxExpand;
wxBoxSizer* s_checks = new wxBoxSizer( wxVERTICAL );
*this += s_checks | StdExpand();
*s_checks += m_check_Ejection;
AppStatusEvent_OnSettingsApplied(); AppStatusEvent_OnSettingsApplied();
Disable(); // it's all broken right now, so disable it
}
void Panels::MemoryCardsPanel::OnMultitapChecked( wxCommandEvent& evt )
{
for( int port=0; port<2; ++port )
{
if( m_check_Multitap[port]->GetId() != evt.GetId() ) continue;
for( uint slot=1; slot<4; ++slot )
{
m_CardPanel[port][slot]->Enable( m_check_Multitap[port]->IsChecked() && g_Conf->Mcd[port][slot].Enabled );
}
}
} }
void Panels::MemoryCardsPanel::Apply() void Panels::MemoryCardsPanel::Apply()
@ -49,4 +241,13 @@ void Panels::MemoryCardsPanel::Apply()
void Panels::MemoryCardsPanel::AppStatusEvent_OnSettingsApplied() void Panels::MemoryCardsPanel::AppStatusEvent_OnSettingsApplied()
{ {
const Pcsx2Config& emuconf( g_Conf->EmuOptions );
for( uint port=0; port<2; ++port )
for( uint slot=0; slot<4; ++slot )
{
m_CardPanel[port][slot]->Enable( g_Conf->Mcd[port][slot].Enabled && ((slot == 0) || emuconf.MultitapEnabled(port)) );
}
} }

View File

@ -237,7 +237,6 @@ void Panels::UsermodeSelectionPanel::AppStatusEvent_OnSettingsApplied()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent ) Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent )
: BaseApplicableConfigPanel( parent, wxHORIZONTAL ) : BaseApplicableConfigPanel( parent, wxHORIZONTAL )
, m_langs()
{ {
m_picker = NULL; m_picker = NULL;
i18n_EnumeratePackages( m_langs ); i18n_EnumeratePackages( m_langs );

View File

@ -48,8 +48,6 @@ DEFINE_EVENT_TYPE(pxEVT_ShowStatusBar);
typedef s32 (CALLBACK* TestFnptr)(); typedef s32 (CALLBACK* TestFnptr)();
typedef void (CALLBACK* ConfigureFnptr)(); typedef void (CALLBACK* ConfigureFnptr)();
//////////////////////////////////////////////////////////////////////////////////////////
//
namespace Exception namespace Exception
{ {
class NotEnumerablePlugin : public BadStream class NotEnumerablePlugin : public BadStream
@ -152,7 +150,7 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent )
m_gauge.SetToolTip( _("I'm givin' her all she's got, Captain!") ); m_gauge.SetToolTip( _("I'm givin' her all she's got, Captain!") );
*this += new pxStaticHeading( this, _( "Enumerating available plugins..." ) ); *this += new pxStaticHeading( this, _( "Enumerating available plugins..." ) );
*this += m_gauge | wxSF.Expand().Border( wxLEFT | wxRIGHT, 32 ); *this += m_gauge | pxExpand.Border( wxLEFT | wxRIGHT, 32 );
*this += m_label | StdExpand(); *this += m_label | StdExpand();
Fit(); Fit();
@ -202,14 +200,14 @@ Panels::PluginSelectorPanel::ComboBoxPanel::ComboBoxPanel( PluginSelectorPanel*
m_configbutton[pid] = new wxButton( this, ButtonId_Configure, L"Configure..." ); m_configbutton[pid] = new wxButton( this, ButtonId_Configure, L"Configure..." );
m_configbutton[pid]->SetClientData( (void*)(int)pid ); m_configbutton[pid]->SetClientData( (void*)(int)pid );
s_plugin += text | wxSF.Border( wxTOP | wxLEFT, 2 ); s_plugin += text | pxBorder( wxTOP | wxLEFT, 2 );
s_plugin += m_combobox[pid] | wxSF.Expand(); s_plugin += m_combobox[pid] | pxExpand;
s_plugin += m_configbutton[pid]; s_plugin += m_configbutton[pid];
} while( ++pi, pi->shortname != NULL ); } while( ++pi, pi->shortname != NULL );
m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") ); m_FolderPicker.SetStaticDesc( _("Click the Browse button to select a different folder for PCSX2 plugins.") );
*this += s_plugin | wxSF.Expand(); *this += s_plugin | pxExpand;
*this += 6; *this += 6;
*this += m_FolderPicker | StdExpand(); *this += m_FolderPicker | StdExpand();
} }

View File

@ -58,19 +58,19 @@ Panels::FramelimiterPanel::FramelimiterPanel( wxWindow* parent )
s_spins += Text(_("Base Framerate Adjust:")); s_spins += Text(_("Base Framerate Adjust:"));
s_spins += 5; s_spins += 5;
s_spins += m_spin_NominalPct | wxSF.Border(wxTOP, 3); s_spins += m_spin_NominalPct | pxBorder(wxTOP, 3);
s_spins += Text(L"%" ); s_spins += Text(L"%" );
s_spins += 5; s_spins += 5;
s_spins += Text(_("Slow Motion Adjust:")); s_spins += Text(_("Slow Motion Adjust:"));
s_spins += 5; s_spins += 5;
s_spins += m_spin_SlomoPct | wxSF.Border(wxTOP, 3); s_spins += m_spin_SlomoPct | pxBorder(wxTOP, 3);
s_spins += Text(L"%" ); s_spins += Text(L"%" );
s_spins += 5; s_spins += 5;
s_spins += Text(_("Turbo Adjust:")); s_spins += Text(_("Turbo Adjust:"));
s_spins += 5; s_spins += 5;
s_spins += m_spin_TurboPct | wxSF.Border(wxTOP, 3); s_spins += m_spin_TurboPct | pxBorder(wxTOP, 3);
s_spins += Text(L"%" ); s_spins += Text(L"%" );
s_spins += 5; s_spins += 5;
@ -209,12 +209,12 @@ Panels::FrameSkipPanel::FrameSkipPanel( wxWindow* parent )
wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 4 ) ); wxFlexGridSizer& s_spins( *new wxFlexGridSizer( 4 ) );
//s_spins.AddGrowableCol( 0 ); //s_spins.AddGrowableCol( 0 );
s_spins += m_spin_FramesToDraw | wxSF.Border(wxTOP, 3); s_spins += m_spin_FramesToDraw | pxBorder(wxTOP, 3);
s_spins += 10; s_spins += 10;
s_spins += Text(_("Frames to Draw")); s_spins += Text(_("Frames to Draw"));
s_spins += 10; s_spins += 10;
s_spins += m_spin_FramesToSkip | wxSF.Border(wxTOP, 3); s_spins += m_spin_FramesToSkip | pxBorder(wxTOP, 3);
s_spins += 10; s_spins += 10;
s_spins += Text(_("Frames to Skip")); s_spins += Text(_("Frames to Skip"));
s_spins += 10; s_spins += 10;

View File

@ -1991,6 +1991,10 @@
RelativePath="..\..\gui\Dialogs\ConfirmationDialogs.cpp" RelativePath="..\..\gui\Dialogs\ConfirmationDialogs.cpp"
> >
</File> </File>
<File
RelativePath="..\..\gui\Dialogs\CreateMemoryCardDialog.cpp"
>
</File>
<File <File
RelativePath="..\..\gui\Dialogs\FirstTimeWizard.cpp" RelativePath="..\..\gui\Dialogs\FirstTimeWizard.cpp"
> >