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.

fix: harden launcher input handling and installer file handling

Claude8ab7399702ba
diff --git a/Installer/BuildPrecompiled.py b/Installer/BuildPrecompiled.py
index dbe5021..e8df442 100644
--- a/Installer/BuildPrecompiled.py
+++ b/Installer/BuildPrecompiled.py
@@ -82,7 +82,7 @@ with zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED, compresslevel=6) as pac
for path in sorted(bundle.rglob('*')):
if path.is_file():
packed.write(path, path.relative_to(bundle).as_posix())
-subprocess.run(['rtk', 'proxy', 'dotnet', 'publish', str(root/'FifaStreetSetupTool/FifaStreetSetupTool.csproj'), '-c', 'Release', '-r', 'win-x64', '--self-contained', 'true', '-p:PublishSingleFile=true', '-p:IncludeNativeLibrariesForSelfExtract=true', '-p:RuntimeFrameworkVersion=8.0.31', f'-p:BundlePath={archive}', f'-p:PrecompiledManifest={manifest_path}', '-o', str(stage/'published')], check=True)
+subprocess.run(['dotnet', 'publish', str(root/'FifaStreetSetupTool/FifaStreetSetupTool.csproj'), '-c', 'Release', '-r', 'win-x64', '--self-contained', 'true', '-p:PublishSingleFile=true', '-p:IncludeNativeLibrariesForSelfExtract=true', '-p:RuntimeFrameworkVersion=8.0.31', f'-p:BundlePath={archive}', f'-p:PrecompiledManifest={manifest_path}', '-o', str(stage/'published')], check=True)
exe = stage/'FifaStreetSetup-Precompiled-LOCAL.exe'
shutil.copy2(stage/'published/FifaStreetSetup.exe', exe)
(stage/'build.json').write_text(json.dumps({'installer': str(exe), 'sha256': digest(exe), 'bytes': exe.stat().st_size, 'publication': 'Local test only; redistribution not reviewed', 'manifest': manifest}, indent=2), encoding='utf-8')
diff --git a/Installer/FifaStreetSetupTool/Program.cs b/Installer/FifaStreetSetupTool/Program.cs
index 8e5318a..07cb6f4 100644
--- a/Installer/FifaStreetSetupTool/Program.cs
+++ b/Installer/FifaStreetSetupTool/Program.cs
@@ -134,7 +134,10 @@ internal class InstallerEngine
string payload = Path.Combine(installerRoot, "payload");
if (!Directory.Exists(payload))
throw new Exception("The payload folder was not found.");
- CopyDirectory(payload, installFolder);
+ // Keep the player's existing settings when installing over a previous copy.
+ string settingsFile = Path.Combine(installFolder, "Game", "fifastreet.toml");
+ CopyDirectory(payload, installFolder,
+ target => string.Equals(target, settingsFile, StringComparison.OrdinalIgnoreCase) && File.Exists(target));
Console.WriteLine("Applying the start screen and main menu credits...");
CreditPatch.Apply(gameDataFolder);
@@ -302,9 +305,10 @@ internal class InstallerEngine
string directXex = Path.Combine(folder, "default.xex");
if (File.Exists(directXex)) return folder;
- foreach (string file in Directory.EnumerateFiles(folder, "default.xex", SearchOption.AllDirectories))
- return Path.GetDirectoryName(file);
- return null;
+ string[] matches = Directory.GetFiles(folder, "default.xex", SearchOption.AllDirectories);
+ if (matches.Length > 1)
+ throw new Exception("The ISO contains more than one default.xex; it may not be a supported FIFA Street image.");
+ return matches.Length == 1 ? Path.GetDirectoryName(matches[0]) : null;
}
static bool ValidateGame(string folder)
@@ -330,7 +334,7 @@ internal class InstallerEngine
return true;
}
- static void CopyDirectory(string sourceDir, string destinationDir)
+ static void CopyDirectory(string sourceDir, string destinationDir, Func<string, bool>? skip = null)
{
CancellationToken.ThrowIfCancellationRequested();
Directory.CreateDirectory(destinationDir);
@@ -338,12 +342,14 @@ internal class InstallerEngine
foreach (string file in Directory.GetFiles(sourceDir))
{
CancellationToken.ThrowIfCancellationRequested();
- File.Copy(file, Path.Combine(destinationDir, Path.GetFileName(file)), overwrite: true);
+ string target = Path.Combine(destinationDir, Path.GetFileName(file));
+ if (skip?.Invoke(Path.GetFullPath(target)) == true) continue;
+ File.Copy(file, target, overwrite: true);
}
foreach (string directory in Directory.GetDirectories(sourceDir))
{
- CopyDirectory(directory, Path.Combine(destinationDir, Path.GetFileName(directory)));
+ CopyDirectory(directory, Path.Combine(destinationDir, Path.GetFileName(directory)), skip);
}
}
}
diff --git a/Installer/__pycache__/BuildPrecompiled.cpython-313.pyc b/Installer/__pycache__/BuildPrecompiled.cpython-313.pyc
new file mode 100644
index 0000000..a08989f
Binary files /dev/null and b/Installer/__pycache__/BuildPrecompiled.cpython-313.pyc differ
diff --git a/Launcher/FifaStreetLauncher/LauncherForm.cs b/Launcher/FifaStreetLauncher/LauncherForm.cs
index 1379873..cd7dfe8 100644
--- a/Launcher/FifaStreetLauncher/LauncherForm.cs
+++ b/Launcher/FifaStreetLauncher/LauncherForm.cs
@@ -1093,22 +1093,21 @@ displayModeBox.SelectedIndexChanged += (_, _) => { UpdateRefreshRates(); UpdateS
Path.Combine(executableDirectory, "rexgpu-xenos.dll"),
true);
- if (string.IsNullOrWhiteSpace(resolutionBox.Text) ||
- !resolutionBox.Text.Contains('x'))
+ var resolution = resolutionBox.Text.Split('x');
+ if (resolution.Length != 2 ||
+ !int.TryParse(resolution[0], out int width) ||
+ !int.TryParse(resolution[1], out int height) ||
+ width <= 0 || height <= 0)
{
ShowError("Select a valid resolution.");
return;
}
-
- var resolution = resolutionBox.Text.Split('x');
- int width = int.Parse(resolution[0]);
- int height = int.Parse(resolution[1]);
string refresh = refreshBox.Text;
bool fullscreen =
displayModeBox.SelectedItem?.ToString() == "Fullscreen";
- int monitor = Math.Max(0, monitorBox.SelectedIndex);
+ int monitor = Math.Clamp(monitorBox.SelectedIndex, 0, Screen.AllScreens.Length - 1);
int adapter = gpuBox.SelectedIndex >= 0
? gpuAdapterIndices[gpuBox.SelectedIndex] : -1;
@@ -1557,8 +1556,10 @@ if (settings.InternalResolutionScale >= 0 &&
vrrBox.Checked = settings.VRR;
msaaBox.Checked = settings.MSAA;
}
- catch
+ catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or JsonException)
{
+ // Unreadable or corrupt settings fall back to the defaults.
+ Debug.WriteLine("Could not load launcher settings: " + ex.Message);
}
}