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.

testing workflow for auto upload compiled viewer folder

forestcolatf4b71c25db6b
diff --git a/.github/workflows/build-launcher.yml b/.github/workflows/build-standalone-launcher.yml
similarity index 95%
rename from .github/workflows/build-launcher.yml
rename to .github/workflows/build-standalone-launcher.yml
index 5f18169..701b849 100644
--- a/.github/workflows/build-launcher.yml
+++ b/.github/workflows/build-standalone-launcher.yml
@@ -1,4 +1,4 @@
-name: Build launcher
+name: Build Standalone launcher
on:
workflow_dispatch:
diff --git a/.github/workflows/build-viewer.yml b/.github/workflows/build-viewer.yml
deleted file mode 100644
index a063db6..0000000
--- a/.github/workflows/build-viewer.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-# Builds ReStreet-Viewer.zip (Electron for Windows + the viewer app) on a GitHub server.
-# Use: Actions tab -> "Build viewer" -> Run workflow. The result is in "Artifacts" -> viewer.
-name: Build viewer
-
-on:
- workflow_dispatch:
-
-jobs:
- build:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Build the viewer package
- shell: pwsh
- run: ./Viewer/build-viewer.ps1
-
- - uses: actions/upload-artifact@v4
- with:
- name: viewer
- path: ReStreet-Viewer.zip
-
diff --git a/.github/workflows/publish-viewer.yml b/.github/workflows/publish-viewer.yml
new file mode 100644
index 0000000..3dcece2
--- /dev/null
+++ b/.github/workflows/publish-viewer.yml
@@ -0,0 +1,42 @@
+# Builds the Electron viewer and publishes it as the fixed prerelease "viewer". Launchers on Wine/Proton download it
+# from there on first run. It runs when the Viewer folder changes (or by hand), not on every launcher release.
+name: Publish viewer
+
+on:
+ workflow_dispatch:
+ push:
+ branches: [main]
+ paths:
+ - 'Viewer/**'
+ - '.github/workflows/publish-viewer.yml'
+
+permissions:
+ contents: write
+
+jobs:
+ publish:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Build ReStreet-Viewer.zip
+ shell: pwsh
+ run: ./Viewer/build-viewer.ps1
+
+ - name: Checksum
+ shell: pwsh
+ run: |
+ $h = (Get-FileHash ReStreet-Viewer.zip -Algorithm SHA256).Hash.ToLower()
+ "$h ReStreet-Viewer.zip" | Out-File -Encoding ascii ReStreet-Viewer.zip.sha256
+
+ - name: Publish release "viewer"
+ shell: pwsh
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ gh release view viewer 2>$null
+ if ($LASTEXITCODE -ne 0) {
+ # Prerelease: the launcher's updater reads /releases/latest, which ignores prereleases.
+ gh release create viewer --prerelease --title "Viewer (Wine/Proton)" --notes "Electron window for the launcher on Linux and Steam Deck. Downloaded automatically by the launcher; not an update."
+ }
+ gh release upload viewer ReStreet-Viewer.zip ReStreet-Viewer.zip.sha256 --clobber
diff --git a/Launcher/FifaStreetLauncher/GlassUi.cs b/Launcher/FifaStreetLauncher/GlassUi.cs
index ea7c201..9ac247f 100644
--- a/Launcher/FifaStreetLauncher/GlassUi.cs
+++ b/Launcher/FifaStreetLauncher/GlassUi.cs
@@ -85,6 +85,7 @@ public partial class LauncherForm
// Wine/Proton: WebView2 is not reliable there, so the same page opens in the system browser.
if (RunningOnWine() || Environment.GetEnvironmentVariable("RESTREET_BROWSER_UI") == "1")
{
+ if (RunningOnWine()) await EnsureViewerAsync(); // first run on Proton: fetch the viewer once
StartBrowserUi();
if (browserActive) StartPageServices();
RevealWindow();
diff --git a/Launcher/FifaStreetLauncher/ViewerDownload.cs b/Launcher/FifaStreetLauncher/ViewerDownload.cs
new file mode 100644
index 0000000..1997cbb
--- /dev/null
+++ b/Launcher/FifaStreetLauncher/ViewerDownload.cs
@@ -0,0 +1,60 @@
+using System.Diagnostics;
+using System.IO.Compression;
+using System.Security.Cryptography;
+
+namespace FifaStreetLauncher;
+
+// Wine/Proton only: if Viewer\ReStreetViewer.exe is not next to the launcher, download ReStreet-Viewer.zip once from the
+// fixed "viewer" release of the repository (built by .github/workflows/publish-viewer.yml), check its SHA-256 and unpack it.
+// The viewer never changes between launcher versions, so one release serves every launcher version.
+// RESTREET_NO_VIEWER_DOWNLOAD=1 turns this off. Any failure only means the browser fallback is used, as before.
+public partial class LauncherForm
+{
+ private const string ViewerZipUrl = "https://github.com/samuelit0davila/fifa-street-pc-port/releases/download/viewer/ReStreet-Viewer.zip";
+ private const string ViewerShaUrl = ViewerZipUrl + ".sha256";
+
+ private async Task EnsureViewerAsync()
+ {
+ if (Environment.GetEnvironmentVariable("RESTREET_NO_VIEWER_DOWNLOAD") == "1") return;
+ string root = AppContext.BaseDirectory;
+ string viewer = Path.Combine(root, "Viewer");
+ if (File.Exists(Path.Combine(viewer, "ReStreetViewer.exe"))) return;
+ string temp = Path.Combine(root, "Viewer.download");
+ try
+ {
+ BrowserLog("Viewer missing; downloading " + ViewerZipUrl);
+ using var http = new HttpClient { Timeout = TimeSpan.FromMinutes(10) };
+ http.DefaultRequestHeaders.UserAgent.ParseAdd("ReStreetLauncher/" + LauncherVersion);
+ string expected = (await http.GetStringAsync(ViewerShaUrl)).Trim().Split(' ', '\t')[0].ToLowerInvariant();
+ if (Directory.Exists(temp)) Directory.Delete(temp, true);
+ Directory.CreateDirectory(temp);
+ string zip = Path.Combine(temp, "ReStreet-Viewer.zip");
+ using (var response = await http.GetAsync(ViewerZipUrl, HttpCompletionOption.ResponseHeadersRead))
+ {
+ response.EnsureSuccessStatusCode();
+ await using var input = await response.Content.ReadAsStreamAsync();
+ await using var output = File.Create(zip);
+ await input.CopyToAsync(output);
+ }
+ string actual;
+ await using (var check = File.OpenRead(zip))
+ actual = Convert.ToHexString(await SHA256.HashDataAsync(check)).ToLowerInvariant();
+ if (actual != expected) { BrowserLog("Viewer download rejected: SHA-256 mismatch."); return; }
+ string unpacked = Path.Combine(temp, "Viewer");
+ await Task.Run(() => ZipFile.ExtractToDirectory(zip, unpacked));
+ if (!File.Exists(Path.Combine(unpacked, "ReStreetViewer.exe"))) { BrowserLog("Viewer download rejected: no ReStreetViewer.exe inside."); return; }
+ if (Directory.Exists(viewer)) Directory.Delete(viewer, true);
+ Directory.Move(unpacked, viewer);
+ BrowserLog("Viewer installed at " + viewer);
+ }
+ catch (Exception ex) when (ex is HttpRequestException or IOException or InvalidDataException or UnauthorizedAccessException or TaskCanceledException)
+ {
+ BrowserLog("Viewer download failed: " + ex.Message);
+ }
+ finally
+ {
+ try { if (Directory.Exists(temp)) Directory.Delete(temp, true); }
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) { Debug.WriteLine(ex.Message); }
+ }
+ }
+}