static void DoState(PointerWrap &p) { u32 version = STATE_VERSION; { static const u32 COOKIE_BASE = 0xBAADBABE; u32 cookie = version + COOKIE_BASE; p.Do(cookie); version = cookie - COOKIE_BASE; } if (version != STATE_VERSION) { // if the version doesn't match, fail. // this will trigger a message like "Can't load state from other revisions" // we could use the version numbers to maintain some level of backward compatibility, but currently don't. p.SetMode(PointerWrap::MODE_MEASURE); return; } p.DoMarker("Version"); // Begin with video backend, so that it gets a chance to clear it's caches and writeback modified things to RAM g_video_backend->DoState(p); p.DoMarker("video_backend"); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) Wiimote::DoState(p.GetPPtr(), p.GetMode()); p.DoMarker("Wiimote"); PowerPC::DoState(p); p.DoMarker("PowerPC"); HW::DoState(p); p.DoMarker("HW"); CoreTiming::DoState(p); p.DoMarker("CoreTiming"); Movie::DoState(p); p.DoMarker("Movie"); #if defined(HAVE_LIBAV) || defined (WIN32) AVIDump::DoState(); #endif }
static std::string DoState(PointerWrap& p) { u32 version = STATE_VERSION; { static const u32 COOKIE_BASE = 0xBAADBABE; u32 cookie = version + COOKIE_BASE; p.Do(cookie); version = cookie - COOKIE_BASE; } std::string version_created_by = scm_rev_str; if (version > 42) p.Do(version_created_by); else version_created_by.clear(); if (version != STATE_VERSION) { if (version_created_by.empty() && s_old_versions.count(version)) { // The savestate is from an old version that doesn't // save the Dolphin version number to savestates, but // by looking up the savestate version number, it is possible // to know approximately which Dolphin version was used. std::pair<std::string, std::string> version_range = s_old_versions.find(version)->second; std::string oldest_version = version_range.first; std::string newest_version = version_range.second; version_created_by = "Dolphin " + oldest_version + " - " + newest_version; } // because the version doesn't match, fail. // this will trigger an OSD message like "Can't load state from other revisions" // we could use the version numbers to maintain some level of backward compatibility, but currently don't. p.SetMode(PointerWrap::MODE_MEASURE); return version_created_by; } p.DoMarker("Version"); // Begin with video backend, so that it gets a chance to clear its caches and writeback modified things to RAM g_video_backend->DoState(p); p.DoMarker("video_backend"); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) Wiimote::DoState(p.GetPPtr(), p.GetMode()); p.DoMarker("Wiimote"); PowerPC::DoState(p); p.DoMarker("PowerPC"); HW::DoState(p); p.DoMarker("HW"); CoreTiming::DoState(p); p.DoMarker("CoreTiming"); Movie::DoState(p); p.DoMarker("Movie"); #if defined(HAVE_LIBAV) || defined (WIN32) AVIDump::DoState(); #endif return version_created_by; }