/[pcsx2_0.9.7]/trunk/pcsx2/SaveState.cpp
ViewVC logotype

Diff of /trunk/pcsx2/SaveState.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/pcsx2/SaveState.cpp	2010/09/07 03:24:11	31
+++ trunk/pcsx2/SaveState.cpp	2010/09/07 11:08:22	62
@@ -24,6 +24,9 @@
 #include "AppConfig.h"
 
 #include "Elfheader.h"
+#include "Counters.h"
+
+#include "Utilities/SafeArray.inl"
 
 using namespace R5900;
 
@@ -38,6 +41,8 @@
 	memzero(pCache);
 //	WriteCP0Status(cpuRegs.CP0.n.Status.val);
 	for(int i=0; i<48; i++) MapTLB(i);
+
+	UpdateVSyncRate();
 }
 
 wxString SaveStateBase::GetFilename( int slot )
@@ -91,11 +96,9 @@
 
 	if( strcmp( m_tagspace, src ) != 0 )
 	{
-		pxFail( "Savestate data corruption detected while reading tag" );
-		throw Exception::SaveStateLoadError(
-			// Untranslated diagnostic msg (use default msg for translation)
-			L"Savestate data corruption detected while reading tag: " + fromUTF8(src)
-		);
+		wxString msg( L"Savestate data corruption detected while reading tag: " + fromUTF8(src) );
+		pxFail( msg );
+		throw Exception::SaveStateLoadError().SetDiagMsg(msg);
 	}
 }
 
@@ -111,8 +114,9 @@
 	memzero( descin );
 	memzero( desccmp );
 
-	memcpy_fast( descin, descout.ToUTF8().data(), descout.Length() );
-	memcpy_fast( desccmp, descout.ToUTF8().data(), descout.Length() );
+	pxToUTF8 utf8(descout);
+	memcpy_fast( descin, utf8, utf8.Length() );
+	memcpy_fast( desccmp, utf8, utf8.Length() );
 
 	// ... and only freeze bios info once per state, since the user msg could
 	// become really annoying on a corrupted state or something.  (have to always
@@ -130,7 +134,7 @@
 			Console.Indent(2).Error(
 				"Current Version:   %s\n"
 				"Savestate Version: %s\n",
-				descout.ToUTF8().data(), descin
+				utf8.data(), descin
 			);
 		}
 	}
@@ -148,9 +152,9 @@
 
 	// First Block - Memory Dumps
 	// ---------------------------
-	FreezeMem(PS2MEM_BASE,		Ps2MemSize::Base);		// 32 MB main memory
-	FreezeMem(PS2MEM_SCRATCH,	Ps2MemSize::Scratch);	// scratch pad
-	FreezeMem(PS2MEM_HW,		Ps2MemSize::Hardware);	// hardware memory
+	FreezeMem(eeMem->Main,		Ps2MemSize::Base);		// 32 MB main memory
+	FreezeMem(eeMem->Scratch,	Ps2MemSize::Scratch);	// scratch pad
+	FreezeMem(eeHw,		Ps2MemSize::Hardware);	// hardware memory
 
 	FreezeMem(psxM, Ps2MemSize::IopRam);		// 2 MB main memory
 	FreezeMem(psxH, Ps2MemSize::IopHardware);	// hardware memory
@@ -175,8 +179,8 @@
 	FreezeTag( "Cycles" );
 	Freeze(EEsCycle);
 	Freeze(EEoCycle);
-	Freeze(g_nextBranchCycle);
-	Freeze(g_psxNextBranchCycle);
+	Freeze(g_nextEventCycle);
+	Freeze(g_iopNextEventCycle);
 	Freeze(s_iLastCOP0Cycle);
 	Freeze(s_iLastPERFCycle);
 
@@ -190,6 +194,7 @@
 	vif1Freeze();
 	sifFreeze();
 	ipuFreeze();
+	ipuDmaFreeze();
 	gifFreeze();
 	sprFreeze();
 
@@ -225,10 +230,9 @@
 	{
 		if( sectlen != realsectsize )		// if they don't match then we have a problem, jim.
 		{
-			throw Exception::SaveStateLoadError( wxEmptyString,
-				wxsFormat( L"Invalid size encountered on section '%s'.", sectname ),
-				_("The savestate data is invalid or corrupted.")
-			);
+			throw Exception::SaveStateLoadError()
+				.SetDiagMsg(wxsFormat(L"Invalid size encountered on section '%s'.", sectname ))
+				.SetUserMsg(_("The savestate data is invalid or corrupted."));
 		}
 	}
 }
@@ -254,10 +258,9 @@
 
 			if( sectlen != 128 )
 			{
-				throw Exception::SaveStateLoadError( wxEmptyString,
-					L"Invalid size encountered on BiosVersion section.",
-					_("The savestate data is invalid or corrupted.")
-				);
+				throw Exception::SaveStateLoadError()
+					.SetDiagMsg(L"Invalid size encountered on BiosVersion section.")
+					.SetUserMsg(_("The savestate data is invalid or corrupted."));
 			}
 
 			if( isSeeking )
@@ -277,10 +280,9 @@
 			Freeze( sectlen );
 			if( sectlen != MainMemorySizeInBytes )
 			{
-				throw Exception::SaveStateLoadError( wxEmptyString,
-					L"Invalid size encountered on MainMemory section.",
-					_("The savestate data is invalid or corrupted.")
-				);
+				throw Exception::SaveStateLoadError()
+					.SetDiagMsg(L"Invalid size encountered on MainMemory section.")
+					.SetUserMsg(_("The savestate data is invalid or corrupted."));
 			}
 
 			if( isSeeking )

 

  ViewVC Help
Powered by ViewVC 1.1.22