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.

Linux launcher: install from the ISO, run without umu

SamuelitoDaVila53b40c2bb69c
diff --git a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
index cbf87d7..0c7e427 100644
--- a/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
+++ b/Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj
@@ -15,6 +15,7 @@
<PackageReference Include="Photino.NET" Version="4.0.16" />
<!-- 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" />
<None Include="..\FifaStreetLauncher\cover.jpg" Link="restreet.jpg" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
diff --git a/Launcher/FifaStreetLauncher.Linux/GameStart.cs b/Launcher/FifaStreetLauncher.Linux/GameStart.cs
index 19f5e05..ac85123 100644
--- a/Launcher/FifaStreetLauncher.Linux/GameStart.cs
+++ b/Launcher/FifaStreetLauncher.Linux/GameStart.cs
@@ -183,6 +183,7 @@ internal sealed partial class Launcher
{
File.WriteAllText(Path.Combine(logsDir, "launcher_settings.txt"),
$"Launcher=Linux{Environment.NewLine}Proton={protons.FirstOrDefault() ?? "UMU-Proton (default)"}{Environment.NewLine}" +
+ $"Runner={(Proton.UmuRun() != null ? "umu-run" : "Proton direct")}{Environment.NewLine}" +
$"Prefix={prefix}{Environment.NewLine}Resolution={width}x{height}{Environment.NewLine}" +
$"InternalResolution={1280 * internalScale}x{720 * internalScale} ({internalScale}x){Environment.NewLine}" +
$"MonitorRefreshRate={refresh}{Environment.NewLine}GraphicsApi={graphicsApi}{Environment.NewLine}" +
diff --git a/Launcher/FifaStreetLauncher.Linux/Launcher.cs b/Launcher/FifaStreetLauncher.Linux/Launcher.cs
index 7ff582f..9b4092b 100644
--- a/Launcher/FifaStreetLauncher.Linux/Launcher.cs
+++ b/Launcher/FifaStreetLauncher.Linux/Launcher.cs
@@ -10,7 +10,7 @@ namespace FifaStreetLauncher.Linux;
// The launcher state the page shows and changes: the same fields, toggles and commands as the Windows launcher
// (GlassUi.cs), kept as plain lists instead of WinForms controls. Settings live in linux-settings.json; the graphics
// options also go to fifastreet.toml, which the in-game menu (F5 / L3+R3) shares.
-internal sealed partial class Launcher
+internal sealed partial class Launcher : IPageHost
{
private sealed class Field
{
@@ -309,7 +309,7 @@ internal sealed partial class Launcher
private string ReadyText()
{
- if (Proton.UmuRun() == null) return "umu-run is missing: install umu-launcher to play";
+ if (Proton.Missing(protons) is { } missing) return missing;
var online = LoadOnlineConfig();
if (online != null && !toggles["onlineMode"].On) return "Ready to play offline (online is off)";
return online == null ? "Online is not set up. Run the online patch again" : "Ready to play online as " + online.Value.Name;
@@ -471,7 +471,7 @@ internal sealed partial class Launcher
}).ToArray(),
};
}
- string proton = protons.Count > 0 ? Path.GetFileName(protons[0]) : "UMU-Proton";
+ string proton = Proton.Describe(protons);
json = JsonSerializer.Serialize(new
{
fields = fieldState, toggles = toggleState, online = onlineState, controls = ControlsState(),
@@ -497,21 +497,13 @@ internal sealed partial class Launcher
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.ComponentModel.Win32Exception) { Debug.WriteLine(ex.Message); }
}
- // The desktop menu entry, as the Windows launcher's "direct play" shortcut: starts the game with the saved settings.
+ // The desktop menu entries and icon, as the Windows launcher's "direct play" shortcut.
private void CreateDesktopEntry()
{
try
{
- string self = Environment.ProcessPath!;
- string dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local/share/applications");
- Directory.CreateDirectory(dir);
- string icon = Path.Combine(AppContext.BaseDirectory, "restreet.jpg");
- string Entry(string name, string args) =>
- $"[Desktop Entry]\nType=Application\nName={name}\nExec=\"{self}\" --root \"{root}\"{args}\nPath={AppContext.BaseDirectory}\n" +
- $"Icon={icon}\nCategories=Game;\nComment=FIFA Street (2012) recompiled\n";
- File.WriteAllText(Path.Combine(dir, "restreet-launcher.desktop"), Entry("ReStreet Launcher", ""));
- File.WriteAllText(Path.Combine(dir, "restreet-play.desktop"), Entry("ReStreet (direct play)", " --play"));
- SetStatus("Menu entries created: ReStreet Launcher and ReStreet (direct play)", true);
+ DesktopEntries.Create(Environment.ProcessPath!, root);
+ SetStatus("Added ReStreet and ReStreet (direct play) to the applications menu", true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
@@ -519,10 +511,8 @@ internal sealed partial class Launcher
}
}
- public void WaitWhileBrowserConnected(PageServer server)
- {
- while (!closing && (gameRunning || DateTime.UtcNow - server.LastSeen < TimeSpan.FromSeconds(90))) Thread.Sleep(1000);
- }
+ // Browser mode: the launcher stays while the page polls or the game runs.
+ public bool KeepBrowserOpen(PageServer server) => !closing && (gameRunning || DateTime.UtcNow - server.LastSeen < TimeSpan.FromSeconds(90));
public void Shutdown()
{
diff --git a/Launcher/FifaStreetLauncher.Linux/PageServer.cs b/Launcher/FifaStreetLauncher.Linux/PageServer.cs
index 35a805d..0356e04 100644
--- a/Launcher/FifaStreetLauncher.Linux/PageServer.cs
+++ b/Launcher/FifaStreetLauncher.Linux/PageServer.cs
@@ -6,6 +6,12 @@ using System.Text;
namespace FifaStreetLauncher.Linux;
+// What a page talks to: the launcher, or the first-run installer.
+internal interface IPageHost
+{
+ void OnMessage(string json);
+}
+
// The page's link to the launcher (same protocol as BrowserUi.cs in the Windows launcher): files of ui/, POST msg and
// a long-polled GET events, served on 127.0.0.1 only, under a random secret path.
internal sealed class PageServer : IDisposable
@@ -13,7 +19,7 @@ internal sealed class PageServer : IDisposable
private readonly TcpListener listener = new(IPAddress.Loopback, 0);
private readonly string ui;
private readonly string secret = Convert.ToHexString(RandomNumberGenerator.GetBytes(16)).ToLowerInvariant();
- private readonly Launcher launcher;
+ private readonly IPageHost host;
private readonly ConcurrentQueue<string> outbox = new();
private readonly SemaphoreSlim signal = new(0);
private volatile bool running = true;
@@ -21,12 +27,12 @@ internal sealed class PageServer : IDisposable
public DateTime LastSeen { get; private set; } = DateTime.UtcNow;
public string Url { get; }
- public PageServer(string ui, Launcher launcher)
+ public PageServer(string ui, IPageHost host, string page = "launcher.html")
{
this.ui = ui;
- this.launcher = launcher;
+ this.host = host;
listener.Start();
- Url = $"http://127.0.0.1:{((IPEndPoint)listener.LocalEndpoint).Port}/{secret}/launcher.html";
+ Url = $"http://127.0.0.1:{((IPEndPoint)listener.LocalEndpoint).Port}/{secret}/{page}";
_ = Task.Run(AcceptClients);
}
@@ -60,7 +66,7 @@ internal sealed class PageServer : IDisposable
LastSeen = DateTime.UtcNow;
if (method == "POST" && rest == "msg")
{
- launcher.OnMessage(Encoding.UTF8.GetString(body));
+ host.OnMessage(Encoding.UTF8.GetString(body));
await Respond(stream, 204, "text/plain", Array.Empty<byte>());
}
else if (method == "GET" && rest == "events")
diff --git a/Launcher/FifaStreetLauncher.Linux/Program.cs b/Launcher/FifaStreetLauncher.Linux/Program.cs
index 782be16..f077e7d 100644
--- a/Launcher/FifaStreetLauncher.Linux/Program.cs
+++ b/Launcher/FifaStreetLauncher.Linux/Program.cs
@@ -4,8 +4,9 @@ using Photino.NET;
namespace FifaStreetLauncher.Linux;
// ReStreet launcher for Linux: the Windows launcher's page (ui/launcher.html) in a native WebKitGTK window, with the
-// game started through Proton (umu-run). The page talks to this process over 127.0.0.1 exactly as it does with the
-// Windows launcher under Wine (PageServer.cs), so the page needs no Linux-specific code.
+// game started through Proton. The page talks to this process over 127.0.0.1 exactly as it does with the Windows
+// launcher under Wine (PageServer.cs), so the page needs no Linux-specific code. Without a ReStreet folder beside it,
+// the launcher first installs ReStreet from the player's ISO (Setup.cs, ui/linux-setup.html).
internal static class Program
{
private static int Main(string[] args)
@@ -18,44 +19,116 @@ internal static class Program
else if (args[i] == "--play") play = true;
}
root ??= InstallFolder.Find();
+ string ui = Path.Combine(AppContext.BaseDirectory, "ui");
+
if (root == null)
{
- Console.Error.WriteLine("ReStreet folder not found. Run from the ReStreet folder or pass --root <folder>.");
- return 1;
+ if (play)
+ {
+ Console.Error.WriteLine("ReStreet folder not found. Run from the ReStreet folder or pass --root <folder>.");
+ return 1;
+ }
+ var setup = new Setup();
+ using var setupServer = new PageServer(ui, setup, "linux-setup.html");
+ setup.Page = setupServer;
+ bool closed = false;
+ ShowPage(setupServer, "ReStreet Setup", 980, 700, window =>
+ {
+ setup.CloseWindow = () => { closed = true; window?.Invoke(window.Close); };
+ setup.PickFile = (title, start) => Pick(window, title, start, false);
+ setup.PickFolder = (title, start) => Pick(window, title, start, true);
+ }, () => closed || (!setup.Busy && DateTime.UtcNow - setupServer.LastSeen > TimeSpan.FromSeconds(90)));
+ return 0;
}
var launcher = new Launcher(root);
// Direct play: no window, the game starts with the saved settings and the launcher exits with it.
if (play) return launcher.PlayAndWait();
- using var server = new PageServer(Path.Combine(AppContext.BaseDirectory, "ui"), launcher);
+ using var server = new PageServer(ui, launcher);
launcher.Page = server;
launcher.StartServices();
- try
+ bool launcherClosed = false;
+ ShowPage(server, "ReStreet Launcher", 1250, 760,
+ window => launcher.CloseWindow = () => { launcherClosed = true; window?.Invoke(window.Close); },
+ () => launcherClosed || !launcher.KeepBrowserOpen(server));
+ launcher.Shutdown();
+ return 0;
+ }
+
+ // The page in its own WebKitGTK window, or, without WebKitGTK (or with RESTREET_BROWSER_UI=1), in the system
+ // browser, as the Windows launcher does under Wine; then this process lives until done() says so.
+ private static void ShowPage(PageServer server, string title, int width, int height, Action<PhotinoWindow?> setUp, Func<bool> done)
+ {
+ if (Environment.GetEnvironmentVariable("RESTREET_BROWSER_UI") != "1")
+ {
+ try
+ {
+ var window = new PhotinoWindow()
+ .SetLogVerbosity(0)
+ .SetTitle(title)
+ .SetUseOsDefaultSize(false)
+ .SetSize(width, height)
+ .SetMinSize(Math.Min(width, 1000), Math.Min(height, 620))
+ .Center()
+ .SetIconFile(Path.Combine(AppContext.BaseDirectory, "restreet.jpg"))
+ .SetContextMenuEnabled(false)
+ .SetDevToolsEnabled(false)
+ .Load(new Uri(server.Url));
+ setUp(window);
+ window.WaitForClose();
+ return;
+ }
+ catch (Exception ex) when (ex is DllNotFoundException or TypeInitializationException or EntryPointNotFoundException)
+ {
+ Console.Error.WriteLine("WebKitGTK is not available (" + ex.Message + "); opening the page in the browser.");
+ }
+ }
+ setUp(null);
+ Console.WriteLine("ReStreet page: " + server.Url);
+ try { Process.Start(new ProcessStartInfo("xdg-open") { ArgumentList = { server.Url }, UseShellExecute = false }); }
+ catch (System.ComponentModel.Win32Exception) { Console.WriteLine("Open that address in your browser."); }
+ while (!done()) Thread.Sleep(1000);
+ }
+
+ // A native file or folder dialog: Photino's (GTK) in the window, otherwise zenity or kdialog.
+ private static async Task<string?> Pick(PhotinoWindow? window, string title, string start, bool folder)
+ {
+ if (window != null)
{
- PhotinoWindow? window = null;
- window = new PhotinoWindow()
- .SetLogVerbosity(0)
- .SetTitle("ReStreet Launcher")
- .SetUseOsDefaultSize(false)
- .SetSize(1250, 760)
- .SetMinSize(1000, 620)
- .Center()
- .SetIconFile(Path.Combine(AppContext.BaseDirectory, "restreet.jpg"))
- .SetContextMenuEnabled(false)
- .SetDevToolsEnabled(false)
- .Load(new Uri(server.Url));
- launcher.CloseWindow = () => window.Invoke(window.Close);
- window.WaitForClose();
+ var result = new TaskCompletionSource<string?>();
+ window.Invoke(async () =>
+ {
+ try
+ {
+ string[] chosen = folder
+ ? await window.ShowOpenFolderAsync(title, start, false)
+ : await window.ShowOpenFileAsync(title, start, false, new[] { ("Xbox 360 ISO", new[] { "*.iso", "*.ISO" }), ("All files", new[] { "*" }) });
+ result.TrySetResult(chosen?.FirstOrDefault());
+ }
+ catch (Exception ex) when (ex is InvalidOperationException or DllNotFoundException) { result.TrySetResult(null); }
+ });
+ return await result.Task;
}
- catch (Exception ex) when (ex is DllNotFoundException or TypeInitializationException or EntryPointNotFoundException)
+ foreach (var (tool, toolArgs) in new (string, string[])[]
{
- // No WebKitGTK: the same page in the system browser, as the Windows launcher does under Wine.
- Console.Error.WriteLine("WebKitGTK is not available (" + ex.Message + "); opening the launcher in the browser.");
- Process.Start(new ProcessStartInfo("xdg-open") { ArgumentList = { server.Url }, UseShellExecute = false });
- launcher.WaitWhileBrowserConnected(server);
+ ("zenity", folder ? new[] { "--file-selection", "--directory", "--title=" + title, "--filename=" + start + "/" }
+ : new[] { "--file-selection", "--title=" + title, "--filename=" + start + "/", "--file-filter=*.iso *.ISO" }),
+ ("kdialog", folder ? new[] { "--getexistingdirectory", start, "--title", title } : new[] { "--getopenfilename", start, "*.iso *.ISO", "--title", title }),
+ })
+ {
+ try
+ {
+ var info = new ProcessStartInfo(tool) { RedirectStandardOutput = true, UseShellExecute = false };
+ foreach (string a in toolArgs) info.ArgumentList.Add(a);
+ using var process = Process.Start(info);
+ if (process == null) continue;
+ string path = (await process.StandardOutput.ReadToEndAsync()).Trim();
+ await process.WaitForExitAsync();
+ return path.Length > 0 ? path : null;
+ }
+ catch (System.ComponentModel.Win32Exception) { /* not installed: try the next one */ }
}
- launcher.Shutdown();
- return 0;
+ return null;
}
}
diff --git a/Launcher/FifaStreetLauncher.Linux/Proton.cs b/Launcher/FifaStreetLauncher.Linux/Proton.cs
index 0b17854..e105fcb 100644
--- a/Launcher/FifaStreetLauncher.Linux/Proton.cs
+++ b/Launcher/FifaStreetLauncher.Linux/Proton.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using System.Text.RegularExpressions;
namespace FifaStreetLauncher.Linux;
@@ -11,33 +12,70 @@ internal static class InstallFolder
foreach (string dir in new[] { AppContext.BaseDirectory, Path.Combine(AppContext.BaseDirectory, ".."), Environment.CurrentDirectory })
{
string full = Path.GetFullPath(dir);
- if (File.Exists(Path.Combine(full, "Binaries", "fifastreet.exe"))) return full;
+ if (IsInstall(full)) return full;
}
return null;
}
+ public static bool IsInstall(string dir) => File.Exists(Path.Combine(dir, "Binaries", "fifastreet.exe"));
+
// Wine maps the Linux root to Z:.
public static string WindowsPath(string linuxPath) => "Z:" + Path.GetFullPath(linuxPath).Replace('/', '\\');
}
-// Proton through umu-run (umu-launcher): it runs any Proton build outside Steam, with the Steam Linux Runtime.
-internal static class Proton
+// Windows programs (the game, the setup) run through Proton. Two ways, best first:
+// - umu-run (umu-launcher), when it is installed: any Proton build, inside the Steam Linux Runtime;
+// - the Proton that Steam already has, run directly (inside Steam's own Linux Runtime when it is there). This needs
+// nothing installed, so it is the way on SteamOS, whose system is read-only.
+internal static partial class Proton
{
- public static string? UmuRun() =>
+ // RESTREET_NO_UMU=1 skips umu-run (a broken umu install, or testing the direct way).
+ public static string? UmuRun() => Environment.GetEnvironmentVariable("RESTREET_NO_UMU") == "1" ? null :
new[] { "/usr/bin/umu-run", "/usr/local/bin/umu-run", Path.Combine(Home, ".local/bin/umu-run") }.FirstOrDefault(File.Exists);
private static string Home => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- // Proton builds the player has installed, best first: CachyOS and GE builds, then Valve's own. An empty list
- // leaves PROTONPATH unset and umu-run fetches its default (UMU-Proton).
+ // Steam's own folder (native install, the Deck, or the Flatpak).
+ private static string? SteamRoot() =>
+ new[]
+ {
+ Path.Combine(Home, ".local/share/Steam"), Path.Combine(Home, ".steam/steam"), Path.Combine(Home, ".steam/root"),
+ Path.Combine(Home, ".var/app/com.valvesoftware.Steam/.local/share/Steam"),
+ }.FirstOrDefault(d => Directory.Exists(Path.Combine(d, "steamapps")) || Directory.Exists(Path.Combine(d, "compatibilitytools.d")));
+
+ [GeneratedRegex("\"path\"\\s+\"([^\"]+)\"")]
+ private static partial Regex LibraryPath();
+
+ // Every steamapps/common folder: the main one and the other libraries (SD card on the Deck) in libraryfolders.vdf.
+ private static IEnumerable<string> SteamCommonFolders()
+ {
+ string? root = SteamRoot();
+ if (root == null) yield break;
+ var seen = new HashSet<string>();
+ var libraries = new List<string> { root };
+ try
+ {
+ string vdf = Path.Combine(root, "steamapps", "libraryfolders.vdf");
+ if (File.Exists(vdf))
+ libraries.AddRange(LibraryPath().Matches(File.ReadAllText(vdf)).Select(m => m.Groups[1].Value.Replace("\\\\", "\\")));
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { Debug.WriteLine(ex.Message); }
+ foreach (string lib in libraries)
+ {
+ string common = Path.Combine(lib, "steamapps", "common");
+ if (Directory.Exists(common) && seen.Add(Path.GetFullPath(common))) yield return common;
+ }
+ }
+
+ // Proton builds the player has installed, best first: CachyOS and GE builds, then Valve's own. With umu-run and
+ // none installed, PROTONPATH stays unset and umu-run fetches its default (UMU-Proton).
public static List<string> Installed()
{
var found = new List<string>();
- foreach (string dir in new[]
- {
- Path.Combine(Home, ".local/share/Steam/compatibilitytools.d"), Path.Combine(Home, ".steam/root/compatibilitytools.d"),
- "/usr/share/steam/compatibilitytools.d", Path.Combine(Home, ".local/share/Steam/steamapps/common"),
- })
+ var folders = new List<string> { "/usr/share/steam/compatibilitytools.d" };
+ if (SteamRoot() is { } root) folders.Insert(0, Path.Combine(root, "compatibilitytools.d"));
+ folders.AddRange(SteamCommonFolders());
+ foreach (string dir in folders)
{
if (!Directory.Exists(dir)) continue;
foreach (string tool in Directory.GetDirectories(dir))
@@ -52,6 +90,19 @@ internal static class Proton
return found.OrderBy(Rank).ThenByDescending(p => Path.GetFileName(p), StringComparer.OrdinalIgnoreCase).ToList();
}
+ // Steam's container for Proton (what Steam itself uses for Proton 8 and newer). Without it Proton runs on the host
+ // libraries, which works on SteamOS and on most desktops.
+ private static string? SniperEntryPoint() =>
+ SteamCommonFolders().Select(c => Path.Combine(c, "SteamLinuxRuntime_sniper", "_v2-entry-point")).FirstOrDefault(File.Exists);
+
+ // What the launcher can run Windows programs with, or why it can't (shown on the page).
+ public static string? Missing(List<string> protons) =>
+ UmuRun() != null || protons.Count > 0 ? null
+ : "Proton was not found. In Steam, install \"Proton Experimental\" (Library → Tools), or install umu-launcher.";
+
+ public static string Describe(List<string> protons) =>
+ (protons.Count > 0 ? Path.GetFileName(protons[0]) : "UMU-Proton") + (UmuRun() != null ? " (umu)" : "");
+
public static string DefaultPrefix(string root)
{
// A prefix beside the install (how the first CachyOS installs were made) is kept; otherwise one of our own.
@@ -60,17 +111,49 @@ internal static class Proton
return Path.Combine(Home, ".local/share/restreet/prefix");
}
- // The game started through umu-run: umu-run waits for the game ("waitforexitandrun"), so the process ends with it.
+ // A Windows program started through Proton; the process ends with it ("waitforexitandrun").
public static ProcessStartInfo StartInfo(string exe, string prefix, string? protonPath)
{
- string umu = UmuRun() ?? throw new InvalidOperationException("umu-run was not found. Install umu-launcher (pacman -S umu-launcher).");
Directory.CreateDirectory(prefix);
- var info = new ProcessStartInfo(umu) { WorkingDirectory = Path.GetDirectoryName(exe)!, UseShellExecute = false };
- info.ArgumentList.Add(exe);
+ // umu-run and Proton use the same layout: the compat data folder with the Wine prefix in pfx/. umu points pfx/
+ // at the folder itself, so a prefix made by either works with both.
+ string pfx = Path.Combine(prefix, "pfx");
+ if (!Directory.Exists(pfx) && !File.Exists(pfx)) File.CreateSymbolicLink(pfx, ".");
+
+ ProcessStartInfo info;
+ string? umu = UmuRun();
+ if (umu != null)
+ {
+ info = new ProcessStartInfo(umu);
+ info.ArgumentList.Add(exe);
+ info.Environment["GAMEID"] = "umu-restreet";
+ info.Environment["STORE"] = "none";
+ if (!string.IsNullOrEmpty(protonPath)) info.Environment["PROTONPATH"] = protonPath;
+ }
+ else
+ {
+ if (string.IsNullOrEmpty(protonPath)) throw new InvalidOperationException(Missing(new List<string>()));
+ string proton = Path.Combine(protonPath, "proton");
+ string? sniper = SniperEntryPoint();
+ if (sniper != null)
+ {
+ info = new ProcessStartInfo(sniper);
+ foreach (string a in new[] { "--verb=waitforexitandrun", "--", proton, "waitforexitandrun", exe }) info.ArgumentList.Add(a);
+ }
+ else
+ {
+ info = new ProcessStartInfo(proton);
+ info.ArgumentList.Add("waitforexitandrun");
+ info.ArgumentList.Add(exe);
+ }
+ info.Environment["STEAM_COMPAT_DATA_PATH"] = prefix;
+ info.Environment["STEAM_COMPAT_CLIENT_INSTALL_PATH"] = SteamRoot() ?? Path.Combine(Home, ".local/share/Steam");
+ info.Environment["SteamAppId"] = "0";
+ info.Environment["SteamGameId"] = "0";
+ }
+ info.WorkingDirectory = Path.GetDirectoryName(exe)!;
+ info.UseShellExecute = false;
info.Environment["WINEPREFIX"] = prefix;
- info.Environment["GAMEID"] = "umu-restreet";
- info.Environment["STORE"] = "none";
- if (!string.IsNullOrEmpty(protonPath)) info.Environment["PROTONPATH"] = protonPath;
return info;
}
}
diff --git a/Launcher/FifaStreetLauncher.Linux/Setup.cs b/Launcher/FifaStreetLauncher.Linux/Setup.cs
new file mode 100644
index 0000000..82591ef
--- /dev/null
+++ b/Launcher/FifaStreetLauncher.Linux/Setup.cs
@@ -0,0 +1,364 @@
+using System.Diagnostics;
+using System.Security.Cryptography;
+using System.Text.Json;
+using System.Text.Json.Nodes;
+using System.Text.RegularExpressions;
+
+namespace FifaStreetLauncher.Linux;
+
+// First run (no ReStreet folder yet): installs ReStreet from the player's ISO without a terminal. It downloads the
+// release setup (or uses one beside the launcher), runs its headless ISO install through Proton, copies this launcher
+// into <ReStreet>/Linux and adds the menu entries. The setup's own window needs WebView2, which Proton lacks.
+internal sealed partial class Setup : IPageHost
+{
+ private const string Repo = "samuelit0davila/fifa-street-pc-port";
+
+ // Regions the online patch offers (keep in sync with GlassUi.cs).
+ private static readonly (string Name, string Address)[] Regions =
+ {
+ ("Europe", "57.129.180.15"), ("South America", "216.238.113.7"),
+ };
+
+ [GeneratedRegex(@"^[A-Za-z0-9][A-Za-z0-9 _-]{1,13}[A-Za-z0-9_-]\z")]
+ private static partial Regex OnlineName();
+
+ [GeneratedRegex(@"^\[(\d+)%\]\s*(.*)$")]
+ private static partial Regex ProgressLine();
+
+ private readonly object sync = new();
+ private readonly List<string> protons = Proton.Installed();
+ private string iso = FindIso() ?? "";
+ private string target = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Games", "ReStreet");
+ private string name = "";
+ private int region;
+ private string stage = "";
+ private int percent = -1;
+ private string error = "";
+ private bool busy, done;
+ private readonly List<string> log = new();
+
+ public bool Busy { get { lock (sync) return busy; } }
+ public PageServer? Page { get; set; }
+ public Func<string, string, Task<string?>>? PickFile { get; set; } // (title, start folder) -> path
+ public Func<string, string, Task<string?>>? PickFolder { get; set; }
+ public Action? CloseWindow { get; set; }
+
+ private static string Home => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+
+ // A FIFA Street ISO in the usual download folders, so most players only type a name.
+ private static string? FindIso()
+ {
+ var folders = new[] { "Downloads", "Transferências", "Descargas", "Téléchargements", "Desktop", "Games", "" }
+ .Select(f => Path.Combine(Home, f)).Where(Directory.Exists);
+ foreach (string dir in folders)
+ {
+ try
+ {
+ var isos = Directory.GetFiles(dir, "*.iso").Concat(Directory.GetFiles(dir, "*.ISO")).ToList();
+ string? fifa = isos.FirstOrDefault(f => Path.GetFileName(f).Contains("fifa", StringComparison.OrdinalIgnoreCase));
+ if (fifa != null) return fifa;
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { Debug.WriteLine(ex.Message); }
+ }
+ return null;
+ }
+
+ public void OnMessage(string json)
+ {
+ JsonElement m;
+ try { using var doc = JsonDocument.Parse(json); m = doc.RootElement.Clone(); }
+ catch (JsonException) { return; }
+ string Str(string p) => m.TryGetProperty(p, out var v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
+ switch (Str("cmd"))
+ {
+ case "pickIso": _ = Pick(true); return;
+ case "pickTarget": _ = Pick(false); return;
+ case "set":
+ lock (sync)
+ {
+ if (busy) break;
+ if (m.TryGetProperty("name", out _)) name = Str("name").Trim();
+ if (m.TryGetProperty("iso", out _)) iso = Str("iso").Trim();
+ if (m.TryGetProperty("target", out _)) target = Str("target").Trim();
+ if (m.TryGetProperty("region", out var r) && r.TryGetInt32(out int ri) && ri >= 0 && ri < Regions.Length) region = ri;
+ }
+ break;
+ case "install": _ = Task.Run(Install); return;
+ case "play": OpenLauncher(); return;
+ case "close": CloseWindow?.Invoke(); return;
+ case "state": break;
+ }
+ Push();
+ }
+
+ private async Task Pick(bool isoFile)
+ {
+ var picker = isoFile ? PickFile : PickFolder;
+ if (picker == null) return;
+ string start;
+ lock (sync) start = Path.GetDirectoryName(isoFile ? iso : target) is { Length: > 0 } d && Directory.Exists(d) ? d : Home;
+ string? chosen = await picker(isoFile ? "Choose your FIFA Street (Xbox 360) ISO" : "Choose where to install ReStreet", start);
+ if (string.IsNullOrEmpty(chosen)) return;
+ lock (sync)
+ {
+ if (isoFile) iso = chosen;
+ // A chosen parent folder gets a ReStreet folder inside it, unless it is already an empty one.
+ else target = Directory.Exists(chosen) && Directory.EnumerateFileSystemEntries(chosen).Any() ? Path.Combine(chosen, "ReStreet") : chosen;
+ }
+ Push();
+ }
+
+ public void Push()
+ {
+ string json;
+ lock (sync)
+ {
+ json = JsonSerializer.Serialize(new
+ {
+ type = "setup", iso, target, name, region, regions = Regions.Select(r => r.Name).ToArray(),
+ proton = Proton.Missing(protons) ?? Proton.Describe(protons),
+ protonOk = Proton.Missing(protons) == null,
+ stage, percent, error, busy, done, log = log.TakeLast(8).ToArray(),
+ version = "V" + typeof(Setup).Assembly.GetName().Version!.ToString(3),
+ });
+ }
+ Page?.Send(json);
+ }
+
+ private void Step(string text, int pct = -1)
+ {
+ lock (sync)
+ {
+ stage = text;
+ if (pct >= 0) percent = pct;
+ log.Add(text);
+ }
+ Push();
+ }
+
+ private string? Check()
+ {
+ if (Proton.Missing(protons) is { } missing) return missing;
+ if (!File.Exists(iso)) return "Choose your FIFA Street (Xbox 360) ISO file.";
+ if (!OnlineName().IsMatch(name)) return "Choose an online name with 3 to 15 letters, numbers, spaces, _ or -.";
+ if (string.IsNullOrWhiteSpace(target) || !Path.IsPathRooted(target)) return "Choose the folder to install ReStreet to.";
+ if (Directory.Exists(target) && Directory.EnumerateFileSystemEntries(target).Any())
+ return InstallFolder.IsInstall(target) ? "ReStreet is already installed there. Pick another folder." : "That folder is not empty. Pick a new or empty folder.";
+ var drive = new DriveInfo(Path.GetPathRoot(Path.GetFullPath(target))!);
+ try
+ {
+ string probe = Path.GetFullPath(target);
+ while (!Directory.Exists(probe)) probe = Path.GetDirectoryName(probe)!;
+ if (new DriveInfo(probe).AvailableFreeSpace < 12L * 1024 * 1024 * 1024) return "Not enough free space there: about 12 GB are needed.";
+ }
+ catch (Exception ex) when (ex is IOException or ArgumentException) { Debug.WriteLine(ex.Message + drive.Name); }
+ return null;
+ }
+
+ private async Task Install()
+ {
+ lock (sync)
+ {
+ if (busy || done) return;
+ error = Check() ?? "";
+ if (error.Length > 0) { Push(); return; }
+ busy = true;
+ percent = 0;
+ log.Clear();
+ }
+ Push();
+ try
+ {
+ string setupExe = await GetSetup();
+ Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(target))!);
+ await RunSetup(setupExe);
+ Step("Copying the Linux launcher", 99);
+ string linux = Path.Combine(target, "Linux");
+ CopyFolder(AppContext.BaseDirectory, linux);
+ SetRegion();
+ DesktopEntries.Create(Path.Combine(linux, "restreet-launcher"), target);
+ Step("ReStreet is installed. Press PLAY to open the launcher.", 100);
+ lock (sync) done = true;
+ }
+ catch (Exception ex) when (ex is InvalidOperationException or IOException or UnauthorizedAccessException or HttpRequestException
+ or TaskCanceledException or System.ComponentModel.Win32Exception or JsonException)
+ {
+ lock (sync) error = ex.Message;
+ }
+ finally
+ {
+ lock (sync) busy = false;
+ Push();
+ }
+ }
+
+ // The setup: one beside the launcher (offline installs), or the latest release's, checked against its .sha256.
+ private async Task<string> GetSetup()
+ {
+ foreach (string dir in new[] { AppContext.BaseDirectory, Path.Combine(AppContext.BaseDirectory, ".."), Path.Combine(Home, "Downloads"), Path.Combine(Home, "Transferências") })
+ {
+ if (!Directory.Exists(dir)) continue;
+ string? local = Directory.GetFiles(dir, "ReStreet-*-Setup.exe").OrderByDescending(f => f, StringComparer.Ordinal).FirstOrDefault();
+ if (local != null) { Step("Using " + Path.GetFileName(local), 1); return local; }
+ }
+ Step("Looking for the latest ReStreet release", 1);
+ using var http = new HttpClient { Timeout = TimeSpan.FromMinutes(30) };
+ http.DefaultRequestHeaders.UserAgent.ParseAdd("ReStreet-Linux-Launcher");
+ var release = JsonNode.Parse(await http.GetStringAsync($"https://api.github.com/repos/{Repo}/releases/latest"))!;
+ var assets = release["assets"]!.AsArray();
+ string Url(string suffix) => assets.Select(a => a!).FirstOrDefault(a => a["name"]!.GetValue<string>().EndsWith(suffix, StringComparison.Ordinal))
+ ?["browser_download_url"]?.GetValue<string>() ?? throw new InvalidOperationException("The latest release has no " + suffix + " file.");
+ string exeUrl = Url("-Setup.exe"), shaUrl = Url("-Setup.exe.sha256");
+ string cache = Path.Combine(Home, ".cache", "restreet");
+ Directory.CreateDirectory(cache);
+ string file = Path.Combine(cache, Path.GetFileName(new Uri(exeUrl).LocalPath));
+ string expected = (await http.GetStringAsync(shaUrl)).Split(' ', '\t', '\n')[0].Trim().ToLowerInvariant();
+ if (!File.Exists(file) || Sha256(file) != expected)
+ {
+ using var response = await http.GetAsync(exeUrl, HttpCompletionOption.ResponseHeadersRead);
+ response.EnsureSuccessStatusCode();
+ long total = response.Content.Headers.ContentLength ?? 0;
+ await using (var source = await response.Content.ReadAsStreamAsync())
+ await using (var output = File.Create(file + ".part"))
+ {
+ var buffer = new byte[1 << 20];
+ long got = 0;
+ int read, lastShown = -1;
+ while ((read = await source.ReadAsync(buffer)) > 0)
+ {
+ await output.WriteAsync(buffer.AsMemory(0, read));
+ got += read;
+ int shown = total > 0 ? (int)(got * 100 / total) : -1;
+ if (shown != lastShown && shown % 5 == 0)
+ {
+ lastShown = shown;
+ Step($"Downloading the setup: {got / (1024 * 1024)} of {total / (1024 * 1024)} MB", 1 + shown * 14 / 100);
+ }
+ }
+ }
+ File.Move(file + ".part", file, true);
+ if (Sha256(file) != expected)
+ {
+ File.Delete(file);
+ throw new InvalidOperationException("The downloaded setup does not match its checksum. Try again.");
+ }
+ }
+ Step("Setup downloaded and checked", 15);
+ return file;
+ }
+
+ private static string Sha256(string file)
+ {
+ using var stream = File.OpenRead(file);
+ return Convert.ToHexString(SHA256.HashData(stream)).ToLowerInvariant();
+ }
+
+ // The setup's headless install (--iso-install-test ISO TARGET NAME). It writes "[NN%] step" lines to
+ // <target>.iso-install-test.log and ends with OK or "ERROR: ...".
+ private async Task RunSetup(string setupExe)
+ {
+ string logFile = Path.GetFullPath(target).TrimEnd('/') + ".iso-install-test.log";
+ File.Delete(logFile);
+ string prefix = Proton.DefaultPrefix(target);
+ var info = Proton.StartInfo(setupExe, prefix, protons.FirstOrDefault());
+ foreach (string a in new[] { "--iso-install-test", InstallFolder.WindowsPath(iso), InstallFolder.WindowsPath(target), name }) info.ArgumentList.Add(a);
+ info.RedirectStandardOutput = info.RedirectStandardError = true;
+ Step("Starting Proton (the first time takes a minute)", 16);
+ using var process = Process.Start(info) ?? throw new InvalidOperationException("Proton could not be started.");
+ _ = process.StandardOutput.ReadToEndAsync();
+ _ = process.StandardError.ReadToEndAsync();
+ long position = 0;
+ string last = "";
+ while (true)
+ {
+ bool exited = process.WaitForExit(1000);
+ if (File.Exists(logFile))
+ {
+ using var stream = new FileStream(logFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ stream.Seek(position, SeekOrigin.Begin);
+ using var reader = new StreamReader(stream);
+ string? line;
+ while ((line = reader.ReadLine()) != null)
+ {
+ last = line.Trim().Length > 0 ? line.Trim() : last;
+ var p = ProgressLine().Match(line.Trim());
+ // The setup's 0-100 maps to 16-98 here (download before, launcher copy after).
+ if (p.Success) Step(p.Groups[2].Value.TrimEnd('…', '.'), 16 + int.Parse(p.Groups[1].Value) * 82 / 100);
+ }
+ position = stream.Position;
+ }
+ if (exited) break;
+ }
+ await Task.CompletedTask;
+ if (last.StartsWith("ERROR:", StringComparison.Ordinal)) throw new InvalidOperationException(last[6..].Trim());
+ if (!InstallFolder.IsInstall(target))
+ throw new InvalidOperationException("The setup stopped before the end" + (last.Length > 0 ? ": " + last : ". See " + logFile));
+ }
+
+ private static void CopyFolder(string from, string to)
+ {
+ from = Path.GetFullPath(from).TrimEnd('/');
+ Directory.CreateDirectory(to);
+ foreach (string dir in Directory.GetDirectories(from, "*", SearchOption.AllDirectories))
+ Directory.CreateDirectory(Path.Combine(to, Path.GetRelativePath(from, dir)));
+ foreach (string file in Directory.GetFiles(from, "*", SearchOption.AllDirectories))
+ {
+ string dest = Path.Combine(to, Path.GetRelativePath(from, file));
+ File.Copy(file, dest, true);
+ File.SetUnixFileMode(dest, File.GetUnixFileMode(file));
+ }
+ }
+
+ // The setup always picks the first region: the chosen one goes into both online.json copies.
+ private void SetRegion()
+ {
+ string address = Regions[region].Address;
+ foreach (string path in new[] { Path.Combine(target, "online.json"), Path.Combine(target, "Binaries", "online.json") })
+ {
+ if (!File.Exists(path)) continue;
+ var node = JsonNode.Parse(File.ReadAllText(path))!;
+ node["server"] = address;
+ File.WriteAllText(path, node.ToJsonString(new JsonSerializerOptions { WriteIndented = true }));
+ }
+ }
+
+ private void OpenLauncher()
+ {
+ string launcher = Path.Combine(target, "Linux", "restreet-launcher");
+ if (!done || !File.Exists(launcher)) return;
+ Process.Start(new ProcessStartInfo(launcher) { WorkingDirectory = Path.GetDirectoryName(launcher)!, UseShellExecute = false });
+ CloseWindow?.Invoke();
+ }
+}
+
+// The applications menu entries (and a desktop icon): the launcher, and "direct play" with the saved settings.
+internal static class DesktopEntries
+{
+ public static void Create(string launcher, string root)
+ {
+ string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+ string apps = Path.Combine(home, ".local/share/applications");
+ Directory.CreateDirectory(apps);
+ string dir = Path.GetDirectoryName(launcher)!;
+ string icon = Path.Combine(dir, "restreet.jpg");
+ string Entry(string name, string args) =>
+ $"[Desktop Entry]\nType=Application\nName={name}\nExec=\"{launcher}\" --root \"{root}\"{args}\nPath={dir}\n" +
+ $"Icon={icon}\nTerminal=false\nCategories=Game;\nComment=FIFA Street (2012) recompiled\n";
+ File.WriteAllText(Path.Combine(apps, "restreet-launcher.desktop"), Entry("ReStreet", ""));
+ File.WriteAllText(Path.Combine(apps, "restreet-play.desktop"), Entry("ReStreet (direct play)", " --play"));
+ // The desktop icon, where the desktop shows the Desktop folder (KDE on the Deck's desktop mode, COSMIC...).
+ try
+ {
+ string desktop = Path.Combine(home, "Desktop");
+ using (var xdg = Process.Start(new ProcessStartInfo("xdg-user-dir", "DESKTOP") { RedirectStandardOutput = true, UseShellExecute = false }))
+ if (xdg != null) { string d = xdg.StandardOutput.ReadToEnd().Trim(); xdg.WaitForExit(2000); if (d.Length > 0) desktop = d; }
+ if (Directory.Exists(desktop))
+ {
+ string path = Path.Combine(desktop, "ReStreet.desktop");
+ File.WriteAllText(path, Entry("ReStreet", ""));
+ File.SetUnixFileMode(path, File.GetUnixFileMode(path) | UnixFileMode.UserExecute);
+ }
+ }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.ComponentModel.Win32Exception) { Debug.WriteLine(ex.Message); }
+ }
+}
diff --git a/Launcher/FifaStreetLauncher.Linux/ui/linux-setup.html b/Launcher/FifaStreetLauncher.Linux/ui/linux-setup.html
new file mode 100644
index 0000000..5ed00ba
--- /dev/null
+++ b/Launcher/FifaStreetLauncher.Linux/ui/linux-setup.html
@@ -0,0 +1,117 @@
+<!doctype html><html lang="en"><head><meta charset="utf-8"><title>ReStreet Setup</title>
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<style>
+:root{
+ --glass: rgba(255,255,255,.05);
+ --glass-strong: rgba(255,255,255,.09);
+ --edge: rgba(255,255,255,.18);
+ --ink: #fff; --muted: rgba(255,255,255,.66);
+ --accent: #ffcf2e; --accent-2: #ff7a2e; --bad: #ff8a8a;
+}
+*{box-sizing:border-box;margin:0}
+html,body{height:100%}
+body{font-family:Inter,"Segoe UI",system-ui,sans-serif;color:var(--ink);background:#0b0c12;overflow:auto}
+.bg{position:fixed;inset:0;background:url(bg.jpg) center/cover;opacity:.18;filter:blur(2px) saturate(1.1)}
+.glow{position:fixed;inset:0;background:radial-gradient(60% 50% at 15% 10%,rgba(255,122,46,.22),transparent 70%),radial-gradient(50% 50% at 90% 90%,rgba(255,207,46,.14),transparent 70%)}
+main{position:relative;max-width:760px;margin:0 auto;padding:36px 28px 40px}
+.brand{font:800 34px/1 Inter,system-ui,sans-serif;letter-spacing:-.5px}
+.brand b{color:var(--accent)}
+.tag{display:inline-block;margin-top:10px;padding:4px 10px;border-radius:999px;background:linear-gradient(90deg,var(--accent),var(--accent-2));color:#1a1206;font:800 11px Inter,sans-serif;letter-spacing:1.4px}
+.lead{margin:16px 0 22px;color:var(--muted);line-height:1.5;font-size:14px}
+.card{background:var(--glass);border:1px solid var(--edge);border-radius:18px;padding:22px;backdrop-filter:blur(18px)}
+label{display:block;font:700 11px Inter,sans-serif;letter-spacing:1.4px;color:var(--muted);text-transform:uppercase;margin:16px 0 7px}
+label:first-child{margin-top:0}
+.row{display:flex;gap:10px}
+input,select{flex:1;min-width:0;height:42px;padding:0 14px;border-radius:12px;border:1px solid var(--edge);background:rgba(0,0,0,.35);color:var(--ink);font:500 14px Inter,sans-serif;outline:none}
+input:focus,select:focus{border-color:var(--accent)}
+button{height:42px;padding:0 18px;border-radius:12px;border:1px solid var(--edge);background:var(--glass-strong);color:var(--ink);font:600 14px Inter,sans-serif;cursor:pointer}
+button:hover{background:rgba(255,255,255,.14)}
+button:disabled{opacity:.45;cursor:default}
+.hint{margin-top:6px;font-size:12px;color:var(--muted)}
+.go{display:block;width:100%;height:54px;margin-top:22px;border:0;background:linear-gradient(90deg,var(--accent),var(--accent-2));color:#1a1206;font:800 17px Inter,sans-serif;letter-spacing:1.5px;text-transform:uppercase}
+.go:hover{filter:brightness(1.06);background:linear-gradient(90deg,var(--accent),var(--accent-2))}
+.bar{height:8px;border-radius:99px;background:rgba(255,255,255,.1);overflow:hidden;margin-top:18px}
+.bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--accent),var(--accent-2));transition:width .4s}
+.stage{margin-top:10px;font-size:14px}
+.log{margin-top:10px;font:12px/1.6 ui-monospace,monospace;color:var(--muted);white-space:pre-wrap;max-height:120px;overflow:auto}
+.err{margin-top:14px;padding:12px 14px;border-radius:12px;background:rgba(255,80,80,.12);border:1px solid rgba(255,120,120,.35);color:var(--bad);font-size:13px;line-height:1.45}
+.proton{margin-top:16px;font-size:12px;color:var(--muted)}
+.proton.bad{color:var(--bad)}
+.hidden{display:none}
+@media (max-width:560px){main{padding:24px 16px}.row{flex-wrap:wrap}.row button{width:100%}}
+</style></head><body>
+<div class="bg"></div><div class="glow"></div>
+<main>
+ <div class="brand">Re<b>Street</b></div>
+ <span class="tag" id="ver">LINUX SETUP</span>
+ <p class="lead">Installs FIFA Street (2012) from your own Xbox 360 ISO. The game runs through Proton; nothing else needs to be installed. It takes 5 to 15 minutes and about 12 GB.</p>
+ <div class="card">
+ <div id="form">
+ <label for="iso">Your FIFA Street ISO</label>
+ <div class="row"><input id="iso" placeholder="Choose your FIFA Street (Xbox 360) ISO" spellcheck="false"><button data-cmd="pickIso">Browse</button></div>
+ <label for="target">Install to</label>
+ <div class="row"><input id="target" spellcheck="false"><button data-cmd="pickTarget">Browse</button></div>
+ <p class="hint">A new or empty folder.</p>
+ <label for="name">Online name</label>
+ <div class="row"><input id="name" maxlength="15" placeholder="3 to 15 letters or numbers" spellcheck="false"></div>
+ <p class="hint">Friends see this name.</p>
+ <label for="region">Server</label>
+ <div class="row"><select id="region"></select></div>
+ </div>
+ <div id="progress" class="hidden">
+ <div class="stage" id="stage"></div>
+ <div class="bar"><i id="bar"></i></div>
+ <div class="log" id="log"></div>
+ </div>
+ <div class="err hidden" id="err"></div>
+ <button class="go" id="go">Install ReStreet</button>
+ <p class="proton" id="proton"></p>
+ </div>
+</main>
+<script>
+// Same link to the launcher process as launcher.html in a browser: POST msg, long-poll events (PageServer.cs).
+const base = location.pathname.replace(/[^/]*$/, '');
+const send = m => fetch(base + 'msg', {method: 'POST', body: JSON.stringify(m)}).catch(() => {});
+const $ = id => document.getElementById(id);
+let state = {}, editing = null;
+(async function poll() {
+ for (;;) {
+ try { const r = await fetch(base + 'events', {cache: 'no-store'}); for (const d of await r.json()) render(d); }
+ catch (e) { await new Promise(r => setTimeout(r, 2000)); }
+ }
+})();
+['iso', 'target', 'name'].forEach(id => {
+ $(id).addEventListener('focus', () => editing = id);
+ $(id).addEventListener('blur', () => { editing = null; send({cmd: 'set', [id]: $(id).value}); });
+ $(id).addEventListener('keydown', e => { if (e.key === 'Enter') $(id).blur(); });
+});
+$('region').onchange = () => send({cmd: 'set', region: +$('region').value});
+document.querySelectorAll('[data-cmd]').forEach(b => b.onclick = () => send({cmd: b.dataset.cmd}));
+$('go').onclick = async () => {
+ if (state.done) return send({cmd: 'play'});
+ await send({cmd: 'set', iso: $('iso').value, target: $('target').value, name: $('name').value, region: +$('region').value});
+ send({cmd: 'install'});
+};
+function render(s) {
+ if (s.type !== 'setup') return;
+ state = s;
+ for (const id of ['iso', 'target', 'name']) if (editing !== id) $(id).value = s[id] || '';
+ if ($('region').options.length !== s.regions.length) $('region').innerHTML = s.regions.map((r, i) => `<option value="${i}">${r}</option>`).join('');
+ $('region').value = s.region;
+ $('ver').textContent = 'LINUX SETUP · ' + s.version;
+ const working = s.busy || s.done;
+ $('form').classList.toggle('hidden', working);
+ $('progress').classList.toggle('hidden', !working);
+ $('stage').textContent = s.stage;
+ $('bar').style.width = Math.max(0, s.percent) + '%';
+ $('log').textContent = s.log.join('\n');
+ $('err').classList.toggle('hidden', !s.error);
+ $('err').textContent = s.error;
+ $('go').disabled = s.busy || !s.protonOk;
+ $('go').textContent = s.done ? 'Play' : s.busy ? 'Installing…' : 'Install ReStreet';
+ $('proton').textContent = (s.protonOk ? 'Runs with ' : '') + s.proton;
+ $('proton').classList.toggle('bad', !s.protonOk);
+}
+send({cmd: 'state'});
+</script>
+</body></html>
diff --git a/README.md b/README.md
index 768727d..85c4694 100644
--- a/README.md
+++ b/README.md
@@ -75,25 +75,18 @@ On a weaker PC, open **Graphics** in the launcher: use **1x** internal resolutio
## Linux (beta)
-ReStreet runs on Linux through Proton, with a native Linux launcher. Tested on CachyOS with an AMD GPU: online play works; launcher rooms and friend invites are still being tested, and the Steam Deck has not been tested yet.
+ReStreet runs on Linux through Proton, with a native Linux launcher that also installs the game. No terminal and nothing to install with a package manager, so it also suits SteamOS. Tested on CachyOS with an AMD GPU: online play works; launcher rooms and friend invites are still being tested, and the Steam Deck has not been tested yet.
-1. Install `umu-launcher`, `webkit2gtk-4.1` and a Proton build (Proton-CachyOS or GE-Proton recommended). On Arch / CachyOS:
+**You need** Steam with any Proton installed (in Steam: Library → Tools → **Proton Experimental**). Proton-CachyOS, GE-Proton or `umu-launcher` also work if you have them.
- ```bash
- sudo pacman -S umu-launcher webkit2gtk-4.1
- ```
+1. Download **ReStreet-Linux-launcher.tar.gz** from the [latest release](https://github.com/samuelit0davila/fifa-street-pc-port/releases/latest) and extract it anywhere (right-click → Extract, or `tar -xzf ReStreet-Linux-launcher.tar.gz`).
+2. Open the `Linux` folder and run **restreet-launcher**.
+3. The launcher sees that ReStreet is not installed yet and opens the setup: choose your FIFA Street ISO (it finds one in Downloads by itself), the install folder, your online name and server, then press **Install ReStreet**. It downloads the setup from the release, checks it and installs the game (5 to 15 minutes).
+4. Press **Play**. ReStreet is now in your applications menu and on your desktop.
-2. Install ReStreet from your ISO. The setup's normal window does not work under Proton, so use its install mode instead (your ISO, the folder to install to, your online name):
+On the Steam Deck, do this in Desktop Mode. To play from Game Mode, add **ReStreet** to Steam with "Add a Non-Steam Game" (pick the `restreet-launcher` in your ReStreet folder's `Linux` folder, and do not set a Proton version for it: it is a Linux program).
- ```bash
- umu-run ReStreet-2.0.7-Setup.exe --iso-install-test 'Z:\home\you\FIFASTREET.iso' 'Z:\home\you\Games\ReStreet' YourName
- ```
-
- `Z:` is your Linux `/`, so `Z:\home\you\...` is `/home/you/...`.
-3. Download **ReStreet-Linux-launcher.tar.gz** from the [latest release](https://github.com/samuelit0davila/fifa-street-pc-port/releases/latest) and extract it into your ReStreet folder, next to `Binaries` and `Game`.
-4. Run `Linux/restreet-launcher` and press **PLAY**. Press **Shortcut** in the launcher to add ReStreet to your applications menu.
-
-On Linux the launcher cannot update itself yet: to update, download the new launcher and run the new setup.
+The launcher cannot update itself on Linux yet; each new release says how to update.
## Online play
diff --git a/docs/BUILDING.md b/docs/BUILDING.md
index ab6718d..4d2c7e7 100644
--- a/docs/BUILDING.md
+++ b/docs/BUILDING.md
@@ -171,28 +171,29 @@ It activates the selected pair beside `fifastreet.exe` before starting the game.
## Build the Linux launcher
-`Launcher/FifaStreetLauncher.Linux` is a native Linux launcher for an existing ReStreet install. It shows the same
-`ui/launcher.html` in a WebKitGTK window (Photino.NET) and starts the Windows game through Proton with `umu-run`,
-passing the same `REX_*` and online `FIFASTREET_*` variables as the Windows launcher. It can be built on Linux or
-Windows with the .NET 8 SDK:
+`Launcher/FifaStreetLauncher.Linux` is a native Linux launcher. It shows the same `ui/launcher.html` in a WebKitGTK
+window (Photino.NET) and starts the Windows game through Proton, passing the same `REX_*` and online `FIFASTREET_*`
+variables as the Windows launcher. Without a ReStreet folder beside it, it first shows `ui/linux-setup.html`: it
+downloads the latest release's setup (checked against its `.sha256`), runs the setup's headless
+`--iso-install-test <iso> <folder> <name>` install through Proton, copies itself into `<ReStreet>/Linux` and adds
+the menu and desktop entries. It can be built on Linux or Windows with the .NET 8 SDK:
dotnet publish Launcher/FifaStreetLauncher.Linux/FifaStreetLauncher.Linux.csproj -c Release --self-contained -o dist/Linux
-Copy `dist/Linux` into the ReStreet folder (beside `Binaries` and `Game`) and run `Linux/restreet-launcher`, or pass
-`--root <ReStreet folder>`. `--play` starts the game without a window. The **Shortcut** button adds "ReStreet
-Launcher" and "ReStreet (direct play)" to the desktop menu.
+Run `dist/Linux/restreet-launcher`, or pass `--root <ReStreet folder>` for an existing install. `--play` starts the
+game without a window.
-Runtime needs: `umu-launcher`, `webkit2gtk-4.1` and a Proton build. The launcher prefers Proton-CachyOS, then
-GE-Proton, then Valve's; with none installed `umu-run` downloads UMU-Proton. The Wine prefix is
-`~/.local/share/restreet/prefix` (or `prefix-restreet` beside the install, if present). Settings are kept in
-`linux-settings.json`; `controls.json` and `fifastreet.toml` are shared with the Windows launcher and the game.
+Proton: `umu-run` when installed; otherwise the Proton that Steam already has (Steam libraries and
+`compatibilitytools.d`), run through Steam's `SteamLinuxRuntime_sniper` when present. Nothing has to be installed
+system-wide, which SteamOS's read-only system needs. Without WebKitGTK the page opens in the system browser.
+The Wine prefix is `~/.local/share/restreet/prefix` (or `prefix-restreet` beside the install, if present). Settings
+are kept in `linux-settings.json`; `controls.json` and `fifastreet.toml` are shared with the Windows launcher and
+the game.
-Not on Linux yet: the self-updater, stadium pictures and performance reports.
-
-Installing on Linux without Windows: the setup's page needs WebView2, which Proton lacks, so run its headless
-install instead (ISO, target folder, online name):
+For testing: `RESTREET_NO_UMU=1` ignores `umu-run`, and `RESTREET_BROWSER_UI=1` uses the browser instead of the
+window (the page address is printed).
- umu-run ReStreet-<version>-Setup.exe --iso-install-test 'Z:\path\to\FIFASTREET.iso' 'Z:\path\to\ReStreet' YourName
+Not on Linux yet: the self-updater, stadium pictures and performance reports.
## Package the installer