// Run from the CPU thread void VideoBackendHardware::DoState(PointerWrap& p) { bool software = false; p.Do(software); if (p.GetMode() == PointerWrap::MODE_READ && software == true) { // change mode to abort load of incompatible save state. p.SetMode(PointerWrap::MODE_VERIFY); } VideoCommon_DoState(p); p.DoMarker("VideoCommon"); p.Do(s_beginFieldArgs); p.DoMarker("VideoBackendHardware"); // Refresh state. if (p.GetMode() == PointerWrap::MODE_READ) { m_invalid = true; // Clear all caches that touch RAM // (? these don't appear to touch any emulation state that gets saved. moved to on load only.) VertexLoaderManager::MarkAllDirty(); } }
void DSPLLE::DoState(PointerWrap &p) { bool isHLE = false; p.Do(isHLE); if (isHLE != false && p.GetMode() == PointerWrap::MODE_READ) { Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } p.Do(g_dsp.r); p.Do(g_dsp.pc); #if PROFILE p.Do(g_dsp.err_pc); #endif p.Do(g_dsp.cr); p.Do(g_dsp.reg_stack_ptr); p.Do(g_dsp.exceptions); p.Do(g_dsp.external_interrupt_waiting); for (int i = 0; i < 4; i++) { p.Do(g_dsp.reg_stack[i]); } p.Do(g_dsp.step_counter); p.Do(g_dsp.ifx_regs); p.Do(g_dsp.mbox[0]); p.Do(g_dsp.mbox[1]); UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); p.DoArray(g_dsp.iram, DSP_IRAM_SIZE); WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); if (p.GetMode() == PointerWrap::MODE_READ) DSPHost::CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE); p.DoArray(g_dsp.dram, DSP_DRAM_SIZE); p.Do(cyclesLeft); p.Do(init_hax); p.Do(m_cycle_count); bool prevInitMixer = m_InitMixer; p.Do(m_InitMixer); if (prevInitMixer != m_InitMixer && p.GetMode() == PointerWrap::MODE_READ) { if (m_InitMixer) { InitMixer(); AudioCommon::PauseAndLock(true); } else { AudioCommon::PauseAndLock(false); soundStream->Stop(); delete soundStream; soundStream = nullptr; } } }
static std::string DoState(PointerWrap& p) { std::string version_created_by; if (!DoStateVersion(p, &version_created_by)) { // 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; } // 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().bWii) Wiimote::DoState(p); p.DoMarker("Wiimote"); PowerPC::DoState(p); p.DoMarker("PowerPC"); // CoreTiming needs to be restored before restoring Hardware because // the controller code might need to schedule an event if the controller has changed. CoreTiming::DoState(p); p.DoMarker("CoreTiming"); HW::DoState(p); p.DoMarker("HW"); Movie::DoState(p); p.DoMarker("Movie"); Gecko::DoState(p); p.DoMarker("Gecko"); #if defined(HAVE_LIBAV) || defined(_WIN32) AVIDump::DoState(); #endif return version_created_by; }
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 }
void DSPLLE::DoState(PointerWrap &p) { bool is_hle = false; p.Do(is_hle); if (is_hle && p.GetMode() == PointerWrap::MODE_READ) { Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } p.Do(g_dsp.r); p.Do(g_dsp.pc); #if PROFILE p.Do(g_dsp.err_pc); #endif p.Do(g_dsp.cr); p.Do(g_dsp.reg_stack_ptr); p.Do(g_dsp.exceptions); p.Do(g_dsp.external_interrupt_waiting); for (int i = 0; i < 4; i++) { p.Do(g_dsp.reg_stack[i]); } p.Do(g_dsp.step_counter); p.DoArray(g_dsp.ifx_regs); p.Do(g_dsp.mbox[0]); p.Do(g_dsp.mbox[1]); UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); p.DoArray(g_dsp.iram, DSP_IRAM_SIZE); WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); if (p.GetMode() == PointerWrap::MODE_READ) DSPHost::CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE); p.DoArray(g_dsp.dram, DSP_DRAM_SIZE); p.Do(g_cycles_left); p.Do(g_init_hax); p.Do(m_cycle_count); }
void CWII_IPC_HLE_WiiMote::DoState(PointerWrap& p) { bool passthrough_bluetooth = false; p.Do(passthrough_bluetooth); if (passthrough_bluetooth && p.GetMode() == PointerWrap::MODE_READ) { Core::DisplayMessage("State needs Bluetooth passthrough to be enabled. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } // this function is usually not called... see CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState p.Do(m_ConnectionState); p.Do(m_HIDControlChannel_Connected); p.Do(m_HIDControlChannel_ConnectedWait); p.Do(m_HIDControlChannel_Config); p.Do(m_HIDControlChannel_ConfigWait); p.Do(m_HIDInterruptChannel_Connected); p.Do(m_HIDInterruptChannel_ConnectedWait); p.Do(m_HIDInterruptChannel_Config); p.Do(m_HIDInterruptChannel_ConfigWait); p.Do(m_BD); p.Do(m_ConnectionHandle); p.Do(uclass); p.Do(features); p.Do(lmp_version); p.Do(lmp_subversion); p.Do(m_LinkKey); p.Do(m_Name); p.Do(m_Channel); }
void DSPHLE::DoState(PointerWrap &p) { bool isHLE = true; p.Do(isHLE); if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ) { Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } p.DoPOD(m_DSPControl); p.DoPOD(m_dspState); int ucode_crc = UCodeInterface::GetCRC(m_pUCode); int ucode_crc_beforeLoad = ucode_crc; int lastucode_crc = UCodeInterface::GetCRC(m_lastUCode); int lastucode_crc_beforeLoad = lastucode_crc; p.Do(ucode_crc); p.Do(lastucode_crc); // if a different type of ucode was being used when the savestate was created, // we have to reconstruct the old type of ucode so that we have a valid thing to call DoState on. UCodeInterface* ucode = (ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory( ucode_crc, this, m_bWii); UCodeInterface* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ? m_lastUCode : UCodeFactory(lastucode_crc, this, m_bWii); if (ucode) ucode->DoState(p); if (lastucode) lastucode->DoState(p); // if a different type of ucode was being used when the savestate was created, // discard it if we're not loading, otherwise discard the old one and keep the new one. if (ucode != m_pUCode) { if (p.GetMode() != PointerWrap::MODE_READ) { delete ucode; } else { delete m_pUCode; m_pUCode = ucode; } } if (lastucode != m_lastUCode) { if (p.GetMode() != PointerWrap::MODE_READ) { delete lastucode; } else { delete m_lastUCode; m_lastUCode = lastucode; } } m_MailHandler.DoState(p); }
void BluetoothStub::DoState(PointerWrap& p) { Core::DisplayMessage("The current IPC_HLE_Device_usb is a stub. Aborting load.", 4000); p.SetMode(PointerWrap::MODE_VERIFY); }
void DSPHLE::DoState(PointerWrap &p) { bool isHLE = true; p.Do(isHLE); if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ) { p.message.append("Audio: LLE"); Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } bool prevInitMixer = m_InitMixer; p.Do(m_InitMixer); if (prevInitMixer != m_InitMixer && p.GetMode() == PointerWrap::MODE_READ) { if (m_InitMixer) { InitMixer(); AudioCommon::PauseAndLock(true); } else { AudioCommon::PauseAndLock(false); soundStream->Stop(); delete soundStream; soundStream = NULL; } } p.DoPOD(m_DSPControl); p.DoPOD(m_dspState); int ucode_crc = IUCode::GetCRC(m_pUCode); int ucode_crc_beforeLoad = ucode_crc; int lastucode_crc = IUCode::GetCRC(m_lastUCode); int lastucode_crc_beforeLoad = lastucode_crc; p.Do(ucode_crc); p.Do(lastucode_crc); // if a different type of ucode was being used when the savestate was created, // we have to reconstruct the old type of ucode so that we have a valid thing to call DoState on. IUCode* ucode = (ucode_crc == ucode_crc_beforeLoad) ? m_pUCode : UCodeFactory( ucode_crc, this, m_bWii); IUCode* lastucode = (lastucode_crc != lastucode_crc_beforeLoad) ? m_lastUCode : UCodeFactory(lastucode_crc, this, m_bWii); if (ucode) ucode->DoState(p); if (lastucode) lastucode->DoState(p); // if a different type of ucode was being used when the savestate was created, // discard it if we're not loading, otherwise discard the old one and keep the new one. if (ucode != m_pUCode) { if (p.GetMode() != PointerWrap::MODE_READ) { delete ucode; } else { delete m_pUCode; m_pUCode = ucode; } } if (lastucode != m_lastUCode) { if (p.GetMode() != PointerWrap::MODE_READ) { delete lastucode; } else { delete m_lastUCode; m_lastUCode = lastucode; } } m_MailHandler.DoState(p); }
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; }