move state compression into thread (#984)

This commit is contained in:
Logan McNaughton 2026-05-29 15:01:45 +02:00 committed by GitHub
parent 7379484932
commit 31420b6777
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,16 +80,19 @@ pub fn create_savestate(device: &device::Device) {
if let Ok(device_data) = postcard::to_stdvec(device)
&& let Ok(saves_data) = postcard::to_stdvec(&device.ui.storage.saves)
&& let Ok(compressed_file) = ui::storage::compress_file(&[
(&device_data, "device"),
(&saves_data, "saves"),
(&rdp_state, "rdp_state"),
(&ra_state, "ra_state"),
])
{
tokio::spawn(async move {
if let Err(e) = tokio::fs::write(save_path, compressed_file).await {
eprintln!("Error writing savestate: {}", e);
if let Ok(compressed_file) = ui::storage::compress_file(&[
(&device_data, "device"),
(&saves_data, "saves"),
(&rdp_state, "rdp_state"),
(&ra_state, "ra_state"),
]) {
if let Err(e) = tokio::fs::write(save_path, compressed_file).await {
eprintln!("Error writing savestate: {}", e);
}
} else {
eprintln!("Error compressing savestate");
}
});
ui::video::onscreen_message(