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

Method SaveStateToSlot

pcsx2/VMManager.cpp:2131–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129}
2130
2131void VMManager::SaveStateToSlot(s32 slot, bool zip_on_thread, std::function<void(const std::string&)> error_callback)
2132{
2133 const std::string filename(GetCurrentSaveStateFileName(slot));
2134 if (filename.empty())
2135 {
2136 error_callback(TRANSLATE_STR("VMManager", "Cannot generate filename for save state."));
2137 return;
2138 }
2139
2140 if (MemcardBusy::IsBusy())
2141 {
2142 error_callback(TRANSLATE_STR("VMManager",
2143 "The memory card is busy, so the state save operation has been cancelled to prevent data loss."));
2144 return;
2145 }
2146
2147 // if it takes more than a minute.. well.. wtf.
2148 Host::AddIconOSDMessage(fmt::format("SaveStateSlot{}", slot), ICON_FA_FLOPPY_DISK,
2149 fmt::format(TRANSLATE_FS("VMManager", "Saving state to slot {}..."), slot), 60.0f);
2150
2151 auto callback = [error_callback = std::move(error_callback), slot](const std::string& error) {
2152 Host::RemoveKeyedOSDMessage(fmt::format("SaveStateSlot{}", slot));
2153 error_callback(error);
2154 };
2155
2156 return DoSaveState(
2157 filename.c_str(), slot, zip_on_thread, EmuConfig.BackupSavestate, std::move(callback));
2158}
2159
2160LimiterModeType VMManager::GetLimiterMode()
2161{

Callers

nothing calls this directly

Calls 4

error_callbackFunction · 0.85
formatFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected