New option to backup the old, existing savestate when creating a new one.

Hopefully not too buggy :p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4042 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-11-21 12:35:59 +00:00
parent 941bc36f24
commit f99ca6f4f6
5 changed files with 26 additions and 7 deletions

View File

@ -400,7 +400,7 @@ struct Pcsx2Config
// when enabled uses BOOT2 injection, skipping sony bios splashes
UseBOOT2Injection :1,
BackupSavestate :1,
// enables simulated ejection of memory cards when loading savestates
McdEnableEjection :1,

View File

@ -374,6 +374,7 @@ void Pcsx2Config::LoadSave( IniInterface& ini )
IniBitBool( ConsoleToStdio );
IniBitBool( HostFs );
IniBitBool( BackupSavestate );
IniBitBool( McdEnableEjection );
IniBitBool( MultitapPort0_Enabled );
IniBitBool( MultitapPort1_Enabled );

View File

@ -44,6 +44,8 @@ Panels::McdConfigPanel_Toggles::McdConfigPanel_Toggles(wxWindow *parent)
)
);
m_check_SavestateBackup = new pxCheckBox( this, pxsFmt(_("Backup existing Savestate when creating a new one")) );
for( uint i=0; i<2; ++i )
{
m_check_Multitap[i] = new pxCheckBox( this, pxsFmt(_("Enable Multitap on Port %u"), i+1) );
@ -60,23 +62,29 @@ Panels::McdConfigPanel_Toggles::McdConfigPanel_Toggles(wxWindow *parent)
*this += 4;
*this += m_check_SavestateBackup;
*this += 4;
*this += m_check_Ejection;
}
void Panels::McdConfigPanel_Toggles::Apply()
{
g_Conf->EmuOptions.MultitapPort0_Enabled = m_check_Multitap[0]->GetValue();
g_Conf->EmuOptions.MultitapPort1_Enabled = m_check_Multitap[1]->GetValue();
g_Conf->EmuOptions.MultitapPort0_Enabled = m_check_Multitap[0]->GetValue();
g_Conf->EmuOptions.MultitapPort1_Enabled = m_check_Multitap[1]->GetValue();
g_Conf->EmuOptions.McdEnableEjection = m_check_Ejection->GetValue();
g_Conf->EmuOptions.BackupSavestate = m_check_SavestateBackup->GetValue();
g_Conf->EmuOptions.McdEnableEjection = m_check_Ejection->GetValue();
}
void Panels::McdConfigPanel_Toggles::AppStatusEvent_OnSettingsApplied()
{
m_check_Multitap[0] ->SetValue( g_Conf->EmuOptions.MultitapPort0_Enabled );
m_check_Multitap[1] ->SetValue( g_Conf->EmuOptions.MultitapPort1_Enabled );
m_check_Multitap[0] ->SetValue( g_Conf->EmuOptions.MultitapPort0_Enabled );
m_check_Multitap[1] ->SetValue( g_Conf->EmuOptions.MultitapPort1_Enabled );
m_check_Ejection ->SetValue( g_Conf->EmuOptions.McdEnableEjection );
m_check_SavestateBackup ->SetValue( g_Conf->EmuOptions.BackupSavestate );
m_check_Ejection ->SetValue( g_Conf->EmuOptions.McdEnableEjection );
}

View File

@ -231,6 +231,7 @@ namespace Panels
protected:
pxCheckBox* m_check_Multitap[2];
pxCheckBox* m_check_Ejection;
pxCheckBox* m_check_SavestateBackup;
public:
McdConfigPanel_Toggles( wxWindow* parent );

View File

@ -336,6 +336,15 @@ void StateCopy_SaveToSlot( uint num )
{
const wxString file( SaveStateBase::GetFilename( num ) );
// Backup old Savestate if one exists.
if( wxFileExists( file ) && EmuConfig.BackupSavestate )
{
const wxString copy( SaveStateBase::GetFilename( num ) + pxsFmt( L".backup") );
Console.Indent().WriteLn( Color_StrongGreen, L"Backing up existing state in slot %d.", num);
wxCopyFile( file, copy );
}
Console.WriteLn( Color_StrongGreen, "Saving savestate to slot %d...", num );
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", file.c_str() );