Fixed a couple bugs in memorycard ejection logic, and a nasty crash bug for anyone who had the old CWD mode enabled.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3086 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-05-26 23:06:31 +00:00
parent c1d8a3e94c
commit d75664e1b2
6 changed files with 30 additions and 15 deletions

View File

@ -264,6 +264,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini )
Pcsx2Config::Pcsx2Config()
{
bitset = 0;
McdEnableEjection = true;
}
void Pcsx2Config::LoadSave( IniInterface& ini )

View File

@ -715,7 +715,7 @@ void SaveStateBase::sioFreeze()
for( uint port=0; port<2; ++port )
//for( uint slot=0; slot<4; ++slot )
{
const int slot = 0; // see above comment about multitap slowness
const uint slot = 0; // see above comment about multitap slowness
m_mcdCRCs[port][slot] = SysPlugins.McdGetCRC( port, slot );
}
}
@ -737,10 +737,10 @@ void SaveStateBase::sioFreeze()
// it has a "rule" that the memcard should never be ejected during a song. So by
// ejecting it, the game freezes (which is actually good emulation, but annoying!)
for( int port=0; port<2; ++port )
for( uint port=0; port<2; ++port )
//for( int slot=0; slot<4; ++slot )
{
const int slot = 0; // see above comment about multitap slowness
const uint slot = 0; // see above comment about multitap slowness
u64 newCRC = SysPlugins.McdGetCRC( port, slot );
if( newCRC != m_mcdCRCs[port][slot] )
{

View File

@ -359,7 +359,6 @@ AppConfig::AppConfig()
#ifdef __WXMSW__
McdCompressNTFS = true;
#endif
McdEnableEjection = true;
EnableSpeedHacks = false;
EnableGameFixes = false;
@ -390,14 +389,30 @@ void AppConfig::LoadSaveUserMode( IniInterface& ini, const wxString& cwdhash )
static const wxChar* DocsFolderModeNames[] =
{
L"User",
L"CWD",
L"Custom",
};
if( ini.IsLoading() )
{
// HACK! When I removed the CWD option, the option became the cause of bad
// crashes. This detects presence of CWD, and replaces it with a custom mode
// that points to the CWD.
//
// The ini contents are rewritten and the CWD is removed. So after 0.9.7 is released,
// this code is ok to be deleted/removed. :) --air
wxString oldmode( ini.GetConfig().Read( L"DocumentsFolderMode", L"User" ) );
if( oldmode == L"CWD")
{
ini.GetConfig().Write( L"DocumentsFolderMode", L"Custom" );
ini.GetConfig().Write( L"CustomDocumentsFolder", Path::Normalize(wxGetCwd()) );
}
}
ini.EnumEntry( L"DocumentsFolderMode", DocsFolderMode, DocsFolderModeNames, DocsFolder_User );
ini.Entry( L"UseDefaultSettingsFolder", UseDefaultSettingsFolder, true );
ini.Entry( L"CustomDocumentsFolder", CustomDocumentsFolder, wxDirName() );
ini.Entry( L"CustomDocumentsFolder", CustomDocumentsFolder, (wxDirName)Path::Normalize(wxGetCwd()) );
ini.Entry( L"SettingsFolder", SettingsFolder, PathDefs::GetSettings() );
ini.Flush();
@ -453,7 +468,6 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini )
#ifdef __WXMSW__
IniEntry( McdCompressNTFS );
#endif
IniEntry( McdEnableEjection );
ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource );
}

View File

@ -210,9 +210,6 @@ public:
bool McdCompressNTFS;
#endif
// Force-ejects modified memory cards when loading savestates (avoids corruption)
bool McdEnableEjection;
// Master toggle for enabling or disabling all speedhacks in one fail-free swoop.
// (the toggle is applied when a new EmuConfig is sent through AppCoreThread::ApplySettings)
bool EnableSpeedHacks;

View File

@ -91,7 +91,7 @@ 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->McdEnableEjection = m_check_Ejection->GetValue();
g_Conf->EmuOptions.McdEnableEjection = m_check_Ejection->GetValue();
#ifdef __WXMSW__
g_Conf->McdCompressNTFS = m_check_CompressNTFS->GetValue();
#endif
@ -102,7 +102,8 @@ 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_Ejection ->SetValue( g_Conf->McdEnableEjection );
m_check_Ejection ->SetValue( g_Conf->EmuOptions.McdEnableEjection );
#ifdef __WXMSW__
m_check_CompressNTFS->SetValue( g_Conf->McdCompressNTFS );
#endif

View File

@ -37,7 +37,7 @@ struct Component_FileMcd;
static const int MCD_SIZE = 1024 * 8 * 16; // Legacy PSX card default size
static const int MC2_MBSIZE = 1024 * 528 * 2; // Size of a single megabyte of card data
static const int MC2_SIZE = MC2_SIZE * 8; // PS2 card default size (8MB)
static const int MC2_SIZE = MC2_MBSIZE * 8; // PS2 card default size (8MB)
// --------------------------------------------------------------------------------------
// FileMemoryCard
@ -326,8 +326,10 @@ u64 FileMemoryCard::GetCRC( uint slot )
// Process the file in 4k chunks. Speeds things up significantly.
u64 retval = 0;
u64 buffer[0x1000];
for( uint i=MC2_SIZE/sizeof(buffer); i; --i )
u64 buffer[528*8]; // use 528 (sector size), ensures even divisibility
const uint filesize = mcfp.Length() / sizeof(buffer);
for( uint i=filesize; i; --i )
{
mcfp.Read( &buffer, sizeof(buffer) );
for( uint t=0; t<ArraySize(buffer); ++t )