| 2129 | } |
| 2130 | |
| 2131 | void 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 | |
| 2160 | LimiterModeType VMManager::GetLimiterMode() |
| 2161 | { |
nothing calls this directly
no test coverage detected