ReStreet: FIFA Street (2012) recompiled for Windows PC, with online play, a launcher with friends, chat and rooms. Bring your own game.
Launcher 2.1.3: restore deleted World Tour saves (Advanced > World Tour saves)
SamuelitoDaVilac531d8a8f90a
diff --git a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csprojindex 2ef6ca2..b7ca7c8 100644--- a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj+++ b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj@@ -8,7 +8,7 @@<ImplicitUsings>enable</ImplicitUsings><AssemblyName>restreet-launcher</AssemblyName><RootNamespace>FifaStreetLauncher.Linux</RootNamespace>- <Version>2.1.2</Version>+ <Version>2.1.3</Version><InvariantGlobalization>true</InvariantGlobalization></PropertyGroup><ItemGroup>diff --git a/Launcher/FifaStreetLauncher/FifaStreetLauncher.csproj b/Launcher/FifaStreetLauncher/FifaStreetLauncher.csprojindex 2b03977..790dee4 100644--- a/Launcher/FifaStreetLauncher/FifaStreetLauncher.csproj+++ b/Launcher/FifaStreetLauncher/FifaStreetLauncher.csproj@@ -6,7 +6,7 @@<Nullable>enable</Nullable><UseWindowsForms>true</UseWindowsForms><ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>- <Version>2.1.2</Version>+ <Version>2.1.3</Version><ApplicationIcon>fifastreet.ico</ApplicationIcon><ImplicitUsings>enable</ImplicitUsings></PropertyGroup>diff --git a/Launcher/FifaStreetLauncher/GlassUi.cs b/Launcher/FifaStreetLauncher/GlassUi.csindex 73c4895..e5f985e 100644--- a/Launcher/FifaStreetLauncher/GlassUi.cs+++ b/Launcher/FifaStreetLauncher/GlassUi.cs@@ -202,6 +202,8 @@ public partial class LauncherFormcase "shortcut": CreateDesktopShortcut(); break;case "state": if (pendingUpdate is { } pu) PostToPage(new { type = "update", version = pu.Version, notes = pu.Notes }); PushPerfHistory(); break;case "perfHistory": PushPerfHistory(); return;+ case "saves": PushSaves(); return;+ case "savesRestore": RestoreSaveFromPage(m.TryGetProperty("id", out var sid) ? sid.GetString() : null); return;case "updateGo": _ = InstallUpdateAsync(); return;case "perfShare": if (m.TryGetProperty("value", out var ps)) SetPerfSharing(ps.GetBoolean()); return;case "controls": if (m.TryGetProperty("value", out var cv) && cv.ValueKind == JsonValueKind.Object) SetControls(cv); break;diff --git a/Launcher/FifaStreetLauncher/SaveRestore.cs b/Launcher/FifaStreetLauncher/SaveRestore.csnew file mode 100644index 0000000..6cf2b77--- /dev/null+++ b/Launcher/FifaStreetLauncher/SaveRestore.cs@@ -0,0 +1,189 @@+using System.Diagnostics;+using System.Globalization;++namespace FifaStreetLauncher;++// World Tour saves the game deleted, put back from the launcher (Advanced > Saves).+// The game's runtime never destroys a deleted save: it moves it to <profile>\<title>\_apagados\<unix time>-<name>\+// (folder "dados" + "<name>.header") and keeps the newest 10 (content_manager.cpp). Every game save deletes the+// previous one, so a player who lost a career finds it there. Restoring: the whole title folder is copied to+// Documents\fifastreet\_launcher-backups\<time>\ first, the current save goes to _apagados the same way the game+// would move it, and the chosen save is copied (not moved) back. Nothing is done while the game runs.+public partial class LauncherForm+{+ private const string SaveTitleId = "4541097B";+ private const string SaveType = "00000001"; // saved games+ private const string TrashDir = "_apagados", CopyDir = "_copia", HeadersDir = "Headers", BackupsDir = "_launcher-backups";++ // Documents\fifastreet, the game's user data root (RESTREET_SAVES_ROOT points it elsewhere, for tests).+ internal static string SavesRoot() =>+ Environment.GetEnvironmentVariable("RESTREET_SAVES_ROOT") is { Length: > 0 } custom+ ? custom+ : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "fifastreet");++ // <root>\<16 hex profile>\4541097B for every profile folder that has one.+ private static IEnumerable<string> SaveTitleFolders(string root)+ {+ if (!Directory.Exists(root)) yield break;+ foreach (string profile in Directory.GetDirectories(root))+ {+ string name = Path.GetFileName(profile);+ if (name.Length != 16 || !name.All(Uri.IsHexDigit)) continue;+ string title = Path.Combine(profile, SaveTitleId);+ if (Directory.Exists(title)) yield return title;+ }+ }++ private static long FolderSize(string dir)+ {+ try { return new DirectoryInfo(dir).EnumerateFiles("*", SearchOption.AllDirectories).Sum(f => f.Length); }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { return 0; }+ }++ // "Settings 20261026011248A" -> the time the game wrote it (its own local clock), or null.+ private static DateTime? SaveTimeOf(string saveName)+ {+ string digits = new(saveName.SkipWhile(c => !char.IsDigit(c)).TakeWhile(char.IsDigit).ToArray());+ return digits.Length == 14 && DateTime.TryParseExact(digits, "yyyyMMddHHmmss", CultureInfo.InvariantCulture,+ DateTimeStyles.None, out var t) ? t : null;+ }++ internal sealed record SaveEntry(string Id, string Kind, string Name, string? Saved, string? Deleted, long Size, string Profile);++ // The current saves and the deleted ones, newest first. Id = path relative to the root (what restore receives).+ internal static List<SaveEntry> ListSaves(string root)+ {+ var list = new List<SaveEntry>();+ foreach (string title in SaveTitleFolders(root))+ {+ string profile = Path.GetFileName(Path.GetDirectoryName(title)!);+ string current = Path.Combine(title, SaveType);+ if (Directory.Exists(current))+ foreach (string dir in Directory.GetDirectories(current))+ {+ string name = Path.GetFileName(dir);+ list.Add(new SaveEntry(Path.GetRelativePath(root, dir), "current", name,+ SaveTimeOf(name)?.ToString("s"), null, FolderSize(dir), profile));+ }+ string trash = Path.Combine(title, TrashDir);+ if (Directory.Exists(trash))+ foreach (string dir in Directory.GetDirectories(trash))+ {+ string folder = Path.GetFileName(dir);+ int dash = folder.IndexOf('-');+ if (dash <= 0 || !long.TryParse(folder[..dash], out long unix)) continue;+ string name = folder[(dash + 1)..];+ string data = Path.Combine(dir, "dados");+ if (!Directory.Exists(data) || !File.Exists(Path.Combine(dir, name + ".header"))) continue;+ list.Add(new SaveEntry(Path.GetRelativePath(root, dir), "deleted", name, SaveTimeOf(name)?.ToString("s"),+ DateTimeOffset.FromUnixTimeSeconds(unix).ToLocalTime().DateTime.ToString("s"), FolderSize(data), profile));+ }+ }+ return list.OrderBy(e => e.Kind == "current" ? 0 : 1).ThenByDescending(e => e.Saved ?? "").ToList();+ }++ private static void CopyFolder(string from, string to)+ {+ Directory.CreateDirectory(to);+ foreach (string file in Directory.GetFiles(from)) File.Copy(file, Path.Combine(to, Path.GetFileName(file)), false);+ foreach (string dir in Directory.GetDirectories(from)) CopyFolder(dir, Path.Combine(to, Path.GetFileName(dir)));+ }++ // Puts a deleted save back. Returns null when done, else the reason (shown to the player).+ internal static string? RestoreSave(string root, string id, DateTime now)+ {+ string entry = Path.GetFullPath(Path.Combine(root, id));+ string trash = Path.GetDirectoryName(entry)!;+ string title = Path.GetDirectoryName(trash)!;+ // Only a folder directly inside some profile's _apagados, under this root.+ if (!entry.StartsWith(Path.GetFullPath(root) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) ||+ Path.GetFileName(trash) != TrashDir || !SaveTitleFolders(root).Any(t => Path.GetFullPath(t) == title))+ return "That save is not in the deleted saves folder";+ string folder = Path.GetFileName(entry);+ int dash = folder.IndexOf('-');+ string name = dash > 0 ? folder[(dash + 1)..] : "";+ string data = Path.Combine(entry, "dados"), header = Path.Combine(entry, name + ".header");+ if (name.Length == 0 || !Directory.Exists(data) || !File.Exists(header) || FolderSize(data) == 0)+ return "That save is incomplete and cannot be restored";++ // 1. The whole title folder as it is now, before anything changes.+ string stamp = now.ToString("yyyyMMdd-HHmmss");+ string backup = Path.Combine(root, BackupsDir, stamp, Path.GetFileName(Path.GetDirectoryName(title)!), SaveTitleId);+ if (Directory.Exists(backup)) return "A backup with this time already exists, try again in a second";+ try { CopyFolder(title, backup); }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)+ {+ try { Directory.Delete(Path.Combine(root, BackupsDir, stamp), true); }+ catch (Exception cleanup) when (cleanup is IOException or UnauthorizedAccessException) { } // the error below matters+ return "Could not make the backup (" + ex.Message + "): nothing was changed";+ }++ // 2. The current saves go to _apagados the way the game moves a deleted save (their copies in _copia too).+ string current = Path.Combine(title, SaveType), headers = Path.Combine(title, HeadersDir, SaveType);+ long unix = new DateTimeOffset(now).ToUnixTimeSeconds();+ var moved = new List<(string Dir, string Header, string To, string Name)>();+ if (Directory.Exists(current))+ foreach (string dir in Directory.GetDirectories(current))+ {+ string curName = Path.GetFileName(dir);+ string to = Path.Combine(trash, unix + "-" + curName);+ if (Directory.Exists(to)) to += "-" + Guid.NewGuid().ToString("N")[..6];+ Directory.CreateDirectory(to);+ Directory.Move(dir, Path.Combine(to, "dados"));+ string curHeader = Path.Combine(headers, curName + ".header");+ if (File.Exists(curHeader)) File.Move(curHeader, Path.Combine(to, curName + ".header"));+ moved.Add((dir, curHeader, to, curName));+ }++ // 3. The chosen save, copied back (it stays in _apagados too). A failure puts the current save back.+ string target = Path.Combine(current, name), targetHeader = Path.Combine(headers, name + ".header");+ try+ {+ CopyFolder(data, target);+ Directory.CreateDirectory(headers);+ File.Copy(header, targetHeader, true);+ }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)+ {+ if (Directory.Exists(target)) Directory.Delete(target, true);+ if (File.Exists(targetHeader)) File.Delete(targetHeader);+ foreach (var m in moved)+ {+ Directory.Move(Path.Combine(m.To, "dados"), m.Dir);+ string h = Path.Combine(m.To, m.Name + ".header");+ if (File.Exists(h)) File.Move(h, m.Header);+ Directory.Delete(m.To, true);+ }+ return "Could not restore (" + ex.Message + "): nothing was changed, a backup is in " + backup;+ }+ // The game's own copies of the saves that left (it would never use them again: their saves are gone).+ foreach (var m in moved)+ {+ string copy = Path.Combine(title, CopyDir, m.Name);+ if (Directory.Exists(copy)) Directory.Delete(copy, true);+ }+ return null;+ }++ private static bool AnyGameRunning() =>+ Process.GetProcessesByName("fifastreet").Any(p => { using (p) return !p.HasExited; });++ private void PushSaves(string? note = null, bool ok = true)+ {+ string root = SavesRoot();+ List<SaveEntry> saves;+ try { saves = ListSaves(root); }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { saves = new(); note ??= "Could not read the saves folder"; ok = false; }+ PostToPage(new { type = "saves", root, saves, note, ok });+ }++ private void RestoreSaveFromPage(string? id)+ {+ if (string.IsNullOrEmpty(id)) return;+ if (gameRunning || AnyGameRunning()) { PushSaves("Close the game first, then restore the save", false); return; }+ string? error;+ try { error = RestoreSave(SavesRoot(), id, DateTime.Now); }+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { error = "Could not restore: " + ex.Message; }+ PushSaves(error ?? "Save restored. Your previous save and a full backup were kept.", error == null);+ }+}diff --git a/Launcher/FifaStreetLauncher/Updater.cs b/Launcher/FifaStreetLauncher/Updater.csindex 2fc9888..121d52e 100644--- a/Launcher/FifaStreetLauncher/Updater.cs+++ b/Launcher/FifaStreetLauncher/Updater.cs@@ -10,7 +10,7 @@ namespace FifaStreetLauncher;// name, key and server, and reopens the launcher) and closes the launcher. Only installs that have the online patch.public partial class LauncherForm{- internal const string LauncherVersion = "2.1.2";+ internal const string LauncherVersion = "2.1.3";private const string ReleasesApi = "https://api.github.com/repos/samuelit0davila/fifa-street-pc-port/releases/latest";private static readonly HttpClient UpdateHttp = CreateUpdateHttp();private (string Version, string ExeUrl, string ShaUrl, string Notes)? pendingUpdate;diff --git a/Launcher/FifaStreetLauncher/ui/lang.js b/Launcher/FifaStreetLauncher/ui/lang.jsindex 316f68a..a9a9e59 100644--- a/Launcher/FifaStreetLauncher/ui/lang.js+++ b/Launcher/FifaStreetLauncher/ui/lang.js@@ -467,6 +467,22 @@"players": ["jogadores", "jugadores", "joueurs", "Spieler", "giocatori"],"Checked in": ["Presença confirmada", "Asistencia confirmada", "Confirmé", "Eingecheckt", "Presenza confermata"],"Signed up": ["Inscrito", "Inscrito", "Inscrit", "Angemeldet", "Iscritto"],+ "WORLD TOUR SAVES": ["SAVES DO WORLD TOUR", "PARTIDAS DEL WORLD TOUR", "SAUVEGARDES WORLD TOUR", "WORLD-TOUR-SPIELSTÄNDE", "SALVATAGGI WORLD TOUR"],+ "Lost your World Tour career? The game keeps your last 10 saves. Pick the one from before it happened and restore it. A full backup of your saves is made first.": [+ "Perdeu sua carreira do World Tour? O jogo guarda seus últimos 10 saves. Escolha o de antes do problema e restaure. Antes é feita uma cópia de segurança de todos os seus saves.",+ "¿Perdiste tu carrera del World Tour? El juego guarda tus últimas 10 partidas. Elige la de antes del problema y restáurala. Antes se hace una copia de seguridad de todas tus partidas.",+ "Tu as perdu ta carrière World Tour ? Le jeu garde tes 10 dernières sauvegardes. Choisis celle d'avant le problème et restaure-la. Une copie de toutes tes sauvegardes est faite avant.",+ "World-Tour-Karriere verloren? Das Spiel behält deine letzten 10 Spielstände. Wähle den von vor dem Problem und stelle ihn wieder her. Vorher wird eine Sicherung aller Spielstände erstellt.",+ "Hai perso la carriera World Tour? Il gioco tiene gli ultimi 10 salvataggi. Scegli quello di prima del problema e ripristinalo. Prima viene fatta una copia di tutti i salvataggi."],+ "SAVED": ["SALVO", "GUARDADA", "ENREGISTRÉE", "GESPEICHERT", "SALVATO"],+ "REPLACED": ["SUBSTITUÍDO", "SUSTITUIDA", "REMPLACÉE", "ERSETZT", "SOSTITUITO"],+ "SIZE": ["TAMANHO", "TAMAÑO", "TAILLE", "GRÖSSE", "DIMENSIONE"],+ "In use": ["Em uso", "En uso", "Utilisée", "In Benutzung", "In uso"],+ "Restore": ["Restaurar", "Restaurar", "Restaurer", "Wiederherstellen", "Ripristina"],+ "Restore this save?": ["Restaurar este save?", "¿Restaurar esta partida?", "Restaurer cette sauvegarde ?", "Diesen Spielstand wiederherstellen?", "Ripristinare questo salvataggio?"],+ "No World Tour saves found on this PC.": ["Nenhum save do World Tour encontrado neste PC.", "No se encontraron partidas del World Tour en este PC.", "Aucune sauvegarde World Tour sur ce PC.", "Keine World-Tour-Spielstände auf diesem PC.", "Nessun salvataggio World Tour su questo PC."],+ "Close the game first, then restore the save": ["Feche o jogo primeiro e depois restaure o save", "Cierra el juego primero y luego restaura la partida", "Ferme d'abord le jeu, puis restaure la sauvegarde", "Schließe zuerst das Spiel, dann stelle den Spielstand wieder her", "Chiudi prima il gioco, poi ripristina il salvataggio"],+ "Save restored. Your previous save and a full backup were kept.": ["Save restaurado. O save anterior e uma cópia de segurança completa foram guardados.", "Partida restaurada. Se guardaron la partida anterior y una copia de seguridad completa.", "Sauvegarde restaurée. L'ancienne sauvegarde et une copie complète ont été gardées.", "Spielstand wiederhergestellt. Der vorherige Spielstand und eine vollständige Sicherung wurden behalten.", "Salvataggio ripristinato. Il salvataggio precedente e una copia completa sono stati conservati."],"Check in now": ["Confirme agora", "Confirma ahora", "Confirme maintenant", "Jetzt einchecken", "Conferma ora"],"checked in": ["confirmados", "confirmados", "confirmés", "eingecheckt", "confermati"],"signed up": ["inscritos", "inscritos", "inscrits", "angemeldet", "iscritti"],@@ -493,6 +509,12 @@};// Texts with a name or a number inside: $1 is the captured part as is, $T1 the captured part translated.const PATTERNS = [+ [/^The save from (.+) becomes your save again\. The one in use now is kept with the deleted saves, and a full backup is made first\. Close the game before you restore\.$/, [+ "O save de $1 volta a ser o seu save. O que está em uso agora fica guardado com os saves apagados, e antes é feita uma cópia de segurança completa. Feche o jogo antes de restaurar.",+ "La partida del $1 vuelve a ser tu partida. La que usas ahora se guarda con las partidas borradas, y antes se hace una copia de seguridad completa. Cierra el juego antes de restaurar.",+ "La sauvegarde du $1 redevient ta sauvegarde. Celle utilisée maintenant est gardée avec les sauvegardes supprimées, et une copie complète est faite avant. Ferme le jeu avant de restaurer.",+ "Der Spielstand vom $1 wird wieder dein Spielstand. Der aktuelle bleibt bei den gelöschten Spielständen, und vorher wird eine vollständige Sicherung erstellt. Schließe das Spiel vor dem Wiederherstellen.",+ "Il salvataggio del $1 torna a essere il tuo. Quello in uso ora resta con i salvataggi cancellati, e prima viene fatta una copia completa. Chiudi il gioco prima di ripristinare."]],[/^SEASON (\d+)$/, ["TEMPORADA $1", "TEMPORADA $1", "SAISON $1", "SAISON $1", "STAGIONE $1"]],[/^Season (\d+)$/, ["Temporada $1", "Temporada $1", "Saison $1", "Saison $1", "Stagione $1"]],[/^Ends in (.+)$/, ["Termina em $1", "Termina en $1", "Se termine dans $1", "Endet in $1", "Finisce tra $1"]],diff --git a/Launcher/FifaStreetLauncher/ui/launcher.html b/Launcher/FifaStreetLauncher/ui/launcher.htmlindex 92b8ced..4f2dcc6 100644--- a/Launcher/FifaStreetLauncher/ui/launcher.html+++ b/Launcher/FifaStreetLauncher/ui/launcher.html@@ -548,12 +548,19 @@ body.deck .old-only,body:not(.deck) .deck-only{display:none!important}<div class="sec old-only">COMPATIBILITY</div><div class="grid2 old-only" style="margin-bottom:14px"><div class="field"><label>READBACK RESOLVE</label><div class="dd" data-id="readback"><button class="dd-btn" type="button"><span></span><i></i></button><div class="dd-list"></div></div></div></div><div class="toggles old-only"><div class="tg" tabindex="0" role="switch" data-id="memexport"><div>Memory Export</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="memexportFast"><div>Fast MemExport</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="pageState"><div>Memory Page State</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="occlusion"><div>Occlusion Queries</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="asyncShaders"><div>Async Shaders</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="frameStats"><div>Frame stats log</div><div class="sw"></div></div><div class="tg" tabindex="0" role="switch" data-id="perfShare"><div>Share performance reports</div><div class="sw"></div></div></div>+ <div class="sec" style="margin-top:22px">WORLD TOUR SAVES</div>+ <p class="sub">Lost your World Tour career? The game keeps your last 10 saves. Pick the one from before it happened and restore it. A full backup of your saves is made first.</p>+ <table class="ptable" id="sTable"><thead><tr><th>SAVED</th><th>REPLACED</th><th>SIZE</th><th></th></tr></thead><tbody></tbody></table>+ <p class="sub" id="sNote" style="margin-top:8px"></p><div class="row" style="margin-top:20px"><button class="btn" data-cmd="logs">Open logs</button><button class="btn" data-cmd="folder">Open game folder</button><button class="btn" data-cmd="shortcut">Desktop shortcut</button></div></div></section></div><div class="veil gone" id="perfAsk"><div class="toast"><div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linejoin="round"><path d="M13 2L4 14h7l-1 8 9-12h-7z"/></svg></div><b>Help make ReStreet faster</b><p>After each session, send an anonymous performance report: your graphics card, processor, memory, settings and FPS. No name, no account. You can turn it off in Advanced.</p><div class="btns"><button class="later" id="perfNo">No thanks</button><button class="go" id="perfYes">Share</button></div></div></div>+<div class="veil gone" id="saveAsk"><div class="toast"><div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M3 12a9 9 0 1 0 3-6.7M3 4v5h5"/></svg></div><b>Restore this save?</b>+ <p id="saveAskText"></p>+ <div class="btns"><button class="later" id="saveNo">Cancel</button><button class="go" id="saveYes">Restore</button></div></div></div><div class="veil gone" id="updAsk"><div class="toast"><div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M12 4v12M6 11l6 6 6-6M5 20h14"/></svg></div><b id="updTitle">Update available</b><p id="updText">A new version of ReStreet is ready. The launcher downloads it from GitHub, checks it and installs it for you. Your name, server and saves are kept.</p><div class="upbar" id="updBar"><i></i></div>@@ -620,6 +627,27 @@ addEventListener('keydown', e => {});const perfAnswer = v => { $('perfAsk').classList.add('gone'); send({cmd: 'perfShare', value: v}); };$('perfYes').onclick = () => perfAnswer(true); $('perfNo').onclick = () => perfAnswer(false);+// World Tour saves (launcher SaveRestore.cs): the save in use and the ones the game deleted, newest first.+let saveRows = [], savePick = null;+const saveWhen = s => { if (!s) return '-'; const t = new Date(s); return t.toLocaleDateString() + ' ' + t.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'}); };+function renderSaves(d) {+ saveRows = d.saves || [];+ $('sTable').querySelector('tbody').innerHTML = saveRows.length ? saveRows.map((r, i) => '<tr><td>' + esc(saveWhen(r.Saved)) + '</td><td>' ++ (r.Kind === 'current' ? '<b>In use</b>' : esc(saveWhen(r.Deleted))) + '</td><td>' + (r.Size / 1048576).toFixed(1) + ' MB</td><td>' ++ (r.Kind === 'current' ? '' : '<button type="button" class="btn" data-save="' + i + '">Restore</button>') + '</td></tr>').join('')+ : '<tr><td colspan="4">No World Tour saves found on this PC.</td></tr>';+ $('sNote').textContent = d.note || '';+ $('sNote').style.color = d.note ? (d.ok ? 'var(--green, #3fb950)' : 'var(--red)') : '';+}+$('sTable').onclick = e => {+ const b = e.target.closest('[data-save]'); if (!b) return;+ savePick = saveRows[Number(b.dataset.save)];+ $('saveAskText').textContent = 'The save from ' + saveWhen(savePick.Saved) + ' becomes your save again. The one in use now is kept with the deleted saves, and a full backup is made first. Close the game before you restore.';+ $('saveAsk').classList.remove('gone');+};+$('saveNo').onclick = () => { $('saveAsk').classList.add('gone'); savePick = null; };+$('saveYes').onclick = () => { $('saveAsk').classList.add('gone'); if (savePick) send({cmd: 'savesRestore', id: savePick.Id}); savePick = null; };+document.querySelector('[data-p=p-advanced]').addEventListener('click', () => send({cmd: 'saves'}));$('updLater').onclick = () => $('updAsk').classList.add('gone');$('updGo').onclick = () => { $('updBtns').style.display = 'none'; $('updBar').style.display = 'block'; $('updText').textContent = 'Downloading the update...'; send({cmd: 'updateGo'}); };function renderUpdate(d) {@@ -1275,7 +1303,7 @@ setInterval(() => {}}, 3000);document.querySelector('[data-p=p-comp]').addEventListener('click', () => { compAt = {table: 0, tournaments: 0}; send({cmd: 'comp', action: 'me'}); });-if (host) { host.addEventListener('message', e => !e.data ? 0 : e.data.type === 'social' ? renderSocial(e.data) : e.data.type === 'comp' ? renderComp(e.data) : e.data.type === 'perf' ? renderPerf(e.data) : e.data.type === 'perfHistory' ? renderHistory(e.data) : String(e.data.type).startsWith('update') ? renderUpdate(e.data) : render(e.data)); send({cmd: 'state'}); }+if (host) { host.addEventListener('message', e => !e.data ? 0 : e.data.type === 'social' ? renderSocial(e.data) : e.data.type === 'comp' ? renderComp(e.data) : e.data.type === 'saves' ? renderSaves(e.data) : e.data.type === 'perf' ? renderPerf(e.data) : e.data.type === 'perfHistory' ? renderHistory(e.data) : String(e.data.type).startsWith('update') ? renderUpdate(e.data) : render(e.data)); send({cmd: 'state'}); }// Controller (Steam Deck, Xbox pad): D-pad / left stick move the focus to the nearest control on screen, A presses it,// B closes a list or dialog (else goes back to Home), LB / RB step through the pages. Only while a pad is connected.const PAD = {A: 0, B: 1, LB: 4, RB: 5, UP: 12, DOWN: 13, LEFT: 14, RIGHT: 15};