MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / Reset

Method Reset

pcsx2/VMManager.cpp:1763–1815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1761}
1762
1763void VMManager::Reset()
1764{
1765 pxAssert(HasValidVM());
1766
1767 // If we're running, we're probably going to be executing this at event test time,
1768 // at vsync, which happens in the middle of event handling. Resetting everything
1769 // immediately here is a bad idea (tm), in fact, it breaks some games (e.g. TC:NYC).
1770 // So, instead, we tell the rec to exit execution, _then_ reset. Paused is fine here,
1771 // since the rec won't be running, so it's safe to immediately reset there.
1772 if (s_state.load(std::memory_order_acquire) == VMState::Running)
1773 {
1774 s_state.store(VMState::Resetting, std::memory_order_release);
1775 return;
1776 }
1777
1778 if (!Achievements::ConfirmSystemReset())
1779 return;
1780
1781 // Re-enforce hardcode mode constraints if we're now enabling it.
1782 if (!GSDumpReplayer::IsReplayingDump() && Achievements::ResetHardcoreMode(false))
1783 ApplySettings();
1784
1785 vu1Thread.WaitVU();
1786 vu1Thread.Reset();
1787 MTGS::WaitGS();
1788
1789 const bool elf_was_changed = (s_current_crc != 0);
1790 ClearELFInfo();
1791 if (elf_was_changed)
1792 HandleELFChange(false);
1793
1794 Achievements::ResetClient();
1795
1796 mmap_ResetBlockTracking();
1797 memSetExtraMemMode(EmuConfig.Cpu.ExtraMemory);
1798 Internal::ClearCPUExecutionCaches();
1799 memBindConditionalHandlers();
1800 SysMemory::Reset();
1801 cpuReset();
1802 hwReset();
1803
1804 if (g_InputRecording.isActive())
1805 {
1806 g_InputRecording.handleReset();
1807 MTGS::PresentCurrentFrame();
1808 }
1809
1810 ResetFrameLimiter();
1811
1812 // If we were paused, state won't be resetting, so don't flip back to running.
1813 if (s_state.load(std::memory_order_acquire) == VMState::Resetting)
1814 s_state.store(VMState::Running, std::memory_order_release);
1815}
1816
1817bool SaveStateBase::vmFreeze()
1818{

Callers 1

Calls 10

mmap_ResetBlockTrackingFunction · 0.85
memSetExtraMemModeFunction · 0.85
ResetFunction · 0.85
cpuResetFunction · 0.85
hwResetFunction · 0.85
WaitVUMethod · 0.80
isActiveMethod · 0.80
handleResetMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected