Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c19dbb2
A cloud save badge under Play says where a game's saves stand
Xarishark Nov 19, 2026
7d2d4a3
Big Picture: the cloud save badge beside Play
Xarishark Nov 19, 2026
3738d3e
The cloud save status sits above Play as a coloured line, not a button
Xarishark Nov 19, 2026
41a3311
Which save to keep: the two saves are the choices, and the newer one …
Xarishark Nov 19, 2026
167261d
Big Picture: the cloud save choice has a cloud, not a tick
Xarishark Nov 19, 2026
eb77cf4
Choose a save's tooltip says Play settles it too, not only Sync Now
Xarishark Nov 19, 2026
009c254
Choose a save says how on the line itself: press Play to pick
Xarishark Nov 19, 2026
99555cd
A save folder its developer or RecompLauncher named comes before one …
Xarishark Nov 19, 2026
f93e890
Cloud saves can be deleted from the launcher, and the core says whose…
Xarishark Nov 19, 2026
89c8272
The Saves tab, rebuilt: its status first, every save in one history, …
Xarishark Nov 19, 2026
e7dfcd3
Syncs after you play stays until the save is copied, and a session th…
Xarishark Nov 19, 2026
b22fd8c
Which save: this PC's is dated by its first copy, so a restored older…
Xarishark Nov 19, 2026
2e843f7
Merge #319's fixes: Syncs after you play until the save is copied, an…
Xarishark Nov 19, 2026
b826c40
No dead ends: the step after a game closes, and a session finished at…
Xarishark Nov 19, 2026
d71681f
Any copy of the save ends the wait, so Waiting to upload can't outliv…
Xarishark Nov 19, 2026
1e53a48
Merge #319's fix: any copy of the save ends the wait
Xarishark Nov 19, 2026
e26b97e
The copy after a session is only called a sync for a game that syncs
Xarishark Nov 19, 2026
f05d8e6
Merge #319's fix: the copy after a session is only called a sync for …
Xarishark Nov 19, 2026
c2def19
A game with no known save folder keeps saying so after a session
Xarishark Nov 19, 2026
786f5d1
Merge main now that #319 is in
Xarishark Nov 19, 2026
e989c08
Merge main: the Updates tab drawers (#323) and the shader tag (#325)
Xarishark Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/LAUNCHER-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ was signed out (from the account page, or the account is gone): the launcher for
| `POST ?a=save-delete` | `{"game", "v"}` |
| `POST ?a=signout` | This PC's token stops working |

The website keeps the newest five copies per game and 150 MB per account, refuses game files,
The website keeps the newest five copies per game and 300 MB per account, refuses game files,
programs and archives inside a copy, and doesn't keep a copy whose `hash` matches the newest one.

`hash` is the checksum of the whole set of save files (see `saves::set_hash`), so two PCs with the
Expand Down
83 changes: 76 additions & 7 deletions src-tauri/src/cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! of PCs, so one can be signed out from there. No password ever passes through the launcher.
//!
//! Cloud saves: after each session a game's new save copy (saves.rs) goes up to the account, which
//! keeps the newest five per game, up to 150 MB in all. Before a game starts, a newer copy from
//! keeps the newest five per game, up to 300 MB in all. Before a game starts, a newer copy from
//! another PC is put in place first; if both changed, the player picks. docs/LAUNCHER-API.md has the
//! website's side.

Expand Down Expand Up @@ -143,7 +143,8 @@ fn save_url(action: &str) -> String {
/// (When it said so, the size of the copy it refused.)
static FULL: Mutex<Option<(std::time::Instant, u64)>> = Mutex::new(None);
static FULL_TOLD: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
const FULL_TEXT: &str = "Your cloud saves are full (150 MB). Remove old cloud copies to make room; your saves stay on this PC.";
// No size here: the site sets it (300 MB now) and says it in its own answer.
const FULL_TEXT: &str = "Your cloud saves are full. The newest save of each game is always kept, so make room by deleting another game's cloud saves on your account page at recomplauncher.com. Your saves stay on this PC.";
const FULL_REST: std::time::Duration = std::time::Duration::from_secs(3600);

fn full_now() -> bool {
Expand Down Expand Up @@ -476,13 +477,24 @@ pub fn spots_of(st: &App, id: &str, g: &Installed) -> Vec<Spot> {
let mut g = g.clone();
g.save_place = Default::default();
g.more_save_places.clear();
return saves::spots(&p.game.saves, &[], &g);
return named_spots(p.game.saves, vec![], &g);
}
let cat = crate::cached_catalog(st);
let entry = catalog::app(&cat, id).cloned().unwrap_or(Value::Null);
let dev = crate::profile::find(&g.path, &g.repo, &entry).map(|p| p.saves).unwrap_or_default();
let profile_saves = crate::profile::find(&g.path, &g.repo, &entry).map(|p| p.saves).unwrap_or_default();
let from_cat: Vec<String> = entry.get("saves").and_then(Value::as_array).map(|a| a.iter().filter_map(|x| x.as_str().map(String::from)).collect()).unwrap_or_default();
saves::spots(&dev, &from_cat, g)
named_spots(profile_saves, from_cat, g)
}

/// The save folders a profile names are the developer's only when the profile came with the
/// game's own release. One RecompLauncher keeps for the game (in the catalog, or built into the
/// launcher) is ours, and the Saves tab says so: "Set by RecompLauncher".
fn named_spots(profile_saves: Vec<String>, from_cat: Vec<String>, g: &Installed) -> Vec<Spot> {
let developers = crate::profile::release_profile(&g.path).is_some();
if developers || profile_saves.is_empty() {
return saves::spots(&profile_saves, &from_cat, g);
}
saves::spots(&[], &profile_saves, g)
}

/// Nobody (the player, the developer or the catalog) has said where the game saves. A fixed text,
Expand Down Expand Up @@ -1237,6 +1249,9 @@ pub async fn saves_info(app: AppHandle, id: String) -> Res<Value> {
"spots": spots, "local": local, "cloud": cloud, "space": space, "offline": offline,
"cloudOn": g.cloud, "signedIn": signed_in(&st.dir), "synced": state.synced_hash, "pending": state.pending.is_some(),
"waiting": waiting, "status": STATUS_PAGE,
// The save in the game's folder now (the last copy made or put back), and this PC's name:
// the tab marks the copy that's current and the ones another PC made.
"current": state.last_hash, "here": saves::device_name(),
// Seconds until a copy that didn't get through is tried again, and whether the account's
// cloud saves are full (no uploads until there's room).
"retryIn": state.pending.as_deref().and_then(|p| copy_wait_left(&id, p)), "full": full_now(),
Expand Down Expand Up @@ -1505,8 +1520,29 @@ pub async fn saves_restore(app: AppHandle, id: String, name: Option<String>, v:
blocking(move || saves::restore(&dir, &id2, &file, &spots, &g)).await?
}

/// The player's own answer to where the game saves (a folder they picked), or None to go back to
/// the developer's or the catalog's folders (or none: then the launcher says it doesn't know).
/// Deletes one of a game's cloud saves. Never its newest: that's the one the next PC brings in
/// and the one this PC last synced with, so without it an older copy would look like the newest.
#[tauri::command]
pub async fn saves_cloud_delete(app: AppHandle, id: String, v: String) -> Res<()> {
let _busy = BUSY.lock().await;
let (list, _) = cloud_list(&app, &id).await?;
if !deletable(&list, &v) {
return Err(Error::Msg("The newest cloud save stays: the next PC you play on brings it in.".into()));
}
let r = post(&app, "save-delete", json!({"game": id, "v": v}), true).await?;
if let (Some(used), Some(quota)) = (r.get("used").and_then(Value::as_u64), r.get("quota").and_then(Value::as_u64)) {
room_now(used, quota);
}
Ok(())
}

/// A cloud save that can go: one of the list (newest first) that isn't its newest.
fn deletable(list: &[CloudCopy], v: &str) -> bool {
list.iter().skip(1).any(|c| c.v == v)
}

/// The player's own answer to where the game saves (a folder they picked), or None to forget it.
/// It only counts while neither the developer nor the catalog names a folder (saves::spots).
#[tauri::command(async)]
pub fn saves_set_place(st: State<'_, App>, id: String, path: Option<String>) -> Res<Installed> {
let mut l = st.lib.lock().unwrap();
Expand Down Expand Up @@ -1996,6 +2032,10 @@ mod status_tests {
d
}

fn cloud_copy(v: &str) -> CloudCopy {
CloudCopy { v: v.into(), ..Default::default() }
}

fn copy_made(when: u64, hash: &str) -> saves::Copy {
saves::Copy { name: format!("{when}.zip"), when, size: 1, files: 1, hash: hash.into(), device: String::new(), played: 0 }
}
Expand Down Expand Up @@ -2033,6 +2073,35 @@ mod status_tests {
assert!(open_sessions(&d.join("saves")).is_empty());
}

#[test]
fn the_newest_cloud_save_is_never_deleted() {
assert!(!deletable(&[cloud_copy("new"), cloud_copy("old")], "new"));
}

#[test]
fn an_older_cloud_save_can_be_deleted() {
assert!(deletable(&[cloud_copy("new"), cloud_copy("old")], "old"));
}

#[test]
fn a_cloud_save_that_is_not_there_is_not_deleted() {
assert!(!deletable(&[cloud_copy("new"), cloud_copy("old")], "gone"));
}

#[test]
fn save_folders_from_a_profile_the_release_has_are_the_developers() {
let d = tmp("release-profile");
std::fs::write(d.join("recomplauncher.json"), r#"{"format":1}"#).unwrap();
let g = Installed { path: d, ..Default::default() };
assert_eq!(named_spots(vec!["{install}/save".into()], vec![], &g)[0].from, "developer");
}

#[test]
fn save_folders_from_a_profile_we_keep_are_recomplaunchers() {
let g = Installed { path: tmp("our-profile"), ..Default::default() };
assert_eq!(named_spots(vec!["{install}/save".into()], vec![], &g)[0].from, "catalog");
}

#[test]
fn a_full_cloud_is_its_own_problem() {
assert_eq!(problem_kind(&Error::Msg(FULL_TEXT.into())), "full");
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10190,7 +10190,7 @@ pub fn run() {
convert_copy,
convert_cancel, looks_info, set_look, look_picture, ui_data,
reset_settings, tray::tray_words, tray::quit_launcher, ach::ach_access, ach::ach_status, ach::ach_apply, ach::ach_profile, ach::ach_games, ach::ach_board, ach::ach_game_web, ach::ach_report, ach::ach_tracker_get, ach::ach_game, ach::ach_set_disc, ach::ach_set_folder, ach::ach_sound, ach::ach_log, ach::ach_peek, ach::ach_rule, ach::ach_reset, ach::ach_test_toast, ach::ach_toast_take, ach::ach_toast_done, cloud::account_start, cloud::account_poll, cloud::account_cancel, cloud::account_state, cloud::account_signout,
cloud::saves_check, cloud::saves_pick, cloud::saves_cloud, download_history, report_counts, play_reports, cloud::saves_info, cloud::saves_status, cloud::saves_upload_now, cloud::cloud_retry, cloud::saves_overview, cloud::saves_backup, cloud::saves_restore, cloud::saves_share, cloud::saves_set_place, cloud::saves_add_place, cloud::saves_remove_place, cloud::saves_open, saves_set_root, saves_open_root, missing_files, missing_made, dll_check, dll_aside, gpu_choice, prefer_fast_gpu, copy_check, wine_tools, deck_scores, latest_counts, team_notes, trending, ig_info, ig_view, usage::notifies, usage::notify, usage::pc_specs, usage::recomp_request,
cloud::saves_check, cloud::saves_pick, cloud::saves_cloud, download_history, report_counts, play_reports, cloud::saves_info, cloud::saves_status, cloud::saves_upload_now, cloud::cloud_retry, cloud::saves_overview, cloud::saves_backup, cloud::saves_restore, cloud::saves_cloud_delete, cloud::saves_share, cloud::saves_set_place, cloud::saves_add_place, cloud::saves_remove_place, cloud::saves_open, saves_set_root, saves_open_root, missing_files, missing_made, dll_check, dll_aside, gpu_choice, prefer_fast_gpu, copy_check, wine_tools, deck_scores, latest_counts, team_notes, trending, ig_info, ig_view, usage::notifies, usage::notify, usage::pc_specs, usage::recomp_request,
adopt::adopt_scan, adopt::migrate_scan, adopt::migrate_pick, adopt::adopt_pick, adopt::adopt_add, adopt::adopt_check, adopt::set_project, usage::usage_hello, usage::usage_event, usage::data_ids, usage::reset_ids, ping::usage_open, ping::usage_mode, usage::run_report, cloud::inbox, cloud::inbox_done, cloud::betas, cloud::beta_join, cloud::beta_leave, launcher_notes, scan_info, devtools::dev_add, devtools::add_any, devtools::dev_check, devtools::dev_starter, fs_places, fs_list, fs_extract, gb_mods, gb_mod, gb_install
])
.build(tauri::generate_context!())
Expand Down
58 changes: 42 additions & 16 deletions src-tauri/src/saves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,30 @@ pub struct Spot {
pub from: &'static str,
}

/// Where a game's saves are: the player's folders, else the developer's file, else the catalog.
/// Empty when none of them says: the launcher doesn't know where this game saves.
/// Where a game's saves are: the developer's file, else the catalog, else the player's folders.
/// A folder the developer or RecompLauncher named is the right one (the launcher never moves where
/// a game saves, it only reads that folder), so a folder the player picked before one was named
/// isn't used anymore. Empty when nobody says: the launcher doesn't know where this game saves.
pub fn spots(dev: &[String], catalog: &[String], g: &Installed) -> Vec<Spot> {
// The player's own folders: one, or several (a launcher with more than one game in it).
let list = |v: &[String], from: &'static str| v.iter().filter(|t| !t.trim().is_empty()).map(|t| Spot { template: t.trim().to_string(), from }).collect::<Vec<_>>();
let named = list(dev, "developer");
if !named.is_empty() {
return named;
}
let ours = list(catalog, "catalog");
if !ours.is_empty() {
return ours;
}
// The player's own folders: one, or several (a launcher with more than one game in it). Not a
// guess (the whole game folder, or files it was seen writing): that backed up caches and build
// folders as saves, and could put the wrong files back.
let mut mine: Vec<String> = vec![];
for t in g.save_place.iter().chain(g.more_save_places.iter()).map(|t| t.trim()).filter(|t| !t.is_empty()) {
if !mine.iter().any(|m| m == t) {
mine.push(t.to_string());
}
}
if !mine.is_empty() {
return mine.into_iter().map(|template| Spot { template, from: "player" }).collect();
}
let list = |v: &[String], from: &'static str| v.iter().filter(|t| !t.trim().is_empty()).map(|t| Spot { template: t.trim().to_string(), from }).collect::<Vec<_>>();
let named = list(dev, "developer");
if !named.is_empty() {
return named;
}
// Nothing else: a guess (the whole game folder, or files it was seen writing) backed up caches
// and build folders as saves, and could put the wrong files back. The Saves tab says the
// launcher doesn't know, and the player picks the folder.
list(catalog, "catalog")
mine.into_iter().map(|template| Spot { template, from: "player" }).collect()
}

/// The player's save folders with `dir` added to `now` (the ones it has): refused when it's one of
Expand Down Expand Up @@ -1302,7 +1304,7 @@ mod tests {
assert!(add_place(&two, &d.join("TT-Xbox"), &g).is_err());
g.save_place = Some(two[0].clone());
g.more_save_places = vec![two[1].clone()];
let s = spots(&["{install}/dev".into()], &[], &g);
let s = spots(&[], &[], &g);
assert_eq!(s.iter().map(|x| (x.template.as_str(), x.from)).collect::<Vec<_>>(), vec![("{install}/TT-Xbox/saves", "player"), ("{install}/ROTK-Xbox/saves", "player")]);
// Both folders' files go in the backup, kept apart.
let mut from: Vec<usize> = collect(&s, &g).iter().map(|e| e.spot).collect();
Expand Down Expand Up @@ -1455,6 +1457,30 @@ mod tests {
assert_eq!(s.iter().map(|x| (x.template.as_str(), x.from)).collect::<Vec<_>>(), vec![("{install}/save", "developer")]);
}

#[test]
fn the_developers_folder_comes_before_one_the_player_picked() {
let mut g = game(Path::new("/games/test"));
g.save_place = Some("{install}/mine".into());
let s = spots(&["{install}/save".into()], &[], &g);
assert_eq!(s.iter().map(|x| (x.template.as_str(), x.from)).collect::<Vec<_>>(), vec![("{install}/save", "developer")]);
}

#[test]
fn recomplaunchers_folder_comes_before_one_the_player_picked() {
let mut g = game(Path::new("/games/test"));
g.save_place = Some("{install}/mine".into());
let s = spots(&[], &["{local}/Test/saves".into()], &g);
assert_eq!(s.iter().map(|x| (x.template.as_str(), x.from)).collect::<Vec<_>>(), vec![("{local}/Test/saves", "catalog")]);
}

#[test]
fn the_players_folder_counts_when_nobody_named_one() {
let mut g = game(Path::new("/games/test"));
g.save_place = Some("{install}/mine".into());
let s = spots(&[], &[], &g);
assert_eq!(s.iter().map(|x| (x.template.as_str(), x.from)).collect::<Vec<_>>(), vec![("{install}/mine", "player")]);
}

#[test]
fn sharing_keeps_the_previous_save_and_the_source() {
let d = tmp("sharing-copy");
Expand Down
2 changes: 1 addition & 1 deletion tests/beta45.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('a game nobody says where it saves asks the player to pick its folder', ()
assert.equal(savesUnknown(null), false);
// The same pick on the desktop and in Big Picture.
const tv = read('tv.js');
assert.match(account, /unknown \? pickRow/);
assert.match(account, /if \(savesUnknown\(s\)\) return `<div class="stack">\$\{unknownCard\(id\)\}/);
assert.match(tv, /data-tvact="gs-place"/);
assert.match(tv, /case 'gs-place':[\s\S]{0,400}invoke\('saves_set_place'/);
});
Expand Down
15 changes: 15 additions & 0 deletions tests/save-badge.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ test('signed out, the copy after a session is not called a sync', () => {
assert.equal(b.label, 'Not signed in');
});

test('with no known save folder, the step after a session does not hide that nothing is backed up', () => {
const b = info.saveBadgeInfo(status('none', { known: false }), 'after', false);
assert.equal(b.label, 'Saves not backed up');
});

test('right after the game closes it still says the save goes up after play, not up to date', () => {
const b = info.saveBadgeInfo(status('up-to-date', { syncedAt: now() }), 'after', false);
assert.equal(b.label, 'Syncs after you play');
Expand Down Expand Up @@ -124,6 +129,16 @@ test('signed out says so', () => {
assert.equal(b.label, 'Not signed in');
});

test('a game whose save folder nobody named says it is not backed up, whatever else is set', () => {
const b = info.saveBadgeInfo(status('up-to-date', { known: false, syncedAt: now() }), undefined, false);
assert.equal(b.label, 'Saves not backed up');
});

test('a game whose save folder nobody named is grey above Play, not a red alarm', () => {
const b = info.saveBadgeInfo(status('none', { known: false }), undefined, false);
assert.equal(b.tone, 'dim');
});

test('a game never played has nothing to sync', () => {
const b = info.saveBadgeInfo(status('none'), undefined, false);
assert.equal(b.label, 'No saves yet');
Expand Down
Loading
Loading