diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 024e7098b3..c0a1c59fa6 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -264,6 +264,7 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini ) Pcsx2Config::Pcsx2Config() { bitset = 0; + McdEnableEjection = true; } void Pcsx2Config::LoadSave( IniInterface& ini ) diff --git a/pcsx2/Sio.cpp b/pcsx2/Sio.cpp index 6d13a8b432..a1fdc99a68 100644 --- a/pcsx2/Sio.cpp +++ b/pcsx2/Sio.cpp @@ -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] ) { diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 9a4cec37ea..3ce0010364 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -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 ); } diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 71def9233d..7e6ff83532 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -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; diff --git a/pcsx2/gui/Dialogs/McdConfigDialog.cpp b/pcsx2/gui/Dialogs/McdConfigDialog.cpp index 93c2cee206..400f2a1397 100644 --- a/pcsx2/gui/Dialogs/McdConfigDialog.cpp +++ b/pcsx2/gui/Dialogs/McdConfigDialog.cpp @@ -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 diff --git a/pcsx2/gui/MemoryCardFile.cpp b/pcsx2/gui/MemoryCardFile.cpp index bcde047ea4..8ee1cf26cd 100644 --- a/pcsx2/gui/MemoryCardFile.cpp +++ b/pcsx2/gui/MemoryCardFile.cpp @@ -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