Skip to content

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.4: keep the online key across reinstalls, recovery code for another PC

Claude3874972e20bf
diff --git a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
index b7ca7c8..b0bc063 100644
--- a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
+++ b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
@@ -8,11 +8,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>restreet-launcher</AssemblyName>
<RootNamespace>FifaStreetLauncher.Linux</RootNamespace>
- <Version>2.1.3</Version>
+ <Version>2.1.4</Version>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Photino.NET" Version="4.0.16" />
+ <!-- The personal online key backup and recovery code, shared with the Windows launcher. -->
+ <Compile Include="..\FifaStreetLauncher\PlayerKey.cs" Link="PlayerKey.cs" />
<!-- The same page as the Windows launcher: one ui folder for both. -->
<None Include="..\FifaStreetLauncher\ui\**" LinkBase="ui" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
<None Update="ui\linux-setup.html" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
diff --git a/Launcher/FifaStreetLauncher.Linux/Launcher.cs b/Launcher/FifaStreetLauncher.Linux/Launcher.cs
index 0a58a12..c598720 100644
--- a/Launcher/FifaStreetLauncher.Linux/Launcher.cs
+++ b/Launcher/FifaStreetLauncher.Linux/Launcher.cs
@@ -112,6 +112,8 @@ internal sealed partial class Launcher : IPageHost
LoadSettings();
if (deck) LoadDeckToml();
+ // A reinstall wrote a new online.json: put this player's key back before anything signs in with it.
+ PlayerKey.Sync(OnlineFiles());
UpdateEnabled();
status = ReadyText();
}
@@ -315,11 +317,14 @@ internal sealed partial class Launcher : IPageHost
return online == null ? "Online is not set up. Run the online patch again" : "Ready to play online as " + online.Value.Name;
}
+ // online.json in the install folder (the one the launcher reads) and the copy beside the game in Binaries/.
+ private string[] OnlineFiles() => new[] { Path.Combine(root, "online.json"), Path.Combine(binaries, "online.json") };
+
// Moves this install to another region: the same name and key, another server (online.json in both places).
private void SwitchServer(string address)
{
if (gameRunning || !Regions.Any(r => r.Address == address)) return;
- foreach (string path in new[] { Path.Combine(root, "online.json"), Path.Combine(binaries, "online.json") })
+ foreach (string path in OnlineFiles())
{
try
{
@@ -424,6 +429,17 @@ internal sealed partial class Launcher : IPageHost
case "perfShare": if (m.TryGetProperty("value", out var ps) && ps.ValueKind is JsonValueKind.True or JsonValueKind.False) { perfShare = ps.GetBoolean(); SaveSettings(); } return;
case "controls": if (m.TryGetProperty("value", out var cv) && cv.ValueKind == JsonValueKind.Object) SetControls(cv); break;
case "server": if (m.TryGetProperty("address", out var a)) SwitchServer(a.GetString() ?? ""); break;
+ // Advanced > Online key (PlayerKey.cs): the recovery code, and a code from another PC.
+ case "keyCode": Post(new { type = "key", code = PlayerKey.RecoveryCode(OnlineFiles()) }); return;
+ case "keyUse":
+ {
+ var result = gameRunning
+ ? new PlayerKey.Result(false, "Close the game first.")
+ : PlayerKey.UseCode(OnlineFiles(), m.TryGetProperty("code", out var kc) && kc.ValueKind == JsonValueKind.String ? kc.GetString() : null);
+ Post(new { type = "key", code = PlayerKey.RecoveryCode(OnlineFiles()), ok = result.Ok, note = result.Note });
+ if (result.Ok) lock (sync) status = ReadyText();
+ break;
+ }
case "social" or "chatSend" or "chatAction" or "friend" or "room":
_ = SocialAsync(cmd, m);
return;
diff --git a/Launcher/FifaStreetLauncher.Linux/Social.cs b/Launcher/FifaStreetLauncher.Linux/Social.cs
index 8084132..bd1128a 100644
--- a/Launcher/FifaStreetLauncher.Linux/Social.cs
+++ b/Launcher/FifaStreetLauncher.Linux/Social.cs
@@ -6,7 +6,12 @@ namespace FifaStreetLauncher.Linux;
internal sealed partial class Launcher
{
// ---------- Social (players, friends, chat): HTTP to the player's own server with their name and key ----------
- private static readonly HttpClient SocialHttp = new() { Timeout = TimeSpan.FromSeconds(6) };
+ // The User-Agent tells the server which launcher version a player uses (its personal-key log).
+ private static readonly HttpClient SocialHttp = new()
+ {
+ Timeout = TimeSpan.FromSeconds(6),
+ DefaultRequestHeaders = { { "User-Agent", "ReStreet-Linux-Launcher/" + typeof(Launcher).Assembly.GetName().Version!.ToString(3) } },
+ };
private DateTime lastBackgroundSocial = DateTime.MinValue;
// One retry: a single dropped connection (a busy moment on the server, Wi-Fi) must not look like an outage.
diff --git a/Launcher/FifaStreetLauncher/FifaStreetLauncher.csproj b/Launcher/FifaStreetLauncher/FifaStreetLauncher.csproj
index 790dee4..00f8cac 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.3</Version>
+ <Version>2.1.4</Version>
<ApplicationIcon>fifastreet.ico</ApplicationIcon>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
diff --git a/Launcher/FifaStreetLauncher/FriendsForm.cs b/Launcher/FifaStreetLauncher/FriendsForm.cs
index 48f8be5..5995911 100644
--- a/Launcher/FifaStreetLauncher/FriendsForm.cs
+++ b/Launcher/FifaStreetLauncher/FriendsForm.cs
@@ -189,7 +189,7 @@ internal sealed class FriendsForm : Form, ISceneHost, IUiScaled
const int SheetX = 480, SheetY = 32, SheetW = 422, SheetH = 546, Pad = 24;
const int ContentX = SheetX + Pad, ContentW = SheetW - 2 * Pad;
- static readonly HttpClient Http = new() { Timeout = TimeSpan.FromSeconds(5) };
+ static readonly HttpClient Http = new() { Timeout = TimeSpan.FromSeconds(5), DefaultRequestHeaders = { { "User-Agent", "ReStreetLauncher/" + LauncherForm.LauncherVersion } } };
readonly string server, me, key;
readonly TextBox addBox = new();
diff --git a/Launcher/FifaStreetLauncher/GlassUi.cs b/Launcher/FifaStreetLauncher/GlassUi.cs
index e5f985e..642c707 100644
--- a/Launcher/FifaStreetLauncher/GlassUi.cs
+++ b/Launcher/FifaStreetLauncher/GlassUi.cs
@@ -222,6 +222,17 @@ public partial class LauncherForm
case "server":
if (m.TryGetProperty("address", out var a)) SwitchServer(a.GetString() ?? "");
break;
+ // Advanced > Online key (PlayerKey.cs): the recovery code, and a code from another PC.
+ case "keyCode": PostToPage(new { type = "key", code = PlayerKey.RecoveryCode(OnlineFiles()) }); return;
+ case "keyUse":
+ {
+ var result = gameRunning
+ ? new PlayerKey.Result(false, "Close the game first.")
+ : PlayerKey.UseCode(OnlineFiles(), m.TryGetProperty("code", out var kc) ? kc.GetString() : null);
+ PostToPage(new { type = "key", code = PlayerKey.RecoveryCode(OnlineFiles()), ok = result.Ok, note = result.Note });
+ if (result.Ok) UpdateStatus(ReadyText(), true);
+ break;
+ }
case "social":
case "chatSend":
case "chatAction":
@@ -237,15 +248,21 @@ public partial class LauncherForm
PushGlassState(true);
}
- // Moves this install to another region: the same name and key, another server (online.json in both places).
- private void SwitchServer(string address)
+ // online.json beside this launcher (the one it reads) and the copy beside the game executable (Binaries\, or
+ // Game\ in installs before 1.5.5).
+ internal string[] OnlineFiles()
{
- if (gameRunning || !Regions.Any(r => r.Address == address)) return;
- // The second copy sits beside the game executable (Binaries\, or Game\ in installs before 1.5.5).
string exeFolder;
try { exeFolder = Path.GetDirectoryName(Path.GetFullPath(exePathBox.Text.Trim())) ?? AppContext.BaseDirectory; }
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or PathTooLongException) { exeFolder = AppContext.BaseDirectory; }
- foreach (string path in new[] { Path.Combine(AppContext.BaseDirectory, "online.json"), Path.Combine(exeFolder, "online.json") })
+ return new[] { Path.Combine(AppContext.BaseDirectory, "online.json"), Path.Combine(exeFolder, "online.json") };
+ }
+
+ // Moves this install to another region: the same name and key, another server (online.json in both places).
+ private void SwitchServer(string address)
+ {
+ if (gameRunning || !Regions.Any(r => r.Address == address)) return;
+ foreach (string path in OnlineFiles())
{
try
{
@@ -329,7 +346,8 @@ public partial class LauncherForm
}
// ---------- Social (players, friends, chat): HTTP to the player's own server with their name and key ----------
- private static readonly HttpClient SocialHttp = new() { Timeout = TimeSpan.FromSeconds(6) };
+ // The User-Agent tells the server which launcher version a player uses (its personal-key log).
+ private static readonly HttpClient SocialHttp = new() { Timeout = TimeSpan.FromSeconds(6), DefaultRequestHeaders = { { "User-Agent", "ReStreetLauncher/" + LauncherVersion } } };
private DateTime lastBackgroundSocial = DateTime.MinValue;
// One retry: a single dropped connection (a busy moment on the server, Wi-Fi) must not look like an outage.
diff --git a/Launcher/FifaStreetLauncher/LauncherForm.cs b/Launcher/FifaStreetLauncher/LauncherForm.cs
index cb6530c..72007b5 100644
--- a/Launcher/FifaStreetLauncher/LauncherForm.cs
+++ b/Launcher/FifaStreetLauncher/LauncherForm.cs
@@ -144,6 +144,8 @@ public partial class LauncherForm : Form, ISceneHost, IUiScaled
LoadDefaults();
profileBox.SelectedIndex = 0;
LoadSettings();
+ // A reinstall wrote a new online.json: put this player's key back before anything signs in with it.
+ PlayerKey.Sync(OnlineFiles());
InitDeckOptions();
applyingProfile = false;
UpdateGraphicsApiState();
diff --git a/Launcher/FifaStreetLauncher/PlayerKey.cs b/Launcher/FifaStreetLauncher/PlayerKey.cs
new file mode 100644
index 0000000..1500fba
--- /dev/null
+++ b/Launcher/FifaStreetLauncher/PlayerKey.cs
@@ -0,0 +1,188 @@
+using System.Security.Cryptography;
+using System.Text;
+using System.Text.Json;
+using System.Text.Json.Nodes;
+
+namespace FifaStreetLauncher;
+
+// The player's personal online key (online.json "key"): the server binds the online name to the first key it sees,
+// so a reinstall, which writes a new online.json, must not lose it. The launcher keeps a copy outside the game folder
+// (%LOCALAPPDATA%\ReStreet\player-key.json, ~/.local/share/ReStreet on Linux) and puts it back into online.json when
+// a fresh install brought another key for the same name. A recovery code (RS1-...) carries the name and the key to
+// another PC. Nothing here ever drops a key: one that is replaced stays in the backup under "previous".
+// Shared by the Windows and the Linux launcher.
+internal static class PlayerKey
+{
+ private const int MinKey = 16; // the server binds no shorter key (friends.py MIN_KEY)
+ private const string CodePrefix = "RS1-";
+
+ internal sealed record Result(bool Ok, string Note);
+
+ // RESTREET_KEY_BACKUP points the copy elsewhere, for tests.
+ internal static string BackupPath() =>
+ Environment.GetEnvironmentVariable("RESTREET_KEY_BACKUP") is { Length: > 0 } custom
+ ? custom
+ : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ReStreet", "player-key.json");
+
+ // At launcher start, with the online.json copies (the first is the one the launcher reads). Makes them and the
+ // backup agree; online.json without a key gets a new one so the name can be claimed.
+ internal static void Sync(IReadOnlyList<string> onlineFiles)
+ {
+ var (name, key) = Read(onlineFiles);
+ if (name.Length == 0) return;
+ var backup = LoadBackup();
+ var saved = backup[Id(name)] as JsonObject;
+ string savedKey = saved?["key"]?.GetValue<string>() ?? "";
+ if (savedKey.Length >= MinKey)
+ {
+ if (savedKey == key) return;
+ Remember(saved!, key);
+ if (Write(onlineFiles, name, savedKey)) SaveBackup(backup);
+ return;
+ }
+ if (key.Length < MinKey && !Write(onlineFiles, name, key = NewKey())) return;
+ backup[Id(name)] = new JsonObject { ["name"] = name, ["key"] = key, ["saved"] = DateTime.UtcNow.ToString("s") };
+ SaveBackup(backup);
+ }
+
+ // The code shown in Advanced, or "" when online is not set up.
+ internal static string RecoveryCode(IReadOnlyList<string> onlineFiles)
+ {
+ var (name, key) = Read(onlineFiles);
+ return name.Length == 0 || key.Length < MinKey ? "" : CodePrefix + Base64Url(Encoding.UTF8.GetBytes(name + "\n" + key));
+ }
+
+ // A code from another PC: its name and key go into online.json (and the backup) here.
+ internal static Result UseCode(IReadOnlyList<string> onlineFiles, string? code)
+ {
+ if (!TryParse(code, out string name, out string key)) return new(false, "That is not a recovery code. Copy the whole code, starting with RS1-.");
+ var (current, currentKey) = Read(onlineFiles);
+ if (current.Length == 0) return new(false, "Online is not set up. Run the online patch again.");
+ if (current == name && currentKey == key) return new(true, "This PC already uses this code.");
+ var backup = LoadBackup();
+ // The key this PC had stays in the backup, under its own name.
+ if (currentKey.Length > 0)
+ {
+ if (backup[Id(current)] is not JsonObject old) backup[Id(current)] = new JsonObject { ["name"] = current, ["key"] = currentKey };
+ else if (old["key"]?.GetValue<string>() != currentKey) Remember(old, currentKey);
+ }
+ var entry = backup[Id(name)] as JsonObject ?? new JsonObject();
+ if (entry["key"]?.GetValue<string>() is { Length: > 0 } before && before != key) Remember(entry, before);
+ entry["name"] = name;
+ entry["key"] = key;
+ entry["saved"] = DateTime.UtcNow.ToString("s");
+ backup[Id(name)] = entry;
+ if (!Write(onlineFiles, name, key)) return new(false, "Could not write online.json. Close the game and try again.");
+ SaveBackup(backup);
+ return new(true, "Done. This PC now plays online with the name and key from the code.");
+ }
+
+ internal static bool TryParse(string? code, out string name, out string key)
+ {
+ name = key = "";
+ string text = new((code ?? "").Where(c => !char.IsWhiteSpace(c)).ToArray());
+ if (!text.StartsWith(CodePrefix, StringComparison.OrdinalIgnoreCase)) return false;
+ try
+ {
+ string payload = text[CodePrefix.Length..].Replace('-', '+').Replace('_', '/');
+ payload += new string('=', (4 - payload.Length % 4) % 4);
+ string[] parts = Encoding.UTF8.GetString(Convert.FromBase64String(payload)).Split('\n');
+ if (parts.Length != 2) return false;
+ (name, key) = (parts[0].Trim(), parts[1].Trim());
+ }
+ catch (FormatException) { return false; }
+ // The server's rules for a name (friends.py valid_name) and a key.
+ return name.Length is >= 1 and <= 32 && !name.Any(c => c < 0x20 || c == 0x7f || "\\\"{}[]".Contains(c))
+ && key.Length is >= MinKey and <= 128;
+ }
+
+ private static (string Name, string Key) Read(IReadOnlyList<string> onlineFiles)
+ {
+ try
+ {
+ if (onlineFiles.Count == 0 || !File.Exists(onlineFiles[0])) return ("", "");
+ var node = JsonNode.Parse(File.ReadAllText(onlineFiles[0])) as JsonObject;
+ return ((node?["name"]?.GetValue<string>() ?? "").Trim(), (node?["key"]?.GetValue<string>() ?? "").Trim());
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException or InvalidOperationException)
+ {
+ return ("", "");
+ }
+ }
+
+ // Name and key into every online.json copy that exists; the other fields (server, ...) stay as they are.
+ private static bool Write(IReadOnlyList<string> onlineFiles, string name, string key)
+ {
+ bool wrote = false;
+ foreach (string path in onlineFiles.Distinct(StringComparer.OrdinalIgnoreCase))
+ {
+ try
+ {
+ if (!File.Exists(path)) continue;
+ var node = JsonNode.Parse(File.ReadAllText(path)) as JsonObject ?? new JsonObject();
+ node["name"] = name;
+ node["key"] = key;
+ WriteAtomic(path, node.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
+ wrote = true;
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException or InvalidOperationException)
+ {
+ if (path == onlineFiles[0]) return false;
+ }
+ }
+ return wrote;
+ }
+
+ // Keeps |key| in the entry's "previous" list (when it is not the entry's key, or is about to be replaced).
+ private static void Remember(JsonObject entry, string key)
+ {
+ if (key.Length == 0) return;
+ var previous = entry["previous"] as JsonArray ?? new JsonArray();
+ if (!previous.Any(p => p?.GetValue<string>() == key)) previous.Add(JsonValue.Create(key));
+ while (previous.Count > 5) previous.RemoveAt(0);
+ entry["previous"] = previous;
+ }
+
+ private static JsonObject LoadBackup()
+ {
+ try
+ {
+ string path = BackupPath();
+ return File.Exists(path) && JsonNode.Parse(File.ReadAllText(path)) is JsonObject o ? o : new JsonObject();
+ }
+ catch (JsonException)
+ {
+ // A damaged copy is put aside (never deleted) before a new one is written.
+ try { File.Copy(BackupPath(), BackupPath() + ".bad", true); } catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { }
+ return new JsonObject();
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
+ {
+ return new JsonObject();
+ }
+ }
+
+ private static void SaveBackup(JsonObject backup)
+ {
+ try
+ {
+ string path = BackupPath();
+ Directory.CreateDirectory(Path.GetDirectoryName(path)!);
+ WriteAtomic(path, backup.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { /* the next start tries again */ }
+ }
+
+ private static void WriteAtomic(string path, string text)
+ {
+ string tmp = path + ".tmp";
+ File.WriteAllText(tmp, text);
+ File.Move(tmp, path, true);
+ }
+
+ private static string Id(string name) => name.Trim().ToLowerInvariant();
+
+ private static string NewKey() => Convert.ToHexString(RandomNumberGenerator.GetBytes(16)).ToLowerInvariant();
+
+ private static string Base64Url(byte[] data) => Convert.ToBase64String(data).TrimEnd('=').Replace('+', '-').Replace('/', '_');
+}
diff --git a/Launcher/FifaStreetLauncher/Updater.cs b/Launcher/FifaStreetLauncher/Updater.cs
index 121d52e..532a939 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.3";
+ internal const string LauncherVersion = "2.1.4";
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.js
index a9a9e59..feb1683 100644
--- a/Launcher/FifaStreetLauncher/ui/lang.js
+++ b/Launcher/FifaStreetLauncher/ui/lang.js
@@ -483,6 +483,28 @@
"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."],
+ "ONLINE KEY": ["CHAVE ONLINE", "CLAVE EN LÍNEA", "CLÉ EN LIGNE", "ONLINE-SCHLÜSSEL", "CHIAVE ONLINE"],
+ "Your key keeps your online name yours. This PC keeps a copy, so reinstalling ReStreet keeps it. To play with the same name on another PC, use this recovery code there. Keep it private: anyone who has it can play as you.": [
+ "Sua chave garante que seu nome online é só seu. Este PC guarda uma cópia, então reinstalar o ReStreet não a perde. Para jogar com o mesmo nome em outro PC, use lá este código de recuperação. Não o compartilhe: quem o tiver pode jogar como você.",
+ "Tu clave hace que tu nombre en línea sea solo tuyo. Este PC guarda una copia, así que reinstalar ReStreet no la pierde. Para jugar con el mismo nombre en otro PC, usa allí este código de recuperación. No lo compartas: quien lo tenga puede jugar como tú.",
+ "Ta clé garde ton nom en ligne pour toi seul. Ce PC en garde une copie, donc réinstaller ReStreet ne la perd pas. Pour jouer avec le même nom sur un autre PC, utilise ce code de récupération là-bas. Garde-le pour toi : celui qui l'a peut jouer à ta place.",
+ "Dein Schlüssel sorgt dafür, dass dein Online-Name nur dir gehört. Dieser PC behält eine Kopie, eine Neuinstallation von ReStreet verliert ihn also nicht. Um mit demselben Namen auf einem anderen PC zu spielen, nutze dort diesen Wiederherstellungscode. Gib ihn nicht weiter: wer ihn hat, kann als du spielen.",
+ "La tua chiave fa sì che il tuo nome online sia solo tuo. Questo PC ne tiene una copia, quindi reinstallare ReStreet non la perde. Per giocare con lo stesso nome su un altro PC, usa lì questo codice di recupero. Tienilo per te: chi lo ha può giocare al posto tuo."],
+ "RECOVERY CODE": ["CÓDIGO DE RECUPERAÇÃO", "CÓDIGO DE RECUPERACIÓN", "CODE DE RÉCUPÉRATION", "WIEDERHERSTELLUNGSCODE", "CODICE DI RECUPERO"],
+ "CODE FROM ANOTHER PC": ["CÓDIGO DE OUTRO PC", "CÓDIGO DE OTRO PC", "CODE D'UN AUTRE PC", "CODE VON EINEM ANDEREN PC", "CODICE DA UN ALTRO PC"],
+ "Paste a recovery code": ["Cole um código de recuperação", "Pega un código de recuperación", "Colle un code de récupération", "Wiederherstellungscode einfügen", "Incolla un codice di recupero"],
+ "Show": ["Mostrar", "Mostrar", "Afficher", "Anzeigen", "Mostra"],
+ "Hide": ["Ocultar", "Ocultar", "Masquer", "Verbergen", "Nascondi"],
+ "Copy": ["Copiar", "Copiar", "Copier", "Kopieren", "Copia"],
+ "Use code": ["Usar código", "Usar código", "Utiliser le code", "Code verwenden", "Usa codice"],
+ "Online is not set up": ["Online não configurado", "En línea sin configurar", "En ligne non configuré", "Online nicht eingerichtet", "Online non configurato"],
+ "Recovery code copied.": ["Código de recuperação copiado.", "Código de recuperación copiado.", "Code de récupération copié.", "Wiederherstellungscode kopiert.", "Codice di recupero copiato."],
+ "That is not a recovery code. Copy the whole code, starting with RS1-.": ["Isso não é um código de recuperação. Copie o código inteiro, começando por RS1-.", "Eso no es un código de recuperación. Copia el código entero, empezando por RS1-.", "Ce n'est pas un code de récupération. Copie le code entier, qui commence par RS1-.", "Das ist kein Wiederherstellungscode. Kopiere den ganzen Code, er beginnt mit RS1-.", "Questo non è un codice di recupero. Copia tutto il codice, che inizia con RS1-."],
+ "Online is not set up. Run the online patch again.": ["O online não está configurado. Execute o patch online novamente.", "El modo en línea no está configurado. Vuelve a ejecutar el parche en línea.", "Le mode en ligne n'est pas configuré. Relance le patch en ligne.", "Online ist nicht eingerichtet. Führe den Online-Patch erneut aus.", "L'online non è configurato. Esegui di nuovo la patch online."],
+ "This PC already uses this code.": ["Este PC já usa este código.", "Este PC ya usa este código.", "Ce PC utilise déjà ce code.", "Dieser PC verwendet diesen Code bereits.", "Questo PC usa già questo codice."],
+ "Could not write online.json. Close the game and try again.": ["Não foi possível gravar o online.json. Feche o jogo e tente de novo.", "No se pudo escribir online.json. Cierra el juego e inténtalo de nuevo.", "Impossible d'écrire online.json. Ferme le jeu et réessaie.", "online.json konnte nicht geschrieben werden. Schließe das Spiel und versuche es erneut.", "Impossibile scrivere online.json. Chiudi il gioco e riprova."],
+ "Done. This PC now plays online with the name and key from the code.": ["Pronto. Este PC agora joga online com o nome e a chave do código.", "Listo. Este PC ahora juega en línea con el nombre y la clave del código.", "C'est fait. Ce PC joue maintenant en ligne avec le nom et la clé du code.", "Fertig. Dieser PC spielt jetzt online mit dem Namen und dem Schlüssel aus dem Code.", "Fatto. Questo PC ora gioca online con il nome e la chiave del codice."],
+ "Close the game first.": ["Feche o jogo primeiro.", "Cierra el juego primero.", "Ferme d'abord le jeu.", "Schließe zuerst das Spiel.", "Chiudi prima il gioco."],
"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"],
diff --git a/Launcher/FifaStreetLauncher/ui/launcher.html b/Launcher/FifaStreetLauncher/ui/launcher.html
index 4f2dcc6..c496dcc 100644
--- a/Launcher/FifaStreetLauncher/ui/launcher.html
+++ b/Launcher/FifaStreetLauncher/ui/launcher.html
@@ -552,6 +552,11 @@ body.deck .old-only,body:not(.deck) .deck-only{display:none!important}
<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="sec" style="margin-top:22px">ONLINE KEY</div>
+ <p class="sub">Your key keeps your online name yours. This PC keeps a copy, so reinstalling ReStreet keeps it. To play with the same name on another PC, use this recovery code there. Keep it private: anyone who has it can play as you.</p>
+ <div class="pathrow"><div class="field"><label>RECOVERY CODE</label><input id="okCode" type="password" readonly></div><div class="row"><button class="btn" type="button" id="okShow">Show</button><button class="btn" type="button" id="okCopy">Copy</button></div></div>
+ <div class="pathrow"><div class="field"><label>CODE FROM ANOTHER PC</label><input id="okPaste" placeholder="Paste a recovery code" autocomplete="off" spellcheck="false"></div><button class="btn" type="button" id="okUse">Use code</button></div>
+ <p class="sub" id="okNote" role="status"></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>
@@ -647,7 +652,22 @@ $('sTable').onclick = e => {
};
$('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'}));
+document.querySelector('[data-p=p-advanced]').addEventListener('click', () => { send({cmd: 'saves'}); send({cmd: 'keyCode'}); });
+// Online key (launcher PlayerKey.cs): the recovery code of this PC, and a code from another PC.
+function renderKey(d) {
+ $('okCode').value = d.code || '';
+ $('okCode').placeholder = d.code ? '' : 'Online is not set up';
+ if (d.note !== undefined) { $('okNote').textContent = d.note; $('okNote').style.color = d.ok ? 'var(--green, #3fb950)' : 'var(--red)'; }
+ if (d.ok) $('okPaste').value = '';
+}
+$('okShow').onclick = () => { const c = $('okCode'), hidden = c.type === 'password'; c.type = hidden ? 'text' : 'password'; $('okShow').textContent = hidden ? 'Hide' : 'Show'; };
+$('okCopy').onclick = () => {
+ const c = $('okCode'); if (!c.value) return;
+ const done = () => { $('okNote').textContent = 'Recovery code copied.'; $('okNote').style.color = ''; };
+ if (navigator.clipboard) navigator.clipboard.writeText(c.value).then(done, () => 0);
+ else { const t = c.type; c.type = 'text'; c.select(); document.execCommand('copy'); c.type = t; done(); }
+};
+$('okUse').onclick = () => { const v = $('okPaste').value.trim(); if (v) send({cmd: 'keyUse', code: v}); };
$('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) {
@@ -1303,7 +1323,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 === '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'}); }
+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 === 'key' ? renderKey(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};